首页 > 数据库 > 通过服务器的404文件没有找到的错误处理,实现url rewrite的功能

通过服务器的404文件没有找到的错误处理,实现url rewrite的功能

2008年12月28日 发表评论 阅读评论

404的错误处理页面来实现这个功能
页面代码如下

<%@ page language="java" contentType="text/html; charset=GBK" isErrorPage="true" pageEncoding="GBK"%>
<% response.setStatus(HttpServletResponse.SC_OK); String key = (String) request.getAttribute("javax.servlet.forward.servlet_path"); if (key != null) { int index = key.lastIndexOf("/"); if (index != -1) { key = key.substring(index + 1); if (key.startsWith("f") || key.startsWith("p")) { try { long id = Long.parseLong(key.substring(1)); String url = key.startsWith("f") ? "forumdisplay.jsp?fid=" : "viewthread.jsp?tid="; %>
“>

分类: 数据库 标签: 2,578 次阅读
原文链接:http://www.wenhq.com/article/view_230.html
欢迎转载,请注明出处:亲亲宝宝
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.