struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabriel Belingueres" <belingue...@gmail.com>
Subject Re: Struts 2.0.11 from 2.0.9 EL Expression problem
Date Tue, 26 Aug 2008 14:52:13 GMT
Wow what was I drinking last night? :-P

I extracted some examples from when I had to convert one app from
2.0.9 to 2.0.11:

1) If the variable is in request scope:
From: onclick="this.form.action = '${urlsubmit}';"/>
To: onclick="this.form.action = '%{#request['urlsubmit']}'" />
(or use #attr instead of #request if you want)
(or use #parameters to replace the JSTL's param)

2) More complicated expression:
From: disabled="${empty SetAfiliaciones || criterio.idcampania == 0}"
To: disabled="%{#session['SetAfiliaciones'] == null ||
#session['SetAfiliaciones'].isEmpty() ||
#request['criterio'].idcampania == 0}"

3) You may want to convert from OGNL to JSTL too (because changing the
tag prefix is easier than changing the expression):
From: <s:if test="${empty x || !empty y && ...}">
To: <c:if test="${empty x || !empty y && ...}">

4) Some times you can avoid the conversion altogether:
From: <s:param name="x" value="%{'${someX}'}" />
To: <s:param name="x">${someX}</s:param>

Regarding your actual requirement of writing a "dynamic" select tag, I
see no difference at all with the previous version. Instead of
<s:select name="${param.fieldName}"
write:
<s:select name='%{#parameters["fieldName"]}'
and so on

2008/8/26, Dave Newton <newton.dave@yahoo.com>:
> --- On Mon, 8/25/08, crappycrumpet wrote:
> > Hence I was wondering how I can work around it.
>
> Modify the TLD.
>
> Dave
>
>
> ---------------------------------------------------------------------
> 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