springmvc详解(二)

本文详细介绍了SpringMVC的配置,包括web.xml、springmvc.xml、dao层、service层和表现层的配置文件。此外,还讲解了如何手动定义多表的PO类和Mapper,以及在Controller和JSP中的实现。内容适用于Java开发者,尤其是面试和实践经验的积累。
摘要由CSDN通过智能技术生成

<bean

class=“org.springframework.web.servlet.view.InternalResourceViewResolver”>

3.4、配置web.xml文件


在web.xml文件中完成一下几件事:

1、配置springmvc的前端控制器(加载springmvc配置文件)

2、加载spring的配置文件

3、加载监听器

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”

xmlns=“http://xmlns.jcp.org/xml/ns/javaee” xsi:schemaLocation=“http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd” id=“WebApp_ID” version=“3.1”>

springmvcfirst

contextConfigLocation

/WEB-INF/classes/spring/applicationContext-*.xml

org.springframework.web.context.ContextLoaderListener

springmvc

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

classpath:spring/springmvc.xml

</s Java开源项目【ali1024.coding.net/public/P7/Java/git】 ervlet>

springmvc

*.action

index.html

index.htm

index.jsp

default.html

default.htm

default.jsp

3.5、三层整合配置文件总结


3.5.1、dao层

1、mybatis自己的配置文件sqlMapConfig.xml

实现别名定义、缓存设置等配置。

2、dao层spring配置文件applicationContext-dao.xml

完成数据源、SqlSessionFactory、mapper扫描器的配置。

3.5.2、service层

1、service层spring配置文件applicationContext-service.xml

管理service接口实现类的bean(注解方式)

2、spring管理事务的配置文件applicationContext-transaction.xml

实现事务控制、AOP

3.5.3、表现层配置文件springmvc.xml

配置Handler、处理器映射器、适配器、视图解析器。

3.5.4、w

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值