1. 在eclipse中新建一个web项目,File ---> New ---> Dynamic Web project;
  2. 往新建好的web项目中导入jar包,jar包的网址如下:https://i-beta.cnblogs.com/files,导入的位置为:web项目名 ---> WebContent ---> WEB-INF ---> lib
  3. 在web.xml中进行配置,
     1 <welcome-file-list>
     2     <welcome-file>index.html</welcome-file>
     3     <welcome-file>index.htm</welcome-file>
     4     <welcome-file>index.jsp</welcome-file>
     5     <welcome-file>default.html</welcome-file>
     6     <welcome-file>default.htm</welcome-file>
     7     <welcome-file>default.jsp</welcome-file>
     8   </welcome-file-list>
     9 
    10 <context-param>
    11       <param-name>contextConfigLocation</param-name>
    12       <param-value>classpath:bean.xml</param-value>
    13   </context-param>
    14   
    15   <filter>
    16           <filter-name>openSessionInViewFilter</filter-name>
    17           <filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class>
    18   </filter>
    19   
    20   <filter-mapping>
    21           <filter-name>openSessionInViewFilter</filter-name>
    22           <url-pattern>/*</url-pattern>
    23   </filter-mapping>
    24   
    25   <filter>
    26           <filter-name>struts</filter-name>
    27           <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    28   </filter>
    29   
    30   <filter-mapping>
    31           <filter-name>struts</filter-name>
    32           <url-pattern>/*</url-pattern>
    33   </filter-mapping>
    34   
    35   <listener>
    36       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    37   </listener>
    View Code

相关文章: