Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Serving the incoming request via URL and via JSP page  RSS feed

 
trupti nigam
Ranch Hand
Posts: 640
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a small webapp which used to take a URL and get the request params from the URL and process the request.
Now I need to add the login page and also serve the URL like above.

Earlier I just had doGet method which used to handle the incoming request via URL.
But with login page I am trying to handle the request that comes via login.jsp in an action. So my doGet has a call handleRequest() that handles the incoming request based on "action". I pass the action via the JSP page.
But with handleRequest() method, if I try to send the request via URL, the request params are all null and they come in as request path.
Is there a way that I can handle the incoming request through JSP in an action and can also handle the request coming in via URL?

So basically I want to support both methods of accepting the user input.
1. Encode the parameters directly into the URL of a link on a page.
2. Query the user for input with an HTML form.

Is it possible to achieve both using same servlet that serves both?

thanks
Trupti
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65891
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Back up a bit.

If you are trying to add authentication to your web app, you do not do it by hard-coding the logic into the servlets or JSP.

See servlet authentication for info on how to properly add authentication to a Java web app.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!