Search code examples
javajspjakarta-eestruts2struts

JSP include directive not working with struts tag


I have a section which gets displayed using the struts tag below followed by a 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>

Here I am not able to render the JSP using the include directive. If I remove the section containing struts tag It gets included properly. This seems to be strange to me. Please help.


Solution

  • I have solved that with the help of Velocity.I have used velocity template for the view. Now its able to include the other JSPs in it.

    <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>
    

    I am using velocityEngine to merge the model i am getting for the view with the velocity template.