This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Basic EL question

 
Ramkumar Subburaj
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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

Thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic