How to store the result of a JSP in a string?
- by Spines
I want to store the result of a JSP in a string.
For example, I want to be able to call a function like:
String result = ProcessJsp("/jspfile.jsp");
Also, this must be rather efficient. Making a url request to the jsp and then storing it would definitely be too slow.
How could I do this?
Here are my thoughts on how to do this, though I'm not sure if it would work, and I'm hoping there is something simpler:
Do RequestDispatcher("/jspfile.jsp").include(hreq, hresp), but instead of putting the real HttpResponse object in there, you put your own where the getWriter() method returns something that writes to your String or a memory buffer, etc.