参数映射控制器JSP页面
项目结构
在webcontent创建images文件夹,用于跳转页面的图片素材。
WEB_INF下创建jsp文件夹,用于跳转的jsp页面。
当然需要导入MVC所需要的Spring.jar,Spring_mvc等等。
lib下创建appplicationContext.xml。
lib将导入的jar添加。
appcationContext.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- 定义视图分解器 -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.InternalResourceView</value>
</property>
<!-- 设置前缀,即视图所在的路径 -->
<property name="prefix" value="/WEB-INF/jsp/" />
<!--