spring MVC(2)--注解Hello World
生活随笔
收集整理的這篇文章主要介紹了
spring MVC(2)--注解Hello World
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
為什么80%的碼農都做不了架構師?>>> ??
定義Controller,增加注解@Controller
????2. XML增加如下配置
<?xml?version="1.0"?encoding="UTF-8"?> <beans?xmlns="http://www.springframework.org/schema/beans"xmlns:mvc="http://www.springframework.org/schema/mvc"?xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"?xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"><!--????<bean?class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"?/>???????????<bean?class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"?/>-->???<bean?class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/><bean?class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/><!--?v3.1?<bean?class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"?/><bean?class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"?/>--><bean?class="org.springframework.web.servlet.view.InternalResourceViewResolver"><property?name="viewClass"?value="org.springframework.web.servlet.view.JstlView"?/><property?name="prefix"?value="/WEB-INF/jsp/"?/><property?name="suffix"?value=".jsp"?/>?</bean><bean?name="/hello"?class="com.zte.controller.HelloController"/><!--?處理器--><bean?class="com.zte.controller2.HelloController"/> </beans>? ? 3. 注冊Bean
<bean?class="com.zte.controller2.HelloController"/>轉載于:https://my.oschina.net/looten/blog/305600
總結
以上是生活随笔為你收集整理的spring MVC(2)--注解Hello World的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于Android ViewPager
- 下一篇: 报警系统设想