I don't think you are understanding what I am telling you... When you read a parameter directly, it will be a string. It's pretty much the same as calling -
request.getParameter("paramName"); (http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletRequest.html#getParameter(java.lang.String)) Since that returns a String, it will be treated like a String. Adding a getter to your action will pass it through the converters, etc. so that you can treat it like a number. My second suggestion is to do some OGNL scripting to convert it, but I would advise to add getter/setter to your action since a NumberFormatException can be raised (that could be silently swallowed). On 12/10/07, Alberto A. Flores <[EMAIL PROTECTED]> wrote: > 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] > -- Wesley Wannemacher President, Head Engineer/Consultant WanTii, Inc. http://www.wantii.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]