You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Zorro <hz...@gmail.com> on 2015/10/05 15:08:42 UTC

JSP compilation error Tomcat 8.0.27

Hi,

I installed Tomcat 8.0.27 last weekend and now using it I do get JSP 
compilation exceptions.

This is an example causing such an exception:
<c:if test="${! (empty Active || Active == \"on\")}">
         <c:set var="active" scope="page" value="" />
</c:if>
(Active is a String and c: means jstl/core)

If I change it to this
<c:if test="${! (empty Active || Active == 'on')}">
or
<c:if test="${! (empty Active || Active == on)}">

Then no exception occurs anymore.

I expected
<c:if test="${! (empty Active || Active == \"on\")}"> and
<c:if test="${! (empty Active || Active == 'on')}">
being proper code and
<c:if test="${! (empty Active || Active == on)}">
faulty coding.

Has this to do with the change handling  \${ vs \$ escaping in JSP and EL?

Regards,
Harm-Jan Zwinderman


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JSP compilation error Tomcat 8.0.27

Posted by Zorro <hz...@gmail.com>.
Op 5-10-2015 om 16:27 schreef Mark Thomas:
> On 05/10/2015 14:08, Zorro wrote:
>> Hi,
>>
>> I installed Tomcat 8.0.27 last weekend and now using it I do get JSP
>> compilation exceptions.
>>
>> This is an example causing such an exception:
>> <c:if test="${! (empty Active || Active == \"on\")}">
>>          <c:set var="active" scope="page" value="" />
>> </c:if>
>> (Active is a String and c: means jstl/core)
>>
>> If I change it to this
>> <c:if test="${! (empty Active || Active == 'on')}">
>> or
>> <c:if test="${! (empty Active || Active == on)}">
>>
>> Then no exception occurs anymore.
>>
>> I expected
>> <c:if test="${! (empty Active || Active == \"on\")}"> and
>> <c:if test="${! (empty Active || Active == 'on')}">
>> being proper code and
>> <c:if test="${! (empty Active || Active == on)}">
>> faulty coding.
>>
>> Has this to do with the change handling  \${ vs \$ escaping in JSP and EL?
> It has. Having reviewed the specs carefully, the JSP spec has to be used
> up to ...${ and from }... but what appears between the braces is parsed
> according to the rules of the EL spec. The rule about the use of quotes
> in attribute values do not apply when parsing the EL.
>
> I'd expect either of these to work:
> <c:if test="${! (empty Active || Active == 'on')}">
> <c:if test="${! (empty Active || Active == "on")}">

Yes these 2 work indeed.
I'll stick then with the "on" form.

> I'm surprised that
> <c:if test="${! (empty Active || Active == on)}">
>
> works. I wonder how the on is being interpreted.
>
> Mark

The outcome of the expression is always true.
I suspect that is interpreted as Active == null.

Anyway thanx for looking at it.
I'll remove the backslashes in my JSPs.

Regards,
Harm-Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JSP compilation error Tomcat 8.0.27

Posted by Mark Thomas <ma...@apache.org>.
On 05/10/2015 14:08, Zorro wrote:
> Hi,
> 
> I installed Tomcat 8.0.27 last weekend and now using it I do get JSP
> compilation exceptions.
> 
> This is an example causing such an exception:
> <c:if test="${! (empty Active || Active == \"on\")}">
>         <c:set var="active" scope="page" value="" />
> </c:if>
> (Active is a String and c: means jstl/core)
> 
> If I change it to this
> <c:if test="${! (empty Active || Active == 'on')}">
> or
> <c:if test="${! (empty Active || Active == on)}">
> 
> Then no exception occurs anymore.
> 
> I expected
> <c:if test="${! (empty Active || Active == \"on\")}"> and
> <c:if test="${! (empty Active || Active == 'on')}">
> being proper code and
> <c:if test="${! (empty Active || Active == on)}">
> faulty coding.
> 
> Has this to do with the change handling  \${ vs \$ escaping in JSP and EL?

It has. Having reviewed the specs carefully, the JSP spec has to be used
up to ...${ and from }... but what appears between the braces is parsed
according to the rules of the EL spec. The rule about the use of quotes
in attribute values do not apply when parsing the EL.

I'd expect either of these to work:
<c:if test="${! (empty Active || Active == 'on')}">
<c:if test="${! (empty Active || Active == "on")}">

I'm surprised that
<c:if test="${! (empty Active || Active == on)}">

works. I wonder how the on is being interpreted.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org