You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2008/08/15 18:23:45 UTC
t5: servlet forward in a dispatcher
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org