I am working on a project where I want to provide unique URL for each user. For example,
http://www.SocialNetwork.com/jhon , http://www.SocialNetwork.com/jas
If you want to use named patterns in wildcard mapping then you should configure following in the struts.xml
:
now assume com.example.actions.ViewProfileAction
bean has a property username
, and method execute
that returns a SUCCESS
result. Then you can map the action in the root namespace "/"
configured to your package.
/WEB-INF/jsp/profile.jsp
you can get the name in the JSP using OGNL
Also note that you should deploy to the root context to have
your.domain.com/username
mapped to your action.