What is the difference between "$ {foo.bar}" and "# {foo.bar}"?

I can use objects from my Java Beans inside .jsp files using an expression language (EL). Therefore, I can get my value by typing $ {foo.bar}. But I can also use # {foo.bar}.

Can someone explain the difference or provide a link with relevant information?

+4
source share
2 answers
Syntax

#{foo.bar} - it JSF expression language. A bright sparkle thought it would be nice to use a different syntax for JSP EL (ie ${foo.bar} ). I think that some JSP containers are tolerant to this cookie and allow you to use one of them.

+6
source

This is described in the JSP 2.1 specification .

Java EE for deferred evaluation uses #{expr} and ${expr} for immediate evaluation. Pending expression expressions ( #{expr} ) can only be used with tag attributes that accept them. This is a Java EE convention, but other domains can impose their own meaning (for example, if you want to use EL in your own templates ).

+17
source

All Articles