I use struts2 and want to use Math.max method in struts tag .
Like this :
<s:property value="%{Math.max( 1 , 5 ) }" />
Or :
<s:set var="pfrom" value="%{Math.max( 1 , page - 5 )}" />
but this codes not work .
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
See the docs for accessing static properties.
Nutshell:
%{@java.lang.Math@max(...)}You’ll need to configure allowing static access in your Struts config file:
I’d urge you to do work like that in the action, though, when possible. “Dumb” views are easier to test–the more logic in the controllers the easier things are all around.
The same logic could be exposed as an action method.