想让两个地址跳转的页面一样
问题:项目首页登录:如想让(A)10.118.66.20:8080/ABX/ 与(B)10.118.66.20:8080/ABX/index.do,链接跳转的页面一样
web.xml中配置如下:
<welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
(1)可在index.jsp页面中处理
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib uri="http://sf.com/taglib/sf-common" prefix="common"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/"; //加入下面语句 response.sendRedirect("index.do"); // 同时后台代码sessionFilter不拦截此index.do //而不能使用: response.sendRedirect("http://20.22.23:8080/XXX/index.do");//因为测试、生产地址不一样,配置固定的跳转地址可能会导致测试环境启动不了 %>
Author