jsp中的url重写
我的web.xml如下配置<?xmlversion="1.0"encoding="gb2312"?><web-appxmlns="http://java...
我的web.xml如下配置<?xml version="1.0" encoding="gb2312"?><web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <filter> <filter-name>UrlRewriteFilter</filter-name> <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</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><servlet> <servlet-name>CountBean</servlet-name> <servlet-class>bfgt.CountBean</servlet-class> </servlet> <servlet-mapping> <servlet-name>CountBean</servlet-name> <url-pattern>/test1.0</url-pattern> </servlet-mapping></web-app>我的urlrewrite.xml如下配置<?xml version="1.0" encoding="gb2312"?><!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 2.6//EN" "http://tuckey.org/res/dtds/urlrewrite2.6.dtd"><urlrewrite> <rule> <from>/article/(\d+).htm$</from> <to type="forward">/article.jsp?id=$1</to> </rule></urlrewrite>我也把jar文件放到lib里了 但是我打开http://localhost:/test1.0/article.jsp?id=9时却没有重写url是怎么回事?请指点
展开
展开全部
是不是正则表达式的问题啊,加的包是urlrewrite的包吗
<from>/article/(\d+).htm$</from>
<to type="forward">/article.jsp?id=$1</to>
这个跟你要重写的url不匹配,你应该在浏览器打开http://localhost:/test1.0/article/123
这样重写后就变成http://localhost:/test1.0/article.jsp?id=123
<from>/article/(\d+).htm$</from>
<to type="forward">/article.jsp?id=$1</to>
这个跟你要重写的url不匹配,你应该在浏览器打开http://localhost:/test1.0/article/123
这样重写后就变成http://localhost:/test1.0/article.jsp?id=123
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询