Hi frnds, I am developing a struts2 project, I do require how to multiply to variable using struts tag ...
I tried with this code below,

<s:set var="total" value="var1" />
<s:set var="tot" value="%{var2 * #attr.total}"></s:set>
<s:property value="%{'' + #attr.total}"/>

AM getting the output as 0.0 .. Please any help ...

Member Avatar for LastMitch

Hi frnds, I am developing a struts2 project, I do require how to multiply to variable using struts tag ...

There should be more code than this (calucation wise):

From this

<s:set var="total" value="var1" />
<s:set var="tot" value="%{var2 * #attr.total}"></s:set>
<s:property value="%{'' + #attr.total}"/>

to this:

<s:param name="total" value="var1" />
<s:param name="tot" value="%{var2 * #attr.total}"></s:set>
<s:property value="%{'var1' + #attr.total}"/>

Was there an error when you ran the code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.