StrutsII学习笔记_ HelloWorld
apache 下载Struts2? 2.2
Oracle Sun 下载Java? 1.6
配置MyEclipse 7.5
?
打开下载Struts2文件的例子程序?? blank war文件? (WinRar文件打开)
?
Struts.xml文件拷贝到src文件下
配置如下:
<?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>
?
?<constant name="struts.devMode" value="true" /> <!--?修改文件后自动部署 -->
<package name="default" namespace="/" extends="struts-default">
??????? <default-action-ref name="index" />
??????? <action name="hello_struts">
??????????? <result >
????????????? /hello.jsp
??????????? </result>
??????? </action>
? </package>
??? <!-- Add packages here -->
</struts>
Web.xml增加过滤器
?
??? <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>
?
?
添加index.xml文件
?
启动项目:http://localhost:8080/Struts2_0100_Introduction/hello_struts
?
添加Dt校验
?
window ??proference ??? xml cataloges?? add???? location??? URI???HttpAddress
?
?
MyEclipse? 修改项目的发布路径
?
Project?? proferences? web 修改文本框里面的内容
?