m0_59118963
2021-06-22 10:31
采纳率: 57.1%
浏览 42
已采纳

Java web中的web.xml写了代码login.do不能跳转

 <display-name>hibernate的jpa实现</display-name>

 <context-param>

  <param-name>contextConfigLocation</param-name>

  <param-value>classpath:beans.xml</param-value>

 </context-param>

 <!-- 对Spring容器进行实例化 -->

 <listener>

  <listener-class>

   org.springframework.web.context.ContextLoaderListener

  </listener-class>

 </listener>

 <!-- 把jpa的EntityManager设为开启状态 解决延迟加载的问题-->

 <filter>

  <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>

  <filter-class>

   org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter

  </filter-class>

 </filter>

 <filter-mapping>

  <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>

  <url-pattern>/*</url-pattern>

 </filter-mapping>

 <!-- 利用的spring的过滤器来设置编码方式 -->

 <filter>

  <filter-name>Spring character encoding filter</filter-name>

  <filter-class>

   org.springframework.web.filter.CharacterEncodingFilter

  </filter-class>

  <init-param>

   <param-name>encoding</param-name>

   <param-value>UTF-8</param-value>

  </init-param>

 </filter>

 <filter-mapping>

  <filter-name>Spring character encoding filter</filter-name>

  <url-pattern>/*</url-pattern>

 </filter-mapping>

 <!-- struts2.1配置 start 注意我们陪着struts2的时候一定把这个过滤器ActionContextCleanUp陪在FilterDispatcher的前面-->

 <display-name>Struts Blank</display-name>

 <filter>

  <filter-name>struts-cleanup</filter-name>

  <filter-class>

   org.apache.struts2.dispatcher.ActionContextCleanUp

  </filter-class>

 </filter>

 <filter>

  <filter-name>struts2</filter-name>

  <filter-class>

   org.apache.struts2.dispatcher.FilterDispatcher

  </filter-class>

 </filter>

 <filter-mapping>

  <filter-name>struts-cleanup</filter-name>

  <url-pattern>/*</url-pattern>

 </filter-mapping>

 <filter-mapping>

  <filter-name>struts2</filter-name>

  <url-pattern>/*</url-pattern>

 </filter-mapping>

 <display-name>Struts Blank</display-name>

 <!-- struts2.1 end -->

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • li.siyuan 2021-06-22 21:02
    已采纳
     <filter-mapping>
    
      <filter-name>struts2</filter-name>
    
      <url-pattern>/*.do</url-pattern>
    
     </filter-mapping>

    struts2? 这个配置改一下

    已采纳该答案
    评论
    解决 1 无用
    打赏 举报

相关推荐 更多相似问题