dispatcher-servlet.xml 文件配置
<?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"
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">
<!--component-scan就是告诉Servlet去哪里找到相应的Controller-->
<context:component-scan base-package="controllers"/>
<!--视图解析器-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 视图的路径 -->
<property name="prefix" value="/WEB-INF/View/Hello/"/>
<!-- 视图名称后缀 -->
<property name="suffix" value=".jsp"/>
</bean>
</beans>
largeQ
GCT1015
慕勒3428872
相关分类