struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: Question regarding OGNL
Date Fri, 14 Mar 2008 19:08:37 GMT
Thomas Ramapuram wrote:
> Hi, 
> I have query regarding OGNL Expression.   
> Can the "#name" kind of expression be used anywhere? Or are they 
> applicable only in certain attributes of struts tags 
> 
> Till now I was using the %{name} expression and that too in the some 
> attribute of a tag 
> 
> I tried using #name expression but it does not work.  Is there any 
> settings to be set (for example in web.xml) 
> Any pointers would be a great help. 
> Thanks 
> Thomas

The expressions %{name} and %{#name} have different meanings. Anywhere 
one is valid, the other is valid too but obviously each will only 'work' 
if the expression resolves to a value.

  - %{name} will look for a property named 'name' on your action (i.e. 
will result in a call to getName() on your action)

  - %{#name} will look for a property or attribute named 'name' anywhere 
in the value stack, including in the request/session/application scopes

AFAIK, %{#name} is equivalent to %{name} when there is a getName() on 
the action, i.e. OGNL will look at the action first then search the rest 
of the value stack.

L.


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


Mime
View raw message