javascript
java mvc 菜鸟_Spring MVC 简单入门
1331601238 盧久貴
web.xml?配置:
dispatcher
org.springframework.web.servlet.DispatcherServlet
加載/WEB-INF/spring-mvc/目錄下的所有XML作為Spring MVC的配置文件
contextConfigLocation
/WEB-INF/spring-mvc/*.xml
1
dispatcher
*.htm
這樣,所有的.htm的請求,都會被DispatcherServlet處理;
初始化 DispatcherServlet 時,該框架在 web 應用程序WEB-INF 目錄中尋找一個名為[servlet-名稱]-servlet.xml的文件,并在那里定義相關的Beans,重寫在全局中定義的任何Beans,像上面的web.xml中的代碼,對應的是dispatcher-servlet.xml;當然也可以使用元素,手動指定配置文件的路徑;
dispatcher-servlet.xml?配置:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />
總結
以上是生活随笔為你收集整理的java mvc 菜鸟_Spring MVC 简单入门的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 欢乐斗地主御林军怎么领
- 下一篇: 美团外卖APP如何使用(汉典美字的基本解