How to store the result of a JSP in a string?
Posted
by Spines
on Stack Overflow
See other posts from Stack Overflow
or by Spines
Published on 2010-03-22T20:46:14Z
Indexed on
2010/03/22
21:01 UTC
Read the original article
Hit count: 250
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.
© Stack Overflow or respective owner