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去哪里找到相應(yīng)的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>
添加回答
舉報(bào)
0/150
提交
取消