Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sending data from one servlet to another

 
kanna kancharla
Greenhorn
Posts: 14
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to send data from one servlet to another servlet and jsp simultaniously?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64983
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That doesn't make much sense. What is it that you are actually trying to accomplish?
 
kanna kancharla
Greenhorn
Posts: 14
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually i'm building a web application for that. one servlet is used to for calculation purpose of submitted form data and result retrieval to another jsp file. now i want to store the submitted form data and result in oracle database
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64983
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then write methods to do these steps. Servlets should not be used in place of methods. Servlets can share these methods if need be, but do not think of servlets as units of execution that should be called to do anything other than respond to a request.
 
kanna kancharla
Greenhorn
Posts: 14
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK bear.
how can we transfer the submitted form data from a jsp to get calculations done and that data to be stored in a a database . this two events should occur simulatniously. i've written programming for submitting form data to get calculations to be done. now i want the input data as well as the output data to be stored in database
 
Paul Clapham
Sheriff
Posts: 21149
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So your JSP is generating HTML which includes this form, and after the user enters data into that form and clicks on the form's Submit button, you want something to process the submitted data? Then have the form submit to a servlet which does that processing.

If that processing includes doing some calculations and updating a database, then fine. Have the servlet do that, or call methods which do it, or whatever.
 
kanna kancharla
Greenhorn
Posts: 14
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:If that processing includes doing some calculations and updating a database, then fine.

you are correct it includes some calculations and updating a database. i am able to this things get done separately but i want them to be done simultaneously. is it possible to do them using single servlet,if so how?. and if not? how to do it. please explain it.
 
Paul Clapham
Sheriff
Posts: 21149
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simultaneously? Why? What's wrong with doing the calculations before updating the database, or vice versa?
 
kanna kancharla
Greenhorn
Posts: 14
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to do it? can you please post an example code
 
Paul Clapham
Sheriff
Posts: 21149
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, first of all we don't just give people code here. And anyway you haven't persuaded me that it's important to do those two things simultaneously rather than sequentially.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic