3、配置 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>4、在src 下添加 struts2 配置文件 ,struts.xml 文件 Xml 文件 頭文件-- 有兩種方法 拷貝一個struts2鄒波/struts-2.3.31/apps/WEB-INF/src/java “”struts.xml 或者到core包下的 struts-default.xml 中拷貝 注: 框架已經搭建完成 5、配置Action類--在struts .xml 文件中 Struts2基于包管理的<struts> <packagename="hello"extends="struts-default"> <actionname="hello"class="com.Action.text.helloAction_text"> <resultname="success">/index.jsp</result> </action> </package></struts>6.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>
|
新聞熱點
疑難解答