JSP: Include label for learning. An error occurs.

Source: Internet
Author: User
java.io.IOException: Stream closed org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:202) org.apache.jasper.runtime.JspWriterImpl.clearBuffer(JspWriterImpl.java:157) org.apache.jsp.WEB_002dINF.pages.tilestest.main_jsp._jspService(main_jsp.java:76) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012) org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345) org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:582) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:260) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
The following are related files:
---------------------main.jsp----------------------------
<table width="100%">
<tr>
 <td width="50%" valign="top">
 <jsp:include page="/sub1.do"/>
 </td>
</tr>
<tr>
 <td><jsp:include page="/sub2.do"/></td>
</tr>
</table>
--------------struts-config.xml------------------------
<action-mappings>
   <action path="/tilestest" forward="/WEB-INF/pages/tilestest/main.jsp"/>
   <action path="/sub1" forward="testTilesSub1"/>
   <action path="/sub2" forward="/WEB-INF/pages/tilestest/sub2.jsp"/>
</action-mappings>
 <plug-in className="org.apache.struts.tiles.TilesPlugin">
  <set-property property="definitions-config" value="/WEB-INF/struts/tiles-defs.xml"/>
    <set-property property="moduleAware" value="true"/>
    <set-property property="definitions-parser-validate" value="true"/>
 </plug-in>
--------------tiles-defs.xml----------------------------------
<tiles-definitions>
  <definition name="baseDef" path="/baselayout.jsp">
 <put name="title" value="baseDef.title"/>
 <put name="header" value="/WEB-INF/pages/titles/header.jsp"/>
 <put name="body" value="/WEB-INF/pages/titles/body.jsp"/>
 <put name="footer" value="/WEB-INF/pages/titles/footer.jsp"/>
  </definition> 
  <definition name="testTilesSub1" extends="baseDef">
    <put name="header" value="/WEB-INF/pages/tilestest/sub1.jsp"/>
  </definition>
  <definition name="testTilesSub2" extends="baseDef">
    <put name="header" value="/WEB-INF/pages/tiletest/sub2.jsp"/>
  </definition> 
</tiles-definitions>
Sub1.jsp and sub2.jsp both have only displayed text, such as slkdjflksdflakdsflasd.
Note that the forward of sub1 and sub2 in the struts-config.xml is different, and the above error occurs when sub1 is used.
See address: http://mail-archives.apache.org/mod_mbox/tomcat-dev/200307.mbox/%3C20030709224018.7289.qmail@nagoya.betaversion.org%3E for error Solution
And http://issues.apache.org/struts/browse/STR-2969
My understanding: because I used the extends attribute of defination in the tiles-defs.xml, so the above error will appear, and then I did not use extends, switched to the path attribute, <definition name = "testtilessub1" Path = "/WEB-INF/pages/tilestest/sub1.jsp"/> so you can

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.