Reputation: 15653
If we have a person-directory application, where we can check the details of a specific person (for example, person with id 239) at
http://person-directory.com/detail.jsp?id=239
how can we create vanity urls in it? i.e. instead of typing the above url, we use
http://person-directory.com/julius
to open the detail page of person with id 239 and username julius.
Thanks
Umar
Upvotes: 2
Views: 1381
Reputation: 12202
You could also try to use the url-rewrite filter: http://tuckey.org/urlrewrite/. Of course, you have to change your code to query by username instead of id.
Upvotes: 2
Reputation: 272357
I suspect you'll have to
Note that a better URL may be http://person-directory/username/julius. Then you could map your UserServlet to http://person-directory/username and provide other servlets on other URLs.
Upvotes: 6