Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I make a friendly URL like www.example.com/username ?  RSS feed

 
Huisan Wang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am new to JSF and this is my first JSF project.

I have written some friendly URL like "www.eample.com/customer/name" for this project, which is working great. But the URL like "www.example.com/username" just makes me headache.

For the "www.eample.com/customer/name" URL, what I need to do is writting a CustomerRedirectFilter class and add

<filter>
<filter-name>customer-redirect-filter</filter-name>
<filter-class>org.my.richfaces.CustomerRedirectFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>customer-redirect-filter</filter-name>
<url-pattern>/customer/*</url-pattern>
</filter-mapping>

into web.xml.

Now, I have written a UsernameRedirectFilter class, but do not know how to set the <url-pattern> in the web.xml.

Apparently, I can not set it as

<filter-mapping>
<filter-name>username-redirect-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

because /* includes all the other url-pattern i already have. So how should I figure out this problem?

Any helps will be appreciated.

Sam
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!