aspose file tools*
The moose likes Servlets and the fly likes RequestDispatcher repeating /servletname problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher repeating /servletname problem" Watch "RequestDispatcher repeating /servletname problem" New topic
Author

RequestDispatcher repeating /servletname problem

tom walters
Ranch Hand

Joined: Feb 14, 2002
Posts: 34
I deployed my servlet under /servletname. the forms in the jsp pages have their action to be "servletname/tag". when page A submits a form and control is returned back to page A using:
RequestDispatcher dis = req.getRequestDispatcher("/pageA.jsp");
dis.forward(req, resp);
the page is displayed but the url in the browser appears as:
'/servletname/servletname/tag'
submit the page again a third time and you get:
'/servletname/servletname/servletname/tag'.
This goes on and on with the /servletname appearing in the url as many times as you submit the form.
what is going on? how do i solve this problem so that the url is:
'/servletname/tag'?
[ April 11, 2002: Message edited by: tom walters ]
[ April 11, 2002: Message edited by: tom walters ]
tom walters
Ranch Hand

Joined: Feb 14, 2002
Posts: 34
solved it. the action in the forms was 'servletname/tag' instead of '/servletname/tag'. when i changed the form action to '/servletname/tag' the problem went away.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RequestDispatcher repeating /servletname problem
 
Similar Threads
Does anyone know the forum for C#?
Java Native Compiler for WinCE
Applet servlet communication using HTTP URLConnection
css for an iframe
Problem with getRequestDispatcher