谁能帮我做一个完全可运行的debug小例子,要求struts module2
如题,要求架构是tomcat7,eclipse indigo ee, struts module2,完整的配置步骤。急,正确马上给分! --------------------编程问答-------------------- --------------------编程问答-------------------- action类:
package com;
public class Demo {
public String execute()
{
System.out.println("action...................");//测试是否进入action类
return "suc";//跳转页面
}
}
sturts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="default" extends="struts-default">
<action name="demo" class="com.Demo">//这里的class:是action类得全路径
<result name="suc">/sucess.jsp</result>
</action>
</package>
</struts>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
//strut2相关配置信息
<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>*.action</url-pattern>
</filter-mapping></web-app>
index.jsp:
-->
<script type="text/javascript">
window.location="demo.action";//跳转action类
</script>
</head>
<body>
This is my JSP page. <br>
</body>
</html>
sucess.jsp:
</head>
<body>
Strut2Demo测试配置成功!//是否在浏览器上测试成功的信息
</body>
</html>
控制台信息:
action...................
--------------------编程问答-------------------- 我是初学者,我要完完整整的例子并且带说明。 --------------------编程问答-------------------- 继续找 --------------------编程问答-------------------- 自己写一个 --------------------编程问答-------------------- --------------------编程问答-------------------- eclipse indigo ee??
是什么来着、
补充:Java , Web 开发