• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

is EL evaluated if it's inside quotes

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will the EL inside the following line be evaluated
<a href='mailto:${initParam['master-email']}'>
 
blacksmith
Posts: 979
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maih,

EL expressions (of the form ${...}) are evaluated when they
appear in template text or action attributes, unless you
specified they should not be, either in the Deployment Descriptor
or the jsp.

Kind regards,

Gian
 
maih fhil
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply
But it is given in the HFSJ that this line is executed properly even though it is inside the quotes
 
Gian Franco
blacksmith
Posts: 979
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I see...

I've tried two options in a sample application, and



and



both work properly.

Kind regards,

Gian
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Careful! There's a tiny trick to this!

The anchor tag allows the EL in quotes any which way, just as you could anywhere in template text. HOWEVER, this is not true for attributes of evaluated (standard and custom) tags!

For example, <c:out value='${param['test']}'/> or <c:out value="${param["test"]}"/> should give an error. When the tags get evaluated, the compiler has no clue which of the quotation marks is the start or end because they're all the same.

If your EL expression needs to use quotes inside an evaluated tag's attribute value, you need to make sure it uses the kind of quotes that you aren't using to wrap the attribute's value, like <c:out value='${param["test"]}'/> or <c:out value="${param['test']}"/> !!!

In the real world, I think you're more likely to see even the html tags used the same way as evaluated tags, with the inner quotes being different than the outer quotes (out of habit), but it's perfectly valid even if you don't.
[ January 10, 2008: Message edited by: Marc Peabody ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic