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 not work because I am running on the Google App Engine, and I'm not sure how slow that would be and also there is a Quota for the number of url fetches you can make.
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.