wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts Basic EL question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Basic EL question" Watch "Struts Basic EL question" New topic
Author

Struts Basic EL question

Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
Hello,

I would like to know when to use #, % and %{#name} in struts 2 jsp page

Thanks


SCJP 1.5, SCWCD 1.4.
Hanging between Web Services and EJB
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Use "#" when you're accessing a *named* value stack variable, like #session, or any you've created[1]. use the completel OGNL escape sequence, "%{expr}", when you want to explicitly tell the framework to evaluate the contents, or to just make it clear that you're using OGNL (this is the recommended practice--use it for *every* OGNL expression, even if you don't have to).

[1] This isn't always true as of Struts 2.1.mumble; *sometimes* it's optional. It's always been unclear to me when it's optional, or how to find out when it's optional. That's something I plan to work on.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Basic EL question