1. Eclipse for JavaEE developer Helios
2. Struts 2.3.1.1
其实MyEclipse和Eclipse for JavaEE 的配置过程差不多,唯一的区别在于:
Eclipse for JAVAEE创建 Dynamic Web Projec;
MyEclipse创建的是Web Project;
4.
<?xml version="1.0" encoding="GBK"?> <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" version="3.0"> <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>
<?xml version="1.0" encoding="GBK" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> </struts>
1.创建一个Hello.jsp 并且内容为Hello struts2!!!
2.配置struts.xml
<struts> <constant name="struts.devMode" value="true"></constant> <package name="HelloPackage" namespace="/" extends="struts-default"> <action name="Hello"> <result>/Hello.jsp</result> </action> </package> </struts>
3.部署并在浏览器中填写 http://localhost:8888/StrutsDemo01/Hello
注意:在以后的开发中必须在<struts>元素中添加:
<constant name="struts.devMode" value="true"></constant>
因为这表明是在开发者模式,是指发生错误时提供更多的提示信息;