第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

找不到WebApplicationContext:沒(méi)有注冊(cè)ContextLoader

找不到WebApplicationContext:沒(méi)有注冊(cè)ContextLoader

哈士奇WWW 2019-09-03 16:35:44
我正在嘗試創(chuàng)建一個(gè)簡(jiǎn)單的Spring 3應(yīng)用程序并具有以下文件。請(qǐng)告訴我這個(gè)錯(cuò)誤的原因下面是我的web.xml<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xmlns="http://java.sun.com/xml/ns/javaee"        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee             http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"        id="WebApp_ID" version="3.0">    <display-name>Spring2</display-name>    <welcome-file-list>        <welcome-file>index.jsp</welcome-file>    </welcome-file-list>    <servlet>        <servlet-name>dispatcher</servlet-name>        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>        <load-on-startup>0</load-on-startup>    </servlet>    <servlet-mapping>        <servlet-name>dispatcher</servlet-name>        <url-pattern>/</url-pattern>    </servlet-mapping></web-app>下面是我的index.jsp<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %><%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>    <head>        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">        <title>Insert title here</title>    </head>    <body>        Index Page<br/>        <form:form commandName="loginBean" method="POST" action="login">            <form:input path="userName" id="userName"/><br/>            <form:input path="password" id="password"/><br/>            <input type="submit" value="submit"/>           </form:form>        <a href="register.jsp">Go to Registration Page</a>    </body></html>
查看完整描述

3 回答

?
慕娘9325324

TA貢獻(xiàn)1783條經(jīng)驗(yàn) 獲得超4個(gè)贊

您必須在web.xml中安裝ContextLoaderListener - 它會(huì)加載您的配置文件。


<listener>

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

</listener>

您需要了解Web應(yīng)用程序上下文和根應(yīng)用程序上下文之間的區(qū)別。


在Web MVC框架中,每個(gè)DispatcherServlet都有自己的WebApplicationContext,它繼承了根WebApplicationContext中已定義的所有bean。定義的這些繼承bean可以在特定于servlet的作用域中重寫(xiě),并且可以在給定servlet實(shí)例的本地定義新的作用域特定bean。


調(diào)度程序servlet的應(yīng)用程序上下文是一個(gè)Web應(yīng)用程序上下文,僅適用于Web類(lèi)。您不能將這些用于中間層。這些需要使用ContextLoaderListener的全局應(yīng)用程序上下文。


閱讀Spring參考這里的Spring MVC的。


查看完整回答
反對(duì) 回復(fù) 2019-09-03
  • 3 回答
  • 0 關(guān)注
  • 1575 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)