I followed this post and created a custom URL application. The action is getting called but the url shows with session id like
http://localhost:8080/CustomURL
First of all you should get rid of action extension, if you don't want user to think their name has an extension.
<constant name="struts.action.extension" value=",,action"/>
Next the pattern matcher should be regex.
<constant name="struts.patternMatcher" value="regex"/>
Action mapping
<action name="/CustomURL/{username}" class="com.rajesh.struts2.CustomURL" method="customUrl">
<result name="success">welcome.jsp</result>
</action>
In the JSP you don't need to use form tag, but anchor tag. And use known names.
<a href="http://localhost:8080/CustomURL/rajesh">Click my name</a>
Try $ before {username}. $ Stands for Freemarker
<action name="{username}" class="com.rajesh.struts2.CustomURL"
method="customUrl">
Freemarker Tutorial
How to use OGNL Expression Example link
<s:property value="username"/> for calling username on welcome page.
It may help you to get your answer.
try it..
public String customUrl() {
HttpServletRequest request=(HttpServletRequest) ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
String url="http://"+request.getServerName()+":"+request.getServerPort()+""+request.getContextPath()+"/"+request.getParameter("username");
logger.info(" Current url : "+url); //check it here
return SUCCESS;
}