标签:
< 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>
|
<?xml version ="1.0" encoding= "UTF-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
"http://tuckey.org/res/dtds/urlrewrite3.2.dtd" >
<urlrewrite >
<rule >
<from >/userinf-(\w*).html </from >
<to type= "forward">/userinf.jsp?username=$1 </to >
</rule >
</urlrewrite >
|
<%@ page language ="java" import= "java.util.*" pageEncoding= "utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://" +request.getServerName()+":" +request.getServerPort()+path+"/";
String user = request.getParameter("username");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<html>
< head>
<base href= "<%= basePath%> ">
<title ><%= user %> 的个人信息</title >
</ head>
< body>
<%
out.println("现在时间是:" + new java.util.Date() +"</br>");
out.println("用户名:"+user);
%>
</ body>
</html>
|
java使用URLRewrite实现网页伪静态(servlet过滤器)
标签:
原文地址:http://www.cnblogs.com/yijian-insist/p/4402286.html