reset password
Author Message
yxu22
Posts: 25
Posted 12:54 Mar 07, 2013 |

Professor Sun:

when I wrote like this in servlet:

  request.setAttribute("case",1);

And I wrote EL in JSP:

  <c:set var="caa" value="${requestScope.case}" />

I got an Error: 

HTTP Status 500 - /WEB-INF/info.jsp (line: 13, column: 0) "${requestScope.case}" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${requestScope.case}]

Is "case" a special word in the request or in the EL?

After I change the code as follows, the error is fixed.

 request.setAttribute("caa", 1); 

<c:set var="caa" value="${requestScope.caa}" />

 

 

 

cysun
Posts: 2935
Posted 13:53 Mar 07, 2013 |

"case" is not a reserved words for EL as far as I know (see http://docs.oracle.com/javaee/6/tutorial/doc/bnail.html), but it is a reserved word for Java ("case" in a switch statement), so maybe that's the reason for the exception.