struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musachy Barroso" <musa...@gmail.com>
Subject Re: [S2] non intuitive OGNL value evaluation?
Date Wed, 27 Aug 2008 15:31:43 GMT
Parameters are an array, so "parameters.eventoId" is an String
array(hence "[Ljava.lang.String;@144c5bb"), to get the actual value
you need to always do "parameters.eventoId[0]". Are you sure that it
print "9" for the first one?

musachy

On Wed, Aug 27, 2008 at 11:15 AM, Gabriel Belingueres
<belingueres@gmail.com> wrote:
> Hi,
>
> Please see this lines:
>
> <s:property value='#parameters.eventoId'/><br/>
> <s:property value='%{"hello" + #parameters.eventoId}'/><br/>
> <s:property value='%{"hello" + #parameters.eventoId[0]}'/>
>
> Let's say that parameter eventoId == 9, it outputs:
>
> 9
> hello[Ljava.lang.String;@144c5bb
> hello9
>
> The funny thing is that #parameters.eventoId' is evaluated to String
> when it's alone (what I expected to be), but it is evaluated to an
> String array when concatenated like in "hello" + #parameters.eventoId.
> As expected, taking the first array element ([0]) solves the problem.
>
> But the question is if this is OK to be this way, am I building the
> OGNL expression wrongly, or is it some bug in the OGNL evaluation
> code?
>
> Gabriel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Mime
View raw message