Spring mvc 未找到WebApplicationContext未找到ContextLoaderListener注册的spring mvc

Spring mvc 未找到WebApplicationContext未找到ContextLoaderListener注册的spring mvc,spring-mvc,exception,Spring Mvc,Exception,大家好,我正在开发第一个spring mvc应用程序,但仍然停留在第一个应用程序上 页面打开登录页面,就好像我引用了SpringMVC3应用程序一样 但我不明白为什么会出现这种异常 下面是我的堆栈跟踪 作为例外,我建议在web.xml中添加contextlistener,所以我添加了 这又是一个例外 我不明白我错在哪里。请帮帮我。好吧,SpringMVC中的JSP支持非常好,但乍一看并不明显。抛出的错误是JSP页面,但来自MVC控制器。您应该在调用视图的方法中声明ModelAttribute,比

大家好,我正在开发第一个spring mvc应用程序,但仍然停留在第一个应用程序上 页面打开登录页面,就好像我引用了SpringMVC3应用程序一样 但我不明白为什么会出现这种异常

下面是我的堆栈跟踪

作为例外,我建议在web.xml中添加contextlistener,所以我添加了 这又是一个例外


我不明白我错在哪里。请帮帮我。

好吧,SpringMVC中的JSP支持非常好,但乍一看并不明显。抛出的错误是JSP页面,但来自MVC控制器。您应该在调用视图的方法中声明ModelAttribute,比如Spring,在哪里可以找到表单的初始值。默认情况下,Spring会查找一个名为command的属性,因此会出现异常

如果需要进一步帮助,请显示controller方法和web.xml

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/views/index.jsp at line 39

36: 
37:                 <div class="hmed-login-view">
38:                     <div class="hmed-login-view-head">Patient Login</div>
39:                     <form:form action="/healthlog/login.html" method="POST">
40:                         <div>
41:                             <form:select path="role">
42:                                 <form:option value="Select User">Select User</form:option>


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:465)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause

java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
    org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:84)
    org.springframework.web.servlet.support.RequestContextUtils.getWebApplicationContext(RequestContextUtils.java:81)
    org.springframework.web.servlet.support.RequestContext.initContext(RequestContext.java:219)
    org.springframework.web.servlet.support.JspAwareRequestContext.initContext(JspAwareRequestContext.java:74)
    org.springframework.web.servlet.support.JspAwareRequestContext.<init>(JspAwareRequestContext.java:48)
    org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:76)
    org.apache.jsp.WEB_002dINF.views.index_jsp._jspService(index_jsp.java:136)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute
    org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:174)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:194)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:160)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:147)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:138)
    org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:122)
    org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:409)
    org.springframework.web.servlet.tags.form.SelectTag.writeTagContent(SelectTag.java:198)
    org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
    org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    org.apache.jsp.WEB_002dINF.views.index_jsp._jspService(index_jsp.java:150)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)