Hi,

I'd like to forward to a page under a dispatcher, I'd like to do following:

http://mydomain.com/12345
will forward to:
http://mydomain.com/search

I tried following code, but always:

HTTP error 404, The requested resource (/search) is not available.
if i do a response.sendRedirect(url), it works, but the url in the browser
got changed too which is something i don't want, any idea? thanks.

Angelo


public boolean dispatch(Request request, Response response) throws
IOException {
     
        String[] paths = request.getPath().toLowerCase().split("/");
        if ((paths.length == 2) && (paths[1].equals("123456"))) {
        String url = request.getContextPath() + "/search";
        RequestDispatcher rd =
globals.getServletContext().getRequestDispatcher(url);
        try {
              rd.forward(rg.getHTTPServletRequest(),
rg.getHTTPServletResponse());
                        } catch (ServletException e) {
              e.printStackTrace(); 
        }
        return true;
        }


-- 
View this message in context: 
http://www.nabble.com/t5%3A-servlet-forward-in-a-dispatcher-tp19001571p19001571.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to