urlrewriter2.6在java中的应用 URL重写

http://xiaopihai.iteye.com/blog/384386  Java中urlrewriter的使用
urlrewriter:  url重写
下载: http://tuckey.org/urlrewrite/dist/urlrewritefilter-2.6.zip

在web.xml中初始化:
<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>
</filter-mapping>


methor 为get的访问地址:http://localhost:8081/ajax-struts1.2/login.do?name=5e&pass=er
从form提交的url重写:
<form action="login.do" method="post">
  <input name="name">
  <input type="password" name="pass">
  <input type="submit" value="提交"/>
</form>


method为post的访问地址:http://localhost:8081/ajax-struts1.2/login.do

<form action="login.html" method="post">
 <input name="name">
 <input type="password" name="pass">
 <input type="submit" value="提交"/>
</form>
对应:
<rule>
 <from>^/(\w+).html</from>
 <to type="forward">/$1.do</to>
</rule>

访问http://localhost:8081/ajax-struts1.2/login.html,会转向login.do


http://l530.spaces.live.com/PersonalSpace.aspx?_c11_BlogPart_n=1&_c11_BlogPart_handle=cns!9D9533B86846A992!

152&_c=BlogPart

你可能感兴趣的:(java,html,Ajax,xml,Web)