• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pass parameters from one servlet to another

 
visu Nekk
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need help in passing parameter values from one servlet to another in an out .println statement.
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:



Hope I am right.
[ October 04, 2005: Message edited by: rathi ji ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Three, actually...

There is no setParameter.
I believe you mean: setAttribute(String, Object)
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
D'oh
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic