• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

JSTL question about jstl/function fn:  RSS feed

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not very familiar with JSTL.

The original jsp looks like


If I want to apply JSTL fn:someFunction on this firstName variable, should I use

 
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be this:
It would have been faster though just to try it yourself and see which one worked.
 
Marshal
Posts: 67241
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ${} encloses the entire expression and is never nested. It's an expression delimiter, not a fetch operator.
 
Saloon Keeper
Posts: 20510
115
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The ${} encloses the entire expression and is never nested. It's an expression delimiter, not a fetch operator.



To be precise, it's a Unified Expression Language operator. When encountered in a co-operative environment such as a JSP page template, the EL parser interprets the "${}" expression as something that it should interpret and return a substitution value in place of the "${}". And, incidentally, this is the reason why some jQuery expressions using the "$" Query notation have problems on certain types of web page templates - meaning that the alternative "jQuery." form is safer there.

There's another EL operator, but you won't usually see it on JSPs. That's the "#{}" notation. The ${} is older, but it's a read-only functionality. As I said, the results of its expression replace it when presenting the web page.

The "#{}" is slightly different. Such expressions don't represent a value, but rather a reference. When rendering a page, they act just like "${}", but when submitting a page, the #{} expression can be used to locate a method or write a value. This is used by JavaServer Faces, for example, since JSF doesn't require user-coded controller logic to move data property values to and from a backing model bean.
 
Jack Mutansan
Greenhorn
Posts: 26
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!