第一步:将需要的jar包导入web-inf下面的lib目录下
struts2-core-xxx.jar xwork-core-xxx.jar common-logging-xxx.jar common-io-xxx.jar common--fileupload-xxx.jar javassist-xxx.jar
第二步:配置web.xml文件
在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>
第三步:加入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> </struts>