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

August 23rd, 2007
If you are constantly and inexplicably getting a JasperException with the message Expecting "jsp:param" standard action with "name" and "value" attributes from Tomcat, when trying to include another page from a JSP, then you are probably trying to use an empty <jsp:include> tag, like this:

<jsp:include page="..."></jsp:include>

Although this code may not produce syntax errors in your IDE (at least, that's the situation in my eclipse), it is not agreeable by Jasper, Tomcat's JSP compiler. Jasper requires that between the opening <jsp:include> tag, and the closing </jsp:include> tag, there is at least one <jsp:param> tag. If you do not have to pass any parameters to pass to the included page, then you must use the single tag version, which is:

<jsp:include page="..."/>

If you don't know the exact number of parameters to be passed at the time of authoring, for example, if you are passing parameters from a HashMap object, you should include both versions, and distinguish which one to use with an if-then-else statement. Like this:

<% HashMap<String,String> params;

// ...

if (params.size() > 0) { %>
<jsp:include flush="true" page="page.jsp">
<% for (String name : params.keySet()) { %>
<jsp:param name="<%=name %>"
value="<%=params.get(name) %>"/>
<% } %>
</jsp:include>
<% } else { %>
<jsp:include flush="true" page="page.jsp"/>
<% } %>


2 Responses to “JasperException: Expecting "jsp:param" standard action with "name" and "value" attributes”

  1. Suganya Says:
    i got this issue and fixed it from ur comments....Thank you....
  2. Nenad Says:
    Tnx a lot. This was very helpful.

Leave a Reply