求助求助我的springMVC如下:<?xml?version="1.0"?encoding="UTF-8"?>
<beans?xmlns="http://www.springframework.org/schema/beans"
???????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
???????xmlns:context="http://www.springframework.org/schema/context"
???????xmlns:mvc="http://www.springframework.org/schema/mvc"
???????xsi:schemaLocation="http://www.springframework.org/schema/beans?http://www.springframework.org/schema/beans/spring-beans.xsd?http://www.springframework.org/schema/context?http://www.springframework.org/schema/context/spring-context.xsd?http://www.springframework.org/schema/mvc?http://www.springframework.org/schema/mvc/spring-mvc.xsd">
????<!--自動掃描控制器-->
????<context:component-scan?base-package="com.dsc.ssm.controller"/>
????<!--視圖渲染-->
????<!--控制器映射器和控制器適配器-->
????<mvc:annotation-driven></mvc:annotation-driven>
????
????<mvc:resources?mapping="/resources/**"?location="/reources/"></mvc:resources>
????<bean?id="internalResourceViewResolver"?class="org.springframework.web.servlet.view.InternalResourceViewResolver">
????????<property?name="prefix"?value="/WEB-INF/views/"/>
????????<property?name="suffix"?value=".jsp"/>
????</bean>
</beans>Controller如下:@Controller
public?class?HelloController?{
????@RequestMapping("/hello")
????public?ModelAndView?hello(){
????????ModelAndView?mv?=?new?ModelAndView("hello");
????????mv.addObject("spring","spring?mvc");
????????mv.setViewName("hello");
????????return?mv;
????}
}hello.jsp的目錄在
添加回答
舉報(bào)
0/150
提交
取消