<welcome-file>index.jsp</welcome-file>
一般首页进的是静态页面
如果需要首页是动态的页面 就需要先进action访问数据 再回到首页显示
因为 welcome-file 必须是实际存在的文件,不能是action或者servlet路径
如果直接把index.jsp改成action 会出现404
<welcome-file>index.action</welcome-file>直接设置action,404和struts2中的解决方案
解决方法有三种 我最经常用第一种
第一种
因为web.xml中 默认是
<welcome-file>index.jsp</welcome-file>在空白的index.jsp中使用META重定向。
content="1 是时间控制,表示1秒后自动跳转到要跳转的页面.
content="0 表示打开该页后立即跳转到你要跳转的页面.
url 是要跳转的路径
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/header.jsp"%>
</head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=query/gseList">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
</body>
</html>
转载于:[请输入链接描述][1]
[1]: http://blog.csdn.net/zzq900503/article/details/44460963#
一般首页进的是静态页面
如果需要首页是动态的页面 就需要先进action访问数据 再回到首页显示
因为 welcome-file 必须是实际存在的文件,不能是action或者servlet路径
如果直接把index.jsp改成action 会出现404
<welcome-file>index.action</welcome-file>直接设置action,404和struts2中的解决方案
解决方法有三种 我最经常用第一种
第一种
因为web.xml中 默认是
<welcome-file>index.jsp</welcome-file>在空白的index.jsp中使用META重定向。
content="1 是时间控制,表示1秒后自动跳转到要跳转的页面.
content="0 表示打开该页后立即跳转到你要跳转的页面.
url 是要跳转的路径
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/header.jsp"%>
</head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=query/gseList">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
</body>
</html>
转载于:[请输入链接描述][1]
[1]: http://blog.csdn.net/zzq900503/article/details/44460963#