Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with Invoking UserServlet after logging in successfully form LoginServet

 
Hitesh Patel Patel
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
Eclipse IDE Java MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic