入门ssm框架的搭建

本文介绍了一个使用Spring MVC和MyBatis的Maven项目结构,详细讲解了从pom.xml到web.xml的配置过程,包括编码拦截器、Spring监听器、超时处理等。同时展示了Controller层的实现细节,如@RequestMapping注解的应用和业务逻辑调用。

 

1.很多的软件 都是不知道文件应该怎么放,特别是有一大堆的需要扫描的配置文件

的工程,Web:spring+springMvc+mybatis+maven+idea+jsp

2. maven项目首先就是pom.xml文件,

然后是 web项目的web.xml文件,(编码拦截器+spring监听器+springMvc的配置+超时处理+首页配置+静态资源加载)

3. spring-mvc文件中:扫描controller层的注解+跳转设置+配置拦截器+aop

 4.spring-mybatis:链接数据库的配置+扫描所有的mapping.xml文件+事务管理+dao层

5. controller层

   @RequestMapping("businessController/getBusinessDataForSeason")
    @ResponseBody                                                                           请求体                                                        url后面的参数
    public JsonReturn getBusinessDataForSeason(HttpServletRequest request, HttpServletResponse response, String syear,
                                               String type, String dealerCode) {
        //季度模式
        syear ="2015";
        dealerCode="SA11002";
        return businessService.getBusinessDataForSeason(syear, type, dealerCode);
    }
 @RequestMapping("login/logOut")
    public ModelAndView logOut(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView mv = new ModelAndView("/login/login");
        UserEntity userSession = (UserEntity) request.getSession().getAttribute("userSession");
        if (userSession != null) {
            request.getSession().removeAttribute("userSession");
        }
        return mv;
    }


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值