Thanks Wes,

No offense to this approach, but is this the only way to do additions (and for this matter, any other operations) within a struts2 tag?. This is simply not clean (e.g. adding a property to my action for a counter, etc).

Thanks anyway!

Alberto

Wes Wannemacher wrote:
#request.foo is going to evaluate as a j.l.String. If your action has
a getter for foo, then just refer to it as "%{foo + 1}", conversely,
if you are feeling confident, you can make a static call to parse it -
"[EMAIL PROTECTED]@parseInt(#request.foo) +1}"

-Wes

On 12/10/07, Alberto A. Flores <[EMAIL PROTECTED]> wrote:
I'm currently migrating an app from Struts 1.x to 2.x and encounter this
situation where I was calculating the tabIndex of a JSP on the fly
(reusable JSP). In struts 1.x this was done using

<c:set var="tabIndexCount" value="<%= request.getParameter("foo") %>"/>
...
<html-el:text tabIndex="${tabIndexCount + 1}" ... />


According to the Struts2 documentation, non-string attributes are
evaluated as expressions, so the following:

<s:textInput tabIndex=""%{#request.foo + 1}/>

should do the work, but instead the above code is *appending* a 1
(string concatenation). Am I missing something or this is a bug? Any ideas!


--

Alberto A. Flores
http://www.linkedin.com/in/aflores



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--

Alberto A. Flores
http://www.linkedin.com/in/aflores


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to