• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why $ in jstl core tag attributes?  RSS feed

 
A Bhattacharya
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the jstl core tag attributes why do we have it like

<c:choose>
<c:when test="${customer.category == 'trial'}" >

This syntax "${customer.category == 'trial'}" is very non intuitive and confusing to me. After all this entire string is going to be fed to the java implementation which is going to extract out the operands. It could have been allowed like <c:when test="customer.category == 'trial'" >

Is there any logical reason with the $ and {} ; I forget the weird syntax everytime.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After all this entire string is going to be fed to the java implementation which is going to extract out the operands. It could have been allowed like <c:when test="customer.category == 'trial'" >


The EL syntax '${}' tells the tag that you're not passing it it a string.
You're passing it an expression which needs to be evaluated.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And as of JSP 2.0, it has nothing to do with the JSTL. The EL is party of core JSP.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!