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 Issue with Invoking UserServlet after logging in successfully form LoginServet 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 "Issue with Invoking UserServlet after logging in successfully form LoginServet" Watch "Issue with Invoking UserServlet after logging in successfully form LoginServet" New topic
Author

Issue with Invoking UserServlet after logging in successfully form LoginServet

Hitesh Patel Patel
Greenhorn

Joined: Jul 23, 2009
Posts: 27
Hi there,

This is the objective: "How to invoke another servlet's GET method from current servlet?"

Scenario
When login.jsp is submitted it calls the LoginServet servlet (form action). If login is OK then I need to redirect to user list page.

And user list page needs to have data-grid populated so instead of redirecting on userlist.jsp I call the UserServlet?action=list from LoginServlet.
But rather it calls the UserServet's POST method instead of GET method.

LoginServlet


And UserServlet's POST method has logic of add/modify user so every time I login it just creates new record in the user table with entered username/password.

UserServlet



So can I get some help how to call GET method of UserServlet?

Looking forward to getting answers.

Thanks,
Hitesh
Ankit Dan
Ranch Hand

Joined: Aug 31, 2012
Posts: 47

Which method is called depends solely on the request type that is stored in the HttpRequest instance. It works the same for all containers. Unless you specifically modify the request instances, all subsequent servlets will be called with the same method. So GET requests will never invoke doPost() unless you tamper with the request type..

Hope this helps

Ankit
 
wood burning stoves
 
subject: Issue with Invoking UserServlet after logging in successfully form LoginServet
 
Similar Threads
Help-populate object before form is loaded but before it's submitted
IllegalStateException error come on servlet side
Unable to update database
Threads in servlet
Servlet to servlet