{ by david linsin }

February 08, 2007

Learning it the hard way

A couple of days ago I had to find out the hard way that using Expression Language in JSTL is not as easy as it looks. I had following code which looked the same to me - at first:

1.) <c:set var="x" value="${32}"/>

2.) <c:set var="x" value="32"/>

The subtle difference is that in the first case x is treated as numeric value and in the second code example x is treated as a String. The reason I didn't recognize the difference is that the following code didn't through any Exception:

<c:set var="x" value="${32}"/>
<c:set var="y" value="40"/>

<c:if test="${y ge x}">

The test was simply false all the time, which I only recognized after it went to production. I know you probably think that's pretty obvious - now I think so too!

0 comments:


com_channels

  • mail(dlinsin@gmail.com)
  • jabber(dlinsin@gmail.com)
  • skype(dlinsin)

recent_postings

loading...