1.建立基礎的java web application
Project structure
2.加上Server filter,修改WEB-INF中web.xml的內容
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3.建立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="struts2" extends="struts-default"> <action name="index"> <result>/index.jsp</result> </action> </package> </struts>
4.複製jar檔到class path
複製struts 2 WEB-INF/lib下的*.jar檔到 web application的WEB-INF/lib下去
5.使用ant build以上的project
文章標籤
全站熱搜
留言列表