< s: set name="startIndex" value="%{#parameters['start'][0]}"/ >
< s: property value="@java.lang.Integer@parseInt(#startIndex)+4"/ >
Here the first statement grab the query string value using parameter object and assign it as a string, the '%{}'
syntax is used for this purpose.
The second statement convert the string to int and add the two integers.
IMPORTANT: for the parseInt to work you should enable the constant in struts.xml
< constant name="struts.ognl.allowStaticMethodAccess" value="true" / >
4 Comments:
dont use #
Thanks a ton for this trick. I was struggling with this. I tried several ways to convert string to integer but none had worked. Thnx.!!
- Jugz!
Thanks, You save the whole world. By the way, where did you learn this, I read some books, they never and ever tell me.
You are just genious I wasted 24 hours in this small issue
thanks a lot
Post a Comment