I know you can use the <jsp:useBean> tag to instantiate objects within JSPs without resorting to scriptlet code. However I’d like to instantiate an Integer who value is the result of an EL expression, something like:
<jsp:useBean id='total' class='java.lang.Integer'> <jsp:setProperty name='amount' value='${param1 + param2}'/> </jsp:useBean>
Of course this won’t work because Integer objects don’t have a property named ‘amount’, the only way their value can be set is via a constructor parameter (i.e. Integer objects are immutable). Is there any way to instantiate such an object and set it’s value without using scriptlet code?
Thanks, Don
<c:set var='amount' value='${param1 + param2}' scope='page' />