刚开始学Struts2 遇到了一些困难 求帮助啊

J2EE 码拜 8年前 (2016-03-20) 775次浏览
web.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app id=”WebApp_9″ version=”2.4″ xmlns=”http://java.sun.com/xml/ns/j2ee”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”>
<display-name>StrutsTest</display-name>
<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>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
java类
package Struts2;
import com.opensymphony.xwork2.Action;
public class StrutsAction implements Action{
public String execute() throws Exception {
return SUCCESS;
}
}
struts.xml
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<!DOCTYPE struts PUBLIC
“-//Apache Software Foundation//DTD Struts Configuration 2.3//EN”
“http://struts.apache.org/dtds/struts-2.3.dtd”>
<struts>
<package name=”default” namespace=”/” extends=”struts-default”>
<action name=”hello” class=”Struts2.StrutsAction”>
<result name=”sucess” >
/NewFile.jsp
</result>
</action>
</package>
</struts>
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>
im jsp
</body>
</html>刚开始学Struts2 遇到了一些困难 求帮助啊
然后连接 http://localhost:8080/Struts2/hello  (Struts2是项目名)
会报这种错误 :    HTTP Status 404 – No result defined for action Struts2.StrutsAction and result success
解决方案

40

刚开始学Struts2 遇到了一些困难 求帮助啊

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明刚开始学Struts2 遇到了一些困难 求帮助啊
喜欢 (0)
[1034331897@qq.com]
分享 (0)