0

First look at the following code:

<c:choose>
   <c:when test="${type != 'h'}">
      <input type="password" disabled="true" id="plainText" name="plainText"  value="<%=key%>"/>

The above code is a part of JSP that I have created. Variable type is initialized using:

pageContext.setAttribute("type", type);

This JSP is working perfectly fine when deployed and used GlassFish Server but showing javax.el.ELException: Cannot convert h of type class java.lang.String to class java.lang.Long exception when deployed on Apache Tomcat Server.

I had deployed on GlassFish server using Netbeans automatically, while deployed on Tomcat server manually using WAR file.

What exactly is the problem?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Kush Grover
  • 363
  • 1
  • 6
  • 16

2 Answers2

0

Maybe your glassfish uses an different EL version than Tomcat...

For more details: JSP comparison operator behaviour

Also make sure that 'type' in pageContext.setAttribute("type", type) is a string and not an INT or LONG value.

Community
  • 1
  • 1
Tobi Tiggers
  • 442
  • 3
  • 14
0

Found the solution, As type is a character. The following code: <c:when test="${type != 'h'}"> should be written as <c:when test="${type != 'h'.charAt(0)}">

Now it's working.

Kush Grover
  • 363
  • 1
  • 6
  • 16