user620339
user620339

Reputation: 901

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

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)

Upvotes: 2

Views: 7466

Answers (4)

Mr Man
Mr Man

Reputation: 1588

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>

Upvotes: 0

Pryia
Pryia

Reputation: 1

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

Upvotes: 0

Ehsan Khodarahmi
Ehsan Khodarahmi

Reputation: 4922

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

Upvotes: 3

BalusC
BalusC

Reputation: 1108587

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>

Upvotes: 0

Related Questions