Question

Let's say we need to get a login form with pre-defined username.

So if user goes to url:

//somehost:8080/myapp/auth/myusername

the action should take myusername as input parameter.

I tried http://www.struts2.info/blog/better-urls-with-struts2 as example, and it works great.

But if myusername contains dots, like:

//somehost:8080/myapp/auth/firstname.lastname 

, I get 404 error.

Is there any simple solution to use dots as a part of url parameter ?

Was it helpful?

Solution

In struts.xml:

<constant name="struts.action.extension" value=""  />

and in web.xml:

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Untested, but it should work

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top