Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerate HTML from JSP
    text
    copied!<p>The basic servlet jsp setup I'm familiar with ....</p> <pre><code>RequestDispatcher dispatcher = request.getRequestDispatcher(resourceA.jsp); dispatcher.forward(request, response); </code></pre> <p>The problem is, in addition to sending the reply back to the browser (resourceA.jsp), I need to create a second HTML output from resourceB.jsp, witch in turn will be emailed or used to create pdf document.</p> <p>This is not done every time, just in specific conditions and by calling </p> <pre><code>dispatcher.forward(request, response); </code></pre> <p>the second time I get and <strong>IllegalArgumentException</strong>.</p> <p>I just need a way in generating HTML from jsp (<strong>basically replacing the ${par} values</strong>) and returning the html as String, no status code or headers, just html and A have nothing to do with B, so Filters will not work.</p> <p>------ replay to first Answer ----- comment to small --- no formatting</p> <p>I can't see why this is so difficaled....</p> <p><strong><em>all the magnesium's is there to merge data with HTML content in the</em></strong></p> <pre><code>${par} ${par['key']} &lt;c:if test="${patBoolean}" &gt; &lt;c:forEach var="pvar" varStatus="s_pvar" items="${parList}"&gt; </code></pre> <p>I even created a wrapper to mask getOutputStream() and getWriter(), creating my own PrintWriter</p> <pre><code>public class ResponseWrapper extends HttpServletResponseWrapper{ private PrintWriter printWriter; public ResponseWrapper(HttpServletResponse response){ super(response); } public ServletOutputStream getOutputStream() throws java.io.IOException{....} public PrintWriter getWriter() throws java.io.IOException {....} } </code></pre> <p>in getting the result for the resourceB.jsp, but the problem is dispatcher.forward(request, response) sets isCommitted some ware in the original HttpServletResponse.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload