• 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
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

JSTL question about jstl/function fn:  RSS feed

 
Greenhorn
Posts: 27
  • 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: 2504
321
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: 67256
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: 20639
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • 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: 27
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
Uh oh, we're definitely being carded. Here, show him this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!