aspose file tools*
The moose likes Servlets and the fly likes passing methods from one servlet to another servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "passing methods from one servlet to another servlet" Watch "passing methods from one servlet to another servlet" New topic
Author

passing methods from one servlet to another servlet

Vishwanath C Kagawade
Greenhorn

Joined: Mar 03, 2003
Posts: 3
hi,

i am a new comer to the servlet programming so please help me any one, in method passing between two servlets.
Actualy i am traying to pass parameters from servlet1 to servlet2 and after adding some more information to the servet2,i want to send entire content back to servlet1 and i want display entire thing in servelet1.

thanks for every one for helping me,in advance!!!
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
You can send values across as request parameters / request attributes.


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I thought I had replied to the exact same post, but it's gone
The poster's name was different though....

Anyway, same as Lynette


[My Blog]
All roads lead to JavaRanch
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
I think you replied to a similar post in the JSP forum.
Vishwanath C Kagawade
Greenhorn

Joined: Mar 03, 2003
Posts: 3
thanks,Lynette Dawson for your replay!!!

i got your idea, but i am not able to implement that concept,can you able to replay me with sample code. so that i can impliment that get and set attribuet() methods in my coding.
Regard,
vishwanath
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Is this good enough?
http://www.rgagnon.com/javadetails/java-0401.html
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I think you replied to a similar post in the JSP forum

That was it My post isn't there though... Nevermind.
Vishwanath C Kagawade
Greenhorn

Joined: Mar 03, 2003
Posts: 3
hi, Satou kurinosuke

you are replayed to another user but problem is quite similer, but it is diffrent. according to your solution: i can only send data/parameters from servlet1 to servlet2.
my pbroblem is i have to send some information from servlet1( suppose that contain user name and user address) to servlet2(which will take user name and address from servlet1),and servlet2 will add more information say user phone number and it will send user name ,address and number to servlet1
where i can display user all details.

in simple i can drow my transaction as:servlet1-servlet2-servlet1
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Vishwanath,
I'm really sorry to have disturbed your thread.
Please refer to Lynette's posts.
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
The logic is still the same. To communicate between two servlets, use request parameters or request attributes.

Try google, you should find plenty of tutorials for the same. If you are still struck, come back and post your code here. We would be able to help you out.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Vishwanath C N
Welcome to JavaRanch!

We're pleased to have you here with us in the servlets forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here
[ August 10, 2006: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: passing methods from one servlet to another servlet