• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can you specify the url seen in the browser after the servlet forwards to the JSP?

 
Matt Williard
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example, lets say the page I'm on is LogIn.jsp. After submitting the form info from LogIn.jsp, the ValidateUserServlet.java is called. After ValidateUserServlet performs it's function, it forwards to HomePage.jsp. Currently, the url in the browser looks like this -->

But I would prefer it looks like this -->



Is there a way to accomplish this? I've found articles on the Servlet Mapping within the web.xml file, but to me that seems to take care of routing various request urls patterns to the correct Servlet.

Thanks in advance . . . Matt
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mapping is the correct way to approach this. Why the reluctance?

Note that the PRG pattern is not only good practice, it allows you to separate task mappings from view mappings. Please see this article for more info.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that forwarding a request does not involve the client browser at all, as far as the browser is concerned, the URL displayed is still working.

If you want a change in the URL displayed by the browser, then a redirect is called for.

Bill

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!