The problem is that by the time the code in the JSP runs, and this includes the code in the tag that is getting the 'code' out of the database, the JSP has already been compiled. So there is no way to include that 'code' in the JSP.
However, I assume that the 'code' eventually generates HTML to include in the page. Therefore, you could look into generating, and compiling, a class on the fly, using the 'code' as the body of a method that returns a string. Defining an interface that describes this method would help.
Instead of a JSP page I would also be able to use a servlet. The more I think about it - it all boils down to one question: How do I call the JSP compiler? I looked at the jasper docs - but I dont quite understand how to start... :-(
The thing is I do need to use the taglib so it might be sensible to do the compiling myself - but then using the JSP compiler would be more flexible...