为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我的web.xml里面添加了新的配置内容,页面就不能打开了

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.5" 

xmlns="http://java.sun.com/xml/ns/javaee" 

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

  <!-- spring核心监听器 -->

  <listener>

  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

  <!-- ctrl+shift+T  输入ContextLoaderListener 便可快速查询其位置 -->  

  </listener>  

  <context-param>

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

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

  </context-param>

  

<!-- struts2框架核心过滤器配置 -->

<filter>

<filter-name>struts</filter-name><!-- 与下面的struts一致 -->

<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

</filter>

<filter-mapping>

<filter-name>struts</filter-name><!-- 此处可以任意命名,struct是自定义的 -->

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

</filter-mapping>

  <display-name></display-name>

    

  <welcome-file-list>

    <welcome-file>index.jsp</welcome-file>

  </welcome-file-list>

</web-app>



加了struts  spring的配置就不行了

正在回答

1 回答

spring配置文件中加载的东西比较多,并且你http://img1.sycdn.imooc.com//58197ee80001365905910181.jpg

这么配置过后,只要一开启服务器,先读取web.xml文件,然后读到这里的时候就会去加载spring的配置文件,如果spring配置文件里有加载数据库的,就要先打开数据库服务,不然项目启动就会报错。

1 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为什么我的web.xml里面添加了新的配置内容,页面就不能打开了

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信