I have some small jsp fragments stored in a database. The fragments are templates that are used to display objects in my system.
In other words you're looking for something which in some interpreted languages (Lisp, Perl etc.) is called "eval", to take a block of text (data) and evaluate/interpret it as runtime code.
If the fragments are just HTML (e.g. anything which just has to be inserted verbatim into the JSP output response), that's easier; you could just read them from the database in a bean, and then output them from a property of the bean (Struts "bean:write", JSP "getProperty").
But if the fragments are real Java code, I am not sure, you might be getting yourself into a situation that may be more work than some other way of doing what you need -- but if you really think you need to do it this way, you might have to mess with runtime compilation and execution in a new separate class loader. Or some kind of serialization maybe, of compiled classes into the db?