Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Anybody can tell me how to use "%" and "#" sign in STRUTS2 OGNL? I google around, but can't find any valuable info about this.Or give me a link of documentation of this.

thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
305 views
Welcome To Ask or Share your Answers For Others

1 Answer

The % character forces OGNL evaluation, so <s:property name="%{foo}"/> will query the stack for a foo property. It's not always required (rarely, in fact), but it's easier to use it consistently for clarity.

The # character accesses a named value stack context variable, for example, you used to need it to access a variable created using the <s:set> tag. You need it to access things like a session variable, like <s:property name="#session.user.name"/>.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...