aspose 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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue with Invoking UserServlet after logging in successfully form LoginServet