Let's say you get some data from a source and you use this data and create a jsp page from it (Does not matter what data etc, you jsut use some form of data to create some jsp page). You can have this page in stream or file format.
I would be using struts.
Would it be possible to create this stream/file while in the same web container then display it?
Sure. Have a servlet that will write the text of the JSP out to a file then forward to it. The engine will detect that it hasn't yet been translated and trigger the translation. Seems like a really weird thing to do, but possible.
Originally posted by William Brogden: Another alternative would be to write the code for the dynamic page in a scripting language such as Jython or Groovy. Your custom tags would have to be re-implemented of course. Bill
Just curious, why would this be a good idea in comparison to what Bear suggested? I am still trying to see the benefit of scripting languages meshed with Java.
Author and all-around good cowpoke
Joined: Mar 22, 2000
Just curious, why would this be a good idea in comparison to what Bear suggested?
What bothers me about writing a new JSP file every time a request is processed is that you end up with all these .jsp and .class files cluttering up the disk, and loaded class files cluttering up memory. Seems to me you end up with a housekeeping problem.
I am still trying to see the benefit of scripting languages meshed with Java.
Me too so far I have not found many but so many folks are enthusiastic about scripting languages I feel I should make an effort! Bill
Joined: Jul 20, 2006
Well I was thinking of having the files naems based off the session ID for physical cleanup. The problem I run into is how to remove it from memory..
Would it be possible to use a custom ClassLoader? This is one area where I really have no expertise.
I'd like to avoid this but I don't know another way that I could render a jsp file from a String. Thats the main goal.. I get a String that is an entire jsp file (with custom tags) from an object and I need to render it.. in the same container.