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 Servlet Redirection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Redirection" Watch "Servlet Redirection" New topic
Author

Servlet Redirection

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I am doing a servlet project right now. On the server-side, I am trying to design a dispatchServlet which will receive the request from the user and dispatch this request to different servlets depending on some conditions.All the reponses will be handled in the latter servlets.So HttpServletResponse.sendRedirect() is not a good choice since all contents of the request will lose. Is RequestDispatcher the only choice? ( RequestDispatcher.forword()?) Any of your suggestion will be very appreciated.
henley
Greenhorn

Joined: Jul 06, 2000
Posts: 16
My question to you is why do the "latter servlets" even have to be servlets? Why can't you make them regular Java Classes and have your dispatcher servlet create and call them directly? I have done this exact thing and in fact I am currently using it for internal web applications. The main advantage is that the developers of the "latter" classes don't need to know anything about servlets, but simply the interface with the dispatcher servlet. Also you don't have to worry about forwarding and redirecting.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Redirection
 
Similar Threads
problem passing request to servlet
request handler should be used in which situation?
Servlet Mapping
How to Acheive Auto Submit.?
stay with same page after submiting form