Search code examples
jspurl

paraemeters in url structure


I've coded a website in Jsp/Struts. The application contains a profile for each user.

When a user wants to give his profile's link to others, he gives it like this : www.my-site.com/profile?id=10010101

Instead, i want to have the feature which twitter and facebook has.. like :www.my-site.com/myusername

Is this type of url for the user profile possible with struts / jsp ?


Solution

  • Not sure about the Struts part, but it's possible with just a servlet which is mapped on an url-pattern of / and extracts the myusername part by request.getPathInfo().substring(1). You could then let this servlet forward to /profile?id=xxxx which could then be intercepted by Struts.