tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
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
>=20
> gallery/pic20 gets changed to gallery.jsp?pic=3D20
>=20
> But the tool bar URL gets displayed as   gallery.jsp?pic=3D20
>=20
> and I want to display  gallery/pic20=20
>=20
> 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 rew=
rite, 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 =3D "WEB-INF/jsp/item_page.jsp";
 String id =3D 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.


p

Mime
View raw message