how to perform calculation

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2004
Posts: 259
Reputation: sam1 is an unknown quantity at this point 
Solved Threads: 1
sam1's Avatar
sam1 sam1 is offline Offline
Posting Whiz in Training

how to perform calculation

 
0
  #1
Jan 7th, 2006
hi

in jsp how do i add two numbers that has been inputed by user which is in a text box...


thank you
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: how to perform calculation

 
0
  #2
Jan 8th, 2006
convert them both to a numerical data type and then add them together.
Very easy.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 259
Reputation: sam1 is an unknown quantity at this point 
Solved Threads: 1
sam1's Avatar
sam1 sam1 is offline Offline
Posting Whiz in Training

Re: how to perform calculation

 
0
  #3
Jan 8th, 2006
Originally Posted by jwenting
convert them both to a numerical data type and then add them together.
Very easy.
hi if i do it the way you said and add another text box for result. if a user enters two numbers would it show the result instantly.

thank you
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 259
Reputation: sam1 is an unknown quantity at this point 
Solved Threads: 1
sam1's Avatar
sam1 sam1 is offline Offline
Posting Whiz in Training

Re: how to perform calculation

 
0
  #4
Jan 8th, 2006
hi

i mean i knw how to calculate and convert to int. But if put the total in a variable. then how would i retrive it in servlet and save it in the database?

thanks
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: how to perform calculation

 
0
  #5
Jan 8th, 2006
you'd have to send it to the servlet, the servlet isn't going to know it's there to be saved unless someone tells it so.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 259
Reputation: sam1 is an unknown quantity at this point 
Solved Threads: 1
sam1's Avatar
sam1 sam1 is offline Offline
Posting Whiz in Training

Re: how to perform calculation

 
0
  #6
Jan 8th, 2006
Originally Posted by jwenting
you'd have to send it to the servlet, the servlet isn't going to know it's there to be saved unless someone tells it so.
how would i send it to servlet is it the action attribute.... or something else? because the variable total wouldnt be shown to users..
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: how to perform calculation

 
0
  #7
Jan 8th, 2006
As a request attribute, or a session attribute, doesn't really matter.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC