struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Big Stick <stanl...@gmail.com>
Subject RE: OGNL
Date Thu, 26 Apr 2007 23:09:19 GMT
That's my point Dave! I think this doc needs to be updated.

...references to Action properties can omit the # marker...


-----Original Message-----
From: "Dave Newton" <newton.dave@yahoo.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: 4/26/07 5:24 PM
Subject: Re: OGNL

--- stanlick@gmail.com wrote:
> I encountered a situation today that seems to
> disprove the following documentation.  I have an 
> Action class with a property that my JSP can only
> access if I DO NOT include the #.  If I prepend the
> #, it is not found.
> 
> "The Action instance is always pushed onto the value
> stack. Because the Action is on the stack, and the 
> stack is the OGNL root, references to Action
> properties can omit the # marker. But, to access
> other objects in the ActionContext, we must use the
#
> notation so OGNL knows not to look in the root 
> object, but for some other object in the
> ActionContext.""\

If you include the "#" doesn't OGNL *not* look at the
root (your action), so it would try to find a non-root
object with the name you've given it?

I mean, if my action exposes

public String getStringBean() { ... }

and I use

<s:property value="%{#stringBean}"/>

it's going to look at *rest* of the stack for
something called "stringBean", not at my action, which
is on the root. If I use

<s:property value="#root.stringBean"/>

then it will display (or, obviously,
value="stringBean").

Maybe I'm misunderstanding what you're saying.

d.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message