wood burning stoves 2.0*
The moose likes Servlets and the fly likes Forwarding users from one JSP to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Forwarding users from one JSP to another" Watch "Forwarding users from one JSP to another" New topic
Author

Forwarding users from one JSP to another

Awet Haddis
Greenhorn

Joined: Jan 25, 2011
Posts: 11
Background:

I am developing a webapp that will allow users to upload data to a postgris database among other things. I have designed the web pages and I have the functionality
of the upload page completed. At this stage I want the user to first land on the home page, then if they click a link they will be forwarded to the upload page, ,then to the summary report page.

AHPDController is going to be my main controller. This is my algorithm:



Questions:

1. Should AHPDController be an abstract class, or a servlet, or both?

2. How should I communicate to my servlet that I am "trying to go to upload.do" as in the if statement

3. Is there a better/elegant method of doing this?

Thank-you guys/gals.

sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

Awet Haddis wrote:Background:
Questions:

1. Should AHPDController be an abstract class, or a servlet, or both?

2. How should I communicate to my servlet that I am "trying to go to upload.do" as in the if statement

3. Is there a better/elegant method of doing this?

Thank-you guys/gals.



1. If you are developing a plain servlet based without any MVC framework, your controller would be a servlet
2. You do not instantiate servlets with new operator like new UploadDataController()
3. You can create a servlet that will display upload form (doGet), and handle upload(doPost) and map it to upload.do in web.xml
4. For how to forward request to another jsp or servlet see this forward example


[Servlet tutorial] [Servlet 3.0 Cook Book]
 
jQuery in Action, 2nd edition
 
subject: Forwarding users from one JSP to another