struts2跳转,404!百思不知道哪里错了
简单的测试一个跳转,报错,请看看是什么原因?
WebContent下面文件内容:
index.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<a href="toWelcome.action">login on</a>
</body>
</html>
welcome.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
welcome to this!
</body>
</html>
src下面有一个action包,包里面有文件如下:
Welcome.java:
package action;
import com.opensymphony.xwork2.ActionSupport;
public class Welcome extends ActionSupport{
public String toWel(){
return SUCCESS;
}
}
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>
<package name="action" extends="struts-default" namespace="/" >
<action name="toWelcome" class="action.Welcome" method="toWel">
<result>welcome.jsp</result>
</action>
</package>
</struts>