2

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)
Emil Sierżęga
  • 1,785
  • 2
  • 31
  • 38
user620339
  • 851
  • 3
  • 20
  • 42

4 Answers4

3
<%
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>
Ehsan Khodarahmi
  • 4,772
  • 10
  • 60
  • 87
0

Tomcat apparently doesn't like this syntax. You normally get this error when the <jsp:include> body is empty. Apparently those scriptlets have generated confusing Java code. Try changing it as follows:

<jsp:include page="/field_help.jsp" flush="true" >
    <jsp:param name="Command" value="<%=(researchTabON ? "research" : "error")%>"/>
    <jsp:param name="Location" value="paperworkadmintool/xml/pwAdminFieldHelp.xml"/>
</jsp:include>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
0

:- This action tag allows a static or dynamic resources such as HTML or JSP page specified by URL to be included in current JSP while processing the request.This include tag contains 2 attributes 1.page:It is similar to page Diretive tags. 2.flush:Takes true or false,which indicates whether or not buffer needs to be flushed before including the resource.the default value is false.

Pryia
  • 1
0

Wanted to add to this thread. I am doing a weblogic to tomcat switch, and was having the same error. In my case it was because of an HTML comment that weblogic was ok with but tomcat was not.

    <jsp:include page="/test.jsp"> <!-- COMMENT -->
      <jsp:param name="vType" value="<%=name%>" /> 
    </jsp:include>
Mr Man
  • 1,498
  • 10
  • 33
  • 54