配置Struts2框架

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_36500835/article/details/90786408

1.拷贝jar包
在这里插入图片描述
2.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>

3.配置src/struts .xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
    "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    	<package name="one" namespace="/day01" extends="struts-default">
    		<action name="hello" class="org.wxy.helloClass">
    			<result name="success">/MyJsp.jsp</result>
    		</action>
    	</package>
    </struts>

猜你喜欢

转载自blog.csdn.net/qq_36500835/article/details/90786408