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 pass parameters from one servlet to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "pass parameters from one servlet to another" Watch "pass parameters from one servlet to another" New topic
Author

pass parameters from one servlet to another

visu Nekk
Ranch Hand

Joined: Sep 06, 2005
Posts: 122
I need help in passing parameter values from one servlet to another in an out .println statement.
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
Assuming out is the response writer here, out.println() will print the argument, to the response.

If you can be clear with your question, this forum can be of greater help. Do you want to communicate between two servlets?


keep smilin :: sravan<br /><a href="http://sravanpens.blogspot.com" target="_blank" rel="nofollow">I scribble here</a>
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Try this:



Hope I am right.
[ October 04, 2005: Message edited by: rathi ji ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Nope, two problems:
1) you need to get the requestDispatcher from the context: getContext().getRequestDispatcher()
2) You need to use a named RequestDispatcher for servlets, since you dispatch to a virtual (mapped) name and not a resource on the file system. I'll leave this as an exercise
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Three, actually...

There is no setParameter.
I believe you mean: setAttribute(String, Object)


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

D'oh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: pass parameters from one servlet to another