This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Rendering JSP loaded from the database. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Rendering JSP loaded from the database." Watch "Rendering JSP loaded from the database." New topic
Author

Rendering JSP loaded from the database.

Alan Parson
Greenhorn

Joined: Feb 20, 2006
Posts: 10
I have a JSP (consisting of custom tags) stored as a CLOB in the database. (don't ask why it is this way). I need to load that fragment
at runtime and render it.

Basically I need the equivalent of an "eval" operation that is present in
Javascript but it applies to JSPs..

I have noticed that it does not work (using Resin 3.0+). Is this even
possible?

[ February 20, 2006: Message edited by: Alan Parson ]
[ February 20, 2006: Message edited by: Alan Parson ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Originally posted by Alan Parson:
(don't ask why it is this way)


OK, I won't ask -- and I'll assume you're not in a position to rethink that -- but such an egregious violation of the separation of concerns makes my teeth hurt.

I need to load that fragment at runtime and render it.


As you have seen, merely blatting it out to the JSP at run time isn't going to work. JSP is parsed and evaluated at translation time and converted to servlet code. By the time the JSP is executed, the time for translation is long past.

Is this even possible?


Nothing I can think of off the top of my head is going to allow you to trigger a translation on a string in memory -- but that's certainly nothing that I've given any previous thought to.

The only thing that occurs to me that could work is to write the fragment out to a temporary JSP file, and then use a request dispatcher to include the on-disk fragment.
[ February 20, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rendering JSP loaded from the database.
 
Similar Threads
problem with prometric
Interesting interview programming problem
Question on text validation
Pagination
background and previous employment