Note that there are some explanatory texts on larger screens.

plurals
  1. POJSP importing a file
    text
    copied!<p>Good day!</p> <p>I encountered the following error upon running my JSP program.</p> <pre><code>java.lang.IllegalStateException: PWC3991: getOutputStream() has already been called for this response </code></pre> <p>It seems like the html file inside my JSP doesn't work. My code is as follows:</p> <pre><code>&lt;%@page import = "java.util.*"%&gt; &lt;%@page import = "javax.servlet.*"%&gt; &lt;%@page import = "javax.servlet.http.*"%&gt; &lt;%@page import= "session.*" %&gt; &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;title&gt;JSP Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;% Item item = (Item) request.getAttribute("invenItem"); if (item != null) { out.println("&lt;html&gt;&lt;title&gt;Inventory Item&lt;/title&gt;"); out.println("&lt;body&gt;&lt;h1&gt;Inventory Item Details:&lt;/h1&gt;"); out.println("Stock ID : " + item.getStockID() + "&lt;br/&gt;"); out.println("Name : " + item.getItemName() + "&lt;br/&gt;"); out.println("Unit Price: " + item.getUnitPrice() + "&lt;br/&gt;"); out.println("On Stock : " + item.getOnStock() + "&lt;br/&gt;"); out.println("&lt;/body&gt;"); out.println("&lt;/html&gt;"); } else { RequestDispatcher rd = request.getRequestDispatcher("DataForm.html"); //NOT WORKING rd.include(request, response); out.println("&lt;br&gt;Item not found...&lt;br&gt;"); rd = request.getRequestDispatcher("ItemEntry.html"); //NOT WORKING rd.include(request, response); } %&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>My html Files are located inside the folder <strong>WEB-INF</strong>. How can I make it work? DO i need to import it also? Thank you.</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