练习structs安装
http://struts.apache.org/download.cgi
下载 http://apache.etoak.com//struts/binaries/struts2-2.2.1-all.zip
然后解压,\struts2-2.2.1-all\struts-2.2.1\apps里面的*.war拷贝到虚拟目录\apache-tomcat-6.0.20\webapps
1,
复制struts2-blank-2.2.1\WEB-INF文件夹里面的web.xml文件到本项目的WEB-INF文件夹里。
到struts2-blank-2.2.1\WEB-INF\classes文件夹里将struts.xml文件复制到本项目的src文件夹里。
到struts2-blank-2.2.1\WEB-INF\lib文件夹里将所有的文件复制到本项目的WEB-INF\lib文件夹里。
2,修改配置文件
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>
<constant name="struts.devMode" value="true" /><!--打开开发模式,便于调试-->
<package name="default" namespace="/" extends="struts-default">
<action name="hello">
<result>
/Hello.jsp
</result>
</action>
</package>
</struts>
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>Struts Blank</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>
3,http://localhost:8080/testjdbc/hello打开网页
ps:能否显示中文也在这个里面配置,但是怎么配,忘记了,待补充
http://struts.apache.org/download.cgi
下载 http://apache.etoak.com//struts/binaries/struts2-2.2.1-all.zip
然后解压,\struts2-2.2.1-all\struts-2.2.1\apps里面的*.war拷贝到虚拟目录\apache-tomcat-6.0.20\webapps
1,
复制struts2-blank-2.2.1\WEB-INF文件夹里面的web.xml文件到本项目的WEB-INF文件夹里。
到struts2-blank-2.2.1\WEB-INF\classes文件夹里将struts.xml文件复制到本项目的src文件夹里。
到struts2-blank-2.2.1\WEB-INF\lib文件夹里将所有的文件复制到本项目的WEB-INF\lib文件夹里。
2,修改配置文件
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>
<constant name="struts.devMode" value="true" /><!--打开开发模式,便于调试-->
<package name="default" namespace="/" extends="struts-default">
<action name="hello">
<result>
/Hello.jsp
</result>
</action>
</package>
</struts>
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>Struts Blank</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>
3,http://localhost:8080/testjdbc/hello打开网页
ps:能否显示中文也在这个里面配置,但是怎么配,忘记了,待补充