I would use OCPsoft PrettyFaces or OCPsoft Rewrite for this:
With PrettyFaces :
create WEB-INF / pretty-config.xml
<url-mapping> <pattern value="/#{username}" /> <view-id value="/profile.jsp" /> </url-mapping>
This will automatically put the "username" URL value in the request parameter named "username"
With Rewrite :
Here is the same thing using Rewrite, which is a bit more explicit, but also more powerful.
ConfigurationBuilder.begin() .addRule(Join.path("/{username}").to("/profile.jsp") .where("username").bindsTo(Request.parameter("username")));
Hope this helps.
~ Lincoln
source share