求助求助
我的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的目录在
HansonQ
相关分类