Sivadinesh
Sivadinesh

Reputation: 157

how to form a clean url in jsp and submit to a servlet

http://foo.com/webapp/abcServlet?id=123 Need this url to be sent like below. http://foo.com/webapp/abcServlet/id/123

I can achieve passing parameters through post methods but i want a clean url. How to do this in jsp/tomcat. Servlet 3

Upvotes: 0

Views: 707

Answers (1)

tshenolo
tshenolo

Reputation: 463

This looks promising: http://tuckey.org/urlrewrite/manual/3.0/guide.html

From the documentation:

Clean a URL

<rule>
    <from>^/products/([0-9]+)$</from>
    <to>/products/index.jsp?product_id=$1</to>
</rule>

e.g. /products/1234 will be passed on to /products/index.jsp?product_id=1234 without the user noticing.

Upvotes: 2

Related Questions