interpolated runtime values error

Anyone know what this JSP error message means?

Stack = com.caucho.jsp.JspParseException: /admin/grantReport/displayReport.jsp:12: interpolated runtime values are forbidden by the JSP spec at `reportByVolunteer.jsp?grantNumber=&certificateNumber=' at com.caucho.jsp.JspGenerator.error( at com.caucho.jsp.JspGenerator.hasRuntimeAttribute( at ...

The error is occurring on the following "<jsp:forward..." lines.

The objectionable code follows:

      String grantNumber = request.getParameter("grantNumber");
      String position = request.getParameter("position");

      if (position == null || position.equals("")) { %>
          <jsp:forward page="reportByVolunteer.jsp?grantNumber=<%= grantNumber %>&certificateNumber=<%= request.getParameter('certificateNumber') %>" />
<%      } else { %>
          <jsp:forward page="reportByPosition.jsp?grantNumber=<%= grantNumber %>&position=<%= position %>" />
<%      } %>

If I replace the variables with constants, the page works. I can see in the URL address bar that the variables are being passed correctly. ie ...?grantNumber=grant4&certificateNumber=&position=Webmaster&Submit=Submit
Who is Participating?
what happens if you do as such:

String s = "reportByVolunteer.jsp?grantNumber=<%= grantNumber %>&certificateNumber=<%= request.getParameter('certificateNumber') %>";

     if (position == null || position.equals("")) { %>
         <jsp:forward page="<% s %>" />
oops,  <jsp:forward page="<%= s %>" />
oops again,

String s = "reportByVolunteer.jsp?grantNumber=" + grantNumber + "&certificateNumber=" + request.getParameter('certificateNumber');
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

softechnicsAuthor Commented:
Damned! It worked!! Why?????

I'm doing something very similar in another application and my original approach above works there!
as far as I know jsp never liked tags inside <jsp:forward..
yeah, i've noticed the same... that request.getParameter(..) in the jsp:forward tag is what made me suggest the solution i did.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.