【云盘项目2 SpringMVC.xml

JDBC的使用步骤
首先给出 MySql JDBC官方文档

步骤如下:

1加载数据库驱动,这个驱动由数据库厂商提供
2建立连接,获取Connection
3通过Statement对象访问数据库,由Connection产生,执行SQL语句
4如果需要返回值,创建ResultSet对象,保存Statement执行之后查询的结果
5释放资源
 

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
		http://www.springframework.org/schema/mvc 
		http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
		http://www.springframework.org/schema/context 
		http://www.springframework.org/schema/context/spring-context-3.2.xsd 
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 
		http://www.springframework.org/schema/tx 
		http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
<context:component-scan base-package="com.yun.controller"/>

<!-- 开启注解支持 -->
    <!--  spring 可以自动去扫描 base-package下面的包或子包下面的Java文件,
                    如果扫描到有Spring的相关注解的类,则把这些类注册为Spring的bean -->

<mvc:annotation-driven></mvc:annotation-driven>

<!--设置配置方案 -->
    <!-- 解决了@Controller注解的使用前提配置<context:annotation-config/>是对包进行扫描,实现注释驱动Bean定义,同时将bean自动注入容器中使用。即解决了@Controller标识的类的bean的注入和使用。  -->
    <!-- 会自动注册RequestMappingHandlerMapping与RequestMappingHandlerAdapter两个Bean,
                (对action写JUnit单元测试时,要从spring IOC容器中取两个bean,来完成测试)
    这是Spring MVC为@Controller分发请求所必需的,并且提供了数据绑定支持,
                                         @NumberFormatannotation支持,
                                         @DateTimeFormat支持,
                                         @Valid支持读写XML的支持(JAXB)
                                         和读写JSON的支持(默认Jackson)等功能。(我们处理响应ajax请求时,就使用到了对json的支持。)-->

SpringMVC文件上传——bean的配置【org.springframework.web.multipart.commons.CommonsMultipartResolver】 - 七月晚风 - 博客园 (cnblogs.com)

<mvc:interceptors>
		<mvc:interceptor>
			<mvc:mapping path="/**"/>
			<bean class="com.yun.interceptor.LoignInterceptor"></bean>
		</mvc:interceptor>
	</mvc:interceptors>

<!--@RequestMapping()匹配类加方法 
                    "/*"      直接对应路径可被拦截
                    "/**"     所有拦截
                    "/you/*"  对应     
                    "/"       都不能被拦截-->

public class LoignInterceptor implements HandlerInterceptor {

(99条消息) springmvc interceptor拦截器 <mvc:mapping path="/**" />_youz1976的博客-CSDN博客_mvc:mapping

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="maxUploadSize">
			<value>509715200</value>
		</property>
	</bean>

 <!--配置文件上传使用解析器--><!-- 指定上传文件最大尺寸 -->
    <!-- 通用的多路上传解析器 
    Spring MVC支持一个通用的多路上传解析器CommonsMultipartResolver,
    在Spring的配置文件中对CommonsMultipartResolver Bean进行配置时,
    有一些可选的属性配置。-->

(99条消息) SpringMVC文件上传——bean的配置【org.springframework.web.multipart.commons.CommonsMultipartResolver】..._anshi8724的博客-CSDN博客

    <bean
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
			<property name="prefix" value="/WEB-INF/jsp/"/><!-- 该目录下 -->
			<property name="suffix" value=".jsp"/><!-- 后缀 -->
	</bean>
</beans>

<!-- springmvc的视图解析器:Controller返回的时候进行解析视图 -->

通常是用来配置jsp的

 html和jsp

(99条消息) springmvc的InternalResourceViewResolver自我理解_wwzuizz的博客-CSDN博客_internalresourceviewresolver

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值