You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Petzsch, Martin" <ma...@capgemini.com> on 2007/06/28 10:26:46 UTC

Struts2
Hi,

 

I have the following:

 

<s:url action="%{leftMenuLinks[#stat.index].action}"
method="%{leftMenuLinks[#stat.index].actionMethod}"/>

 

This is rendered on the page as:

/ContactPointWeb/Home!%{leftMenuLinks[#stat.index].actionMethod}

 

Which is fine - except; why is the OGNL in the method attribute not
processed?  If I move the expression in method into action it works fine but
if I move the action expression into method it doesn't process that either;
so I know the expressions are correct.

 

They are inside an iterator which iterates over a collection of my custom
link class which does have the above used properties.

 

Am I missing something to make the method attribute process my ognl?

 

Many thanks,

Martin



Capgemini is a trading name used by the Capgemini Group of companies which includes Capgemini UK plc, a company registered in England and Wales (number 943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 6DB. 



This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.

RE: Struts2 Posted by "Petzsch, Martin" <ma...@capgemini.com>.
I filed this bug: https://issues.apache.org/struts/browse/WW-2015 

I think this is a valid feature but agree it should be forced evaluation as
I have in my example.  Definitely think it needs to be fixed though.

Kind regards,
Martin


-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: 28 June 2007 12:54
To: Struts Users Mailing List
Subject: Re: Struts2 <s:url method with OGNL

--- "Petzsch, Martin" wrote:
> Which is fine - except; why is the OGNL in the
> method attribute not processed?

I don't believe that every attribute is expecting an
OGNL expression.

The problem is that the tag reference claims "method"
is evaluated, but the source doesn't appear (on
cursory examination) to evaluate it.

I think the issue would be that if 'method' was always
evaluated then if you were just passing in a string
you'd need to quote it:

<s:url ... mathod="'list'" .../> which is unwieldy.

This would be a field where I'd want to see "forced
evaluation", i.e., require the use of the OGNL escape
chars if it was meant to be an expression, otherwise
it would be a simple string:

<s:url ... method="%{myExpr}" .../> (force eval)
<s:url ... method="myMethod" .../> (simple string)

I'd file a JIRA; don't know what the outcome would be.
At minimum a documentation change, at most the
creation of a set of "optionally evaluated"
attributes.

d.



       
____________________________________________________________________________
________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car
Finder tool.
http://autos.yahoo.com/carfinder/

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



Capgemini is a trading name used by the Capgemini Group of companies which includes Capgemini UK plc, a company registered in England and Wales (number 943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 6DB. 


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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


Re: Struts2 Posted by Dave Newton <ne...@yahoo.com>.
--- "Petzsch, Martin" wrote:
> Which is fine - except; why is the OGNL in the
> method attribute not processed?

I don't believe that every attribute is expecting an
OGNL expression.

The problem is that the tag reference claims "method"
is evaluated, but the source doesn't appear (on
cursory examination) to evaluate it.

I think the issue would be that if 'method' was always
evaluated then if you were just passing in a string
you'd need to quote it:

<s:url ... mathod="'list'" .../> which is unwieldy.

This would be a field where I'd want to see "forced
evaluation", i.e., require the use of the OGNL escape
chars if it was meant to be an expression, otherwise
it would be a simple string:

<s:url ... method="%{myExpr}" .../> (force eval)
<s:url ... method="myMethod" .../> (simple string)

I'd file a JIRA; don't know what the outcome would be.
At minimum a documentation change, at most the
creation of a set of "optionally evaluated"
attributes.

d.



       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/

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