我使用的是java和sitemesh。
主体装饰器调用具有如下jsp Profile.jsp文件
<jsp:include page="/serveComments.html" flush="true">
<jsp:param value="78" name="passId"/>
</jsp:include>但是,当我添加这个include时,profile.jsp就消失了,我只剩下serveComments.html (由sitemesh处理,因为头和边界已经就位了。
decorator.xml如下
<decorators defaultdir="/WEB-INF/sitemesh-decorators">
<excludes>
<pattern>/j_spring_security_logout</pattern>
<pattern>/pages/logout-redirect.jsp</pattern>
<pattern>*/getMagazine.html*</pattern>
<pattern>*/serveComments.html*</pattern>
</excludes>
<decorator name="main" page="main.jsp">
<pattern>/*</pattern>
</decorator>
<decorator name="panel" page="panel.jsp"/>
<decorator name="printable" page="printable.jsp"/>
</decorators>希望我已经说清楚了。
发布于 2011-09-02 19:43:58
在模板框架中使用<jsp:include>是有问题的。至少在tomcat中,jsp:include标记的实现方式是将输出直接写入输出流,而不是页面上下文标记缓冲区。我不确定sitemesh是如何在幕后工作的,但例如Tiles就是一个“标准”标记库,它将输出写入到页面上下文标记缓冲区的堆栈中,一旦呈现了整个标记层次结构,这些缓冲区就会输出到servlet输出流中。这使得jsp:include在Tiles上下文中无法有效使用。
由于jsp:include不写入标记缓冲区,而是直接写入输出流,因此内容将被无序发送,或者根本不发送,这取决于sitemesh标记的工作方式。可能是sitemesh标签在渲染时将输出流重定向到某个空流。
https://stackoverflow.com/questions/7282776
复制相似问题