Struts2 best urls with dot inside

Say we need to get a registration form with a predefined username.

So, if the user goes to the URL:

//somehost:8080/myapp/auth/myusername

as an input parameter, the action should take myusername.

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

But if it myusernamecontains points, for example:

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

I get a 404 error.

Is there any simple solution for using dots as part of the url parameter?

+4
source share
1 answer

In struts.xml :

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

web.xml:

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

,

+3

Source: https://habr.com/ru/post/1529198/


All Articles