tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <>
Subject Re: URL Rewrite
Date Fri, 03 Sep 2010 10:29:47 GMT
On 03/09/2010 11:02, michel wrote:
> I have been using the tuckey urlrewrite with some results, in that if I want to have
an incoming URL coming in as
> gallery/pic20 gets changed to gallery.jsp?pic=20
> But the tool bar URL gets displayed as   gallery.jsp?pic=20
> and I want to display  gallery/pic20 
> I tried the '<outbound-rule>', but that didn't have any effect. I also did some
reading, and there was some talk about internal and external rewrite, but I have no real clue
on how and what to do with that either.

I usually solve this problem by writing a Servlet Filter to parse the
URL and supply the id via a request attribute, to the JSP.

 String pathToJsp = "WEB-INF/jsp/item_page.jsp";
 String id = parseId(request.getRequestURL());

 request.setAttribute("id", id);
 request.getRequestDispatcher(pathToJsp).forward(request, response);

Map the url-pattern for the Filter to /gallery/* and you're set.


View raw message