这个是web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>CityInfo07</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="cityinfo.xml"/>
</struts>cityinfo.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="cityInfo" extends="struts-default">
<!-- 访问首页 -->
<action name="goindex" class="com.yxq.action.IndexAction">
<result>/view/IndexTemp.jsp</result>
</action>
</package>
</struts>view文件夹下的IndexTemp.jsp
<%@ page language="java" contentType="text/html; charset=GBK"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
i'm indexTemp.jsp
</body>
</html>index.jsp:
<%@ page language="java" contentType="text/html; charset=GBK"%>
<% response.sendRedirect("goindex.action");%>action对应的类也已经生成了,所有的struts2包都在lib目录下了。所有的东西都是最新版的。struts2,eclipse,jdk, tomcat。我实在找不到原因了。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>CityInfo07</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="cityinfo.xml"/>
</struts>cityinfo.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="cityInfo" extends="struts-default">
<!-- 访问首页 -->
<action name="goindex" class="com.yxq.action.IndexAction">
<result>/view/IndexTemp.jsp</result>
</action>
</package>
</struts>view文件夹下的IndexTemp.jsp
<%@ page language="java" contentType="text/html; charset=GBK"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
i'm indexTemp.jsp
</body>
</html>index.jsp:
<%@ page language="java" contentType="text/html; charset=GBK"%>
<% response.sendRedirect("goindex.action");%>action对应的类也已经生成了,所有的struts2包都在lib目录下了。所有的东西都是最新版的。struts2,eclipse,jdk, tomcat。我实在找不到原因了。
<%@ page language="java" contentType="text/html; charset=GBK"%>
<% response.sendRedirect("indexTemp.jsp");%>
试试
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>