学习springmvc的注释搭建框架
来源:互联网 发布:自学网络编程 编辑:程序博客网 时间:2024/06/03 06:06
今天来整合一下springMVC注释搭建,在使用了注释之后,开发效率明显提高了,与strut2相差无几,甚至在运行效率上还要比strut快一点。
第一步。导入相关的包至lib文件夹。
第二步。在web.xml中配置dispatcherServlet。
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springmvc-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
第三步。添加xxx-servlet.xml文件
首先添加此bean。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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-3.0.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-3.0.xsd">
启动注解驱动的Spring MVC功能。
<mvc:annotation-driven />
启动包扫描功能
<context:component-scan base-package="com.springmvc.controller" />
配置视图解析器
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:suffix=".jsp" />
第四步。创建controller。
- 学习springmvc的注释搭建框架
- springMVC 框架搭建学习
- SpringMVC学习(一)--框架的搭建
- springmvc框架的搭建
- springmvc框架的搭建
- springMvc框架的搭建
- SpringMVC学习(一)--框架搭建
- SpringMvc[学习手记]-框架搭建
- Springmvc框架搭建与学习
- SpringMvc项目框架的搭建
- springmvc框架的搭建步骤
- springMVC学习笔记(一) ---- 搭建框架
- 【框架学习】SpringMVC原理及搭建
- 学习springmvc的基础搭建
- springmvc +mybatise 框架的搭建步骤
- SpringMVC框架的搭建步骤-002
- SpringMVC框架搭建的几个核心配置
- Spring,SpringMVC,Mybatis (SSM)框架的搭建
- python/pandas数据分析(十六)- 数据索引与选取
- 【九度】哈夫曼树
- Node实践总结1——快速开始
- jquery 中的.done()和.always()
- ucos全局变量
- 学习springmvc的注释搭建框架
- Android 系列 6.5控制操作栏
- SecureCRT 屏幕输出行数设置
- opencv学习之图像阈值化
- 7. Reverse Integer
- apache ant从svn下载代码并将其编译打包
- npm如何升级自身
- jquery的方法
- List有顺序吗?