please, help me...how to do url rewriting in java?.....i m new for java...

i m try url rewriting in java but it's not work....so please any one help me...

i m try this in my project....

first i am add urlrewrite-3.2.0.jar in my library...then

change in the web.xml file like belowe..

web.xml

<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewrite Filter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</filter>
then

and add new .xml file in the WEB-INF Folder name like urlrewriter.xml

<urlrewrite>
<rule match-type="regex">
<note>
The rule means that requests to /test/status/ will be redirected to /rewrite-status
the url will be rewritten.
</note>

<!-- <from>/trainer/trainerhome.xhtml?id=$1</from>
<to type="redirect">^/trainer/([a-z0-9]+)/$</to>-->

<from>/faces/trainer/trainerhome.xhtml?id=himanshuj</from>
<to type="permanent-redirect" last="false" >%{context-path}/faces/trainer/trainerhome.xhtml/himanshuj</to>
</rule>
<outbound-rule match-type="regex">
<note>
The outbound-rule specifies that when response.encodeURL is called (if you are using JSTL c:url)
the url /rewrite-status will be rewritten to /test/status/.

The above rule and this outbound-rule means that end users should never see the
url /rewrite-status only /test/status/ both in thier location bar and in hyperlinks
in your pages.
</note>
<!-- <from>/rewrite-status\id=</from>
<to>/trainer/trainerproduct/</to> -->
<from>/trainerhome.xhtml</from>
<to>/trainerhome/trainerhome.xhtml</to>
</outbound-rule>
</urlrewrite>

So i try this but it is not work....so Please Any one can try to give answer....