spring mvc 是基于spring的一款主要做web程序的框架。
model view controller 模型 视图 控制器
web.xml {
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>...DispatcherServlet</servlet-class>
<!--初始化springmvc.xml-->
<init-param>
<param-name>ContextConfigLoaction</param-name>
<param-value>classpath:springmvc.xml</param-value>
</init-param>
</servlet>
<servlet-mapper>
<servlet-name>springmvc</servlet-name>
<url-patter>*.action</url-patter>
</servlet-mapper>
}
springmvc.xml{
<!-- 视图解析器-->
<bean class="..InternalResourceViewResolver">
<property name="prefix" value="/"></..>
<property name="suffix" value=".jsp"></..>
</bean>
<!--注解扫描-->
<context:component-scan base-package="com.yps.controller"></..>
<!--注解驱动器-->
<mvc:annotation-driven></..>
}
TestController{
@Controller
@RquestMapping("add")
@DateTimeFormat(patterm="yyyy-MM-dd")
}