JSP include指令不使用struts标记

时间:2014-03-26 14:30:52

标签: java jsp java-ee struts2 struts

我有一个部分,使用下面的struts标记然后是jsp include

来显示
<div>
     <span>Title</span>
    <s:action name="content" namespace="/tempcontent" executeResult="true" flush="false">
        <s:param name="shortName">qr</s:param>
        <s:param name="maxResults">3</s:param>
        <s:param name="template">/jsp/peps/chSection.jsp</s:param>
    </s:action>
</div>

<div>
   <%@include file="/jsp/ratings/includes/screening.jsp" %>
</div>

这里我无法使用include指令呈现JSP。如果我删除包含struts标记的部分它将被正确包含。这对我来说似乎很奇怪。请帮忙。

2 个答案:

答案 0 :(得分:0)

  

我无法呈现JSP

您是否包含Struts标签声明?

<%@ taglib prefix="s" uri="/struts-tags" %>

还要记住静态<%@include指令,动态<jsp:include/>操作之间的the big differences,甚至更好,请使用特定于Struts的<s:include />标记。

答案 1 :(得分:0)

我已经在Velocity的帮助下解决了这个问题。我已经为视图使用了速度模板。 现在它能够包含其他JSP。

<div>
 <span>Title</span>
<s:action name="content" namespace="/tempcontent" executeResult="true" flush="false">
    <s:param name="shortName">qr</s:param>
    <s:param name="maxResults">3</s:param>
    <s:param name="velTemplate">chPepSection.vm</s:param>
    <s:param name="template">/jsp/peps/chSection.jsp</s:param>
</s:action>
</div>

<div>
   <%@include file="/jsp/ratings/includes/screening.jsp" %>
</div>

我正在使用velocityEngine将我为视图获取的模型与速度模板合并。

相关问题