JSP Error: Expecting "jsp:param" standard action with "name" and "value" attributes

user620339 picture user620339 · Apr 24, 2012 · Viewed 7.2k times · Source

I have a JSP page having the following code:

<td colspan=2>
    <div align="right">         
        <jsp:include page="/field_help.jsp" flush="true" >
            <% if(researchTabON) { %>
                <jsp:param name = "Command" value ="research"/>
            <% } else { %>
                <jsp:param name = "Command" value ="error"/>
            <% } %>
            <jsp:param name="Location" value="paperworkadmintool/xml/pwAdminFieldHelp.xml"/>
        </jsp:include>
    </div>
</td>

Above snippet runs fine on WAS 6, but when I try to run same on Tomcat, it throws out below exception:

/my_page.jsp(71,7) Expecting "jsp:param" standard action with "name" and "value" 
    attributes org.apache.jasper.JasperException: /my_page.jsp(71,7) Expecting 
    "jsp:param"  standard action with " name"  and " value"  attributes

at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
at org.apache.jasper.compiler.Parser.parseParam(Parser.java:843)

Answer

Ehsan Khodarahmi picture Ehsan Khodarahmi · Apr 24, 2012
<%
String command = ... ;//calculate your desired value here
%>
    <jsp:include page="/field_help.jsp" flush="true" >
        <jsp:param name="Command" value="<%=command%>"/>
        <jsp:param name="Location" value="paperworkadmintool/xml/pwAdminFieldHelp.xml"/>
    </jsp:include>