Top.Mail.Ru
May 1st, 2005 - Java developers — LiveJournal
? ?

Java developers

May 1st, 2005
 

12:02 pm - michaeldowling - Java in a Nutshell

When your 5th edition covering java 5 is 1225 pages long, I'm not sure you can call it a "nutshell" book anymore :).
 

02:31 pm - swmichele - Jakarta Tomcat + servlets - tiny problem with dispatcher and address line


I'm having a little web-application, using Jakarta Tomcat server, where JSP is for presentation mainly and servlets are used for business logic stuff. I have a servlet, which is mapped in web.xml file like this:

<servlet-mapping>
    <servlet-name>Admin</servlet-name>
    <url-pattern>/admin.jsp</url-pattern>
 </servlet-mapping>

After being called by it's url this servlet does some action and then passes control further, to another .jsp page, using dispatcher:
rd = getServletContext().getRequestDispatcher("/test_page.jsp");
rd.forward(req, res);
And it all works ok and test_page.jsp is being loaded, but what I'm not happy about is that the address line in a browser still has "admin.jsp" written there, not "test_page.jsp". So if I try to Refresh the page - it would start the servlet Admin again.

Could anyone tell me how to avoid this address thing? I don't want to use encodeURL() though (which doesn't have such problem), because the dispatcher works faster.
Powered by LiveJournal.com