File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes sending data from one servlet to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "sending data from one servlet to another" Watch "sending data from one servlet to another" New topic
Author

sending data from one servlet to another

kanna kancharla
Greenhorn

Joined: Aug 23, 2012
Posts: 14

how to send data from one servlet to another servlet and jsp simultaniously?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

That doesn't make much sense. What is it that you are actually trying to accomplish?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
kanna kancharla
Greenhorn

Joined: Aug 23, 2012
Posts: 14

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

Joined: Jan 10, 2002
Posts: 60774
    
  65

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

Joined: Aug 23, 2012
Posts: 14

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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Aug 23, 2012
Posts: 14

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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Simultaneously? Why? What's wrong with doing the calculations before updating the database, or vice versa?
kanna kancharla
Greenhorn

Joined: Aug 23, 2012
Posts: 14

how to do it? can you please post an example code
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: sending data from one servlet to another
 
Similar Threads
Servlet Calling Public Methods of Another Servlet
Application level communication
Passing session data between Servlets residing in different machines
Servlets Vs Java Bean
Servlet Context