[thelist] ugly url fix in JSP

Hassan Schroeder hassan at webtuitive.com
Wed Mar 23 11:44:03 CST 2005

Dan McCullough wrote:
> Looking for anyone who has seen articles on transforming ugly urls
> (category.jsp?catid=5&type=2) into category/catid/5/type/2 or
> something like that?

No, but it's pretty easy -- just map the URL pattern you want, in
this case category, in web.xml:



:: and then extract the pathInfo in your JSP page.

If you're using the 2.4 spec and JSTL 1.1, this will give you all
the pathInfo components broken out:

<c:set var="pathParams" 

catid value is ${pathParams[1]}
  type value is ${pathParams[3]}

Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.

More information about the thelist mailing list