关于spring mvc中问题
关于springmvc中为什么直接访问带有<spring:bind的jsp页面会报下面额错误org.apache.jasper.JasperException:NoWeb...
关于spring mvc中为什么直接访问带有<spring:bind的jsp页面会报下面额错误
org.apache.jasper.JasperException: No WebApplicationContext found: no ContextLoaderListener registered?
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://Java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://Java.sun.com/xml/ns/j2ee http://Java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<!--配置Sring MVC的核心控制器DispatcherServlet -->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<!--为DispatcherServlet建立映射 -->
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
QQ283785350 展开
org.apache.jasper.JasperException: No WebApplicationContext found: no ContextLoaderListener registered?
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://Java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://Java.sun.com/xml/ns/j2ee http://Java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<!--配置Sring MVC的核心控制器DispatcherServlet -->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<!--为DispatcherServlet建立映射 -->
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
QQ283785350 展开
2个回答
展开全部
上面不是写着吗 No WebApplicationContext found: no ContextLoaderListener ,你给他加上就行了 。你的web.xml没有配置 spring
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
更多追问追答
追问
contextConfigLocation
/WEB-INF/dispatcherServlet-*.xml
org.springframework.web.context.ContextLoaderListener
我是这么加的spring mvc没有applicationContext.xml这个文件吧
追答
你的 spring 配置文件 加啥名 你就改成啥名。改好了 给个最佳答案呀
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询