1
When accessing a user’s profile, I pass their user name as a parameter.
www.site.com.br/busca?usuario=nomedousuario
I would like to access as follows
www.site.com.br/nomedousuario
Someone has the tunnel’s end light to help me?
1
When accessing a user’s profile, I pass their user name as a parameter.
www.site.com.br/busca?usuario=nomedousuario
I would like to access as follows
www.site.com.br/nomedousuario
Someone has the tunnel’s end light to help me?
0
You can use a Servlet filter (http://tuckey.org/urlrewrite/), which will take the http request, interpret and convert to a new url. The installation is simple, just add the urlrewritefilter-4.0.3.jar file in WEB-INF/lib. In web.xml you add the following:
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
I suggest you read their documentation as well.
Browser other questions tagged java servlet
You are not signed in. Login or sign up in order to post.
Welcome to the @Jonathan community, it would be interesting to make a compilation of the article and put it here, because if the link goes off the air will no longer have the solution here.
– Marco Giovanni
Thanks marco, I’ll do it
– user54380
And the configuration file,
urlrewrite.xml
, Don’t need it? What will the URL rewrite pattern look like with only the filter?– Bruno César