File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to send the request to another sevlet

 
sudhakar papireddy
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i have two sevlets. The request always comes to first servlet with one parameter. I would like to send the request to another servlet depends on the parameter value.

can some one help on this. how we can send the request from one sevlet to another?

Thanks
Sudhakar
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could either do a client-side response.sendRedirect or a server-side RequestDispatcher.forward (or include). The latter will preserve request information and attributes (which are lost when doing the former).
 
Qussay Najjar
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's say that you have a JSP page that sends a String conatins the name of the servlet to go to.
Your first serlvet receives this request, and it can have this code to decide the next servlet to go:


Hope it helped...
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It really goes without saying, but silently ignoring exceptions is of course something you should almost never do, and definitely not here.
[ January 19, 2008: Message edited by: Ulf Dittmer ]
 
Qussay Najjar
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're completely right Sir, for sure i didn't catch the exception for nothing, but i was just showing an example.. really thanks for the note..
 
Rahul Shilpakar
Ranch Hand
Posts: 132
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think we can also use Query String!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic