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
Marshal
Joined: Mar 22, 2005
Posts: 35223
7
posted
0
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).
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...
Qussay NAJJAR
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35223
7
posted
0
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
Joined: Jan 18, 2008
Posts: 53
posted
0
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
Joined: Aug 29, 2006
Posts: 132
posted
0
i think we can also use Query String!
Perform for today. Adapt for tomorrow.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: how to send the request to another sevlet