You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Henrik Chua <ch...@columbusgroup.com> on 2001/12/01 02:08:59 UTC

doing arithmitic ops

Hi!

I have a simple question.  Will I be able to produce a mathematically
calculated value based on the input given without another variable?
here's the scenario.
JSP page 1, I have an input textfield (num) and a submit button
on my form bean, I have a variable called num.
on my action form, it just forward to the JSP page 2  
on JSP page 2, I want to display in HTML format the value of num multiplied
by 3.

will i be forced to create another variable in the form bean , say total,
that will do the computation and store in that variable and display the
variable total on page 2.

should it be done that way?  or I can simply do the multiplication without
an additional variable?

thanx in advance.
henrik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: doing arithmitic ops

Posted by Antony <u8...@mis.nccu.edu.tw>.
----- Original Message -----
From: "Henrik Chua" <ch...@columbusgroup.com>
To: "Struts Users Mailing List (E-mail)" <st...@jakarta.apache.org>
Sent: Saturday, December 01, 2001 9:08 AM
Subject: doing arithmitic ops


> Hi!
>
> I have a simple question.  Will I be able to produce a mathematically
> calculated value based on the input given without another variable?
> here's the scenario.
> JSP page 1, I have an input textfield (num) and a submit button
> on my form bean, I have a variable called num.
> on my action form, it just forward to the JSP page 2
> on JSP page 2, I want to display in HTML format the value of num
multiplied
> by 3.

The simplest way is:

formBean.setNum(formBean.getNum()*3);

then use <bean:write name="formBean" property="num"/>

Regards,
Antony


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>