Struts2.3.24项目配置所需最少依赖jar包及配置

来源:互联网 发布:复杂网络及其应用pdf 编辑:程序博客网 时间:2024/06/08 16:13

1、Web Project项目结构


2、web.xml的内容

[html] view plaincopy
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"  
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4.     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">  
  5.   
  6.     <display-name>Struts Blank</display-name>  
  7.   
  8.     <filter>  
  9.         <filter-name>struts2</filter-name>  
  10.         <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>  
  11.     </filter>  
  12.   
  13.     <filter-mapping>  
  14.         <filter-name>struts2</filter-name>  
  15.         <url-pattern>/*</url-pattern>  
  16.     </filter-mapping>  
  17.   
  18.     <welcome-file-list>  
  19.         <welcome-file>index.html</welcome-file>  
  20.     </welcome-file-list>  
  21. </web-app>  

3、struts.xml内容

[html] view plaincopy
  1. <?xml version="1.0" encoding="UTF-8" ?>  
  2. <!DOCTYPE struts PUBLIC  
  3.     "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"  
  4.     "http://struts.apache.org/dtds/struts-2.3.dtd">  
  5.   
  6. <struts>  
  7. </struts>  

4、常见错误的解决

                 (1)、右键add to build path添加缺少的jar包到classpath,比如常见的缺少javassist-3.X.X.GA.jar包

                 (2)、要是右键add to build path还是不行,可以将对应的jar包放到tomcat的lib目录去试一下


0 0
原创粉丝点击