当前位置: 首页 > news >正文

为公司建设网站的意义哪个平台开网店不收费

为公司建设网站的意义,哪个平台开网店不收费,建设网站改版,深圳工信部网站前面讲到#xff1a;SpringSpringMVCMyBatis深入学习及搭建(十三)——SpringMVC入门程序(二)1.需求使用springmvc和mybatis完成商品列表查询。2.整合思路springmvcmybatis的系统架构#xff1a;第一步#xff1a;整合dao层mybatis和spring整合#xff0c;通过spring管理map…前面讲到SpringSpringMVCMyBatis深入学习及搭建(十三)——SpringMVC入门程序(二)1.需求使用springmvc和mybatis完成商品列表查询。2.整合思路springmvcmybatis的系统架构第一步整合dao层mybatis和spring整合通过spring管理mapper接口。使用mapper的扫描器自动扫描mapper接口在spring中进行注册。第二步整合service层通过spring管理service接口。使用配置方式将service接口配置在spring配置文件中。实现事务控制。第三步整合springMvc由于springmvc是spring的模块不需要整合。3.环境准备数据库环境mysql5.6java环境jdk1.7MyEclipse2014springmvc版本spring3.2所需要的jar包数据库驱动包mybatis的jar包mybatis的spring的整合包log4j包dbcp数据库连接池包spring3.2所有jar包jstl包过程结构目录4.整合daomybatis和spring进行整合。4.1 db.propertiesjdbc.drivercom.mysql.jdbc.Driverjdbc.urljdbc:mysql://localhost:3306/mybatisdemojdbc.usernamerootjdbc.password4.2 log4j.properties# Global logging configuration建议开发环境要用debuglog4j.rootLoggerDEBUG, stdout# Console output...log4j.appender.stdoutorg.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layoutorg.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern%5p [%t] - %m%n4.3 sqlMapConfig.xml在classpath下创建mybatis/sqlMapConfig.xml。?xml version1.0 encodingUTF-8?/pPUBLIC -//mybatis.org//DTD Config 3.0//ENhttp://mybatis.org/dtd/mybatis-3-config.dtd4.4 applicationContext-dao.xml在classpath下创建spring/applicationContext-dao.xml。配置数据源、事务管理、SqlSessionFactory、mapper扫描器。4.5逆向工程生成po类及mapper(即单表增删改查)详情见SpringSpringMVCMyBatis深入学习及搭建(十)——MyBatis逆向工程将生成的文件拷贝至工程中。4.6手动定义商品查询mapper针对综合查询mapper一般情况会有关联查询建议自定义mapper。4.6.1 ItemsMapperCustom.xmlsql语句SELECT * FROM items WHERE items.name LIKE %笔记本%?xml version1.0 encodingUTF-8 ?items.name LIKE %${itemsCustom.name}%resultTypejoanna.yan.ssm.po.ItemsCustomSELECT items.* FROM items4.6.2 ItemsMapperCustom.javapublic interface ItemsMapperCustom {//商品查询列表public List findItemsList(ItemsQueryVo itemsQueryVo) throws Exception;}5.整合service让spring管理service接口。5.1定义service接口package joanna.yan.ssm.service;import java.util.List;import joanna.yan.ssm.po.ItemsCustom;import joanna.yan.ssm.po.ItemsQueryVo;public interface ItemsService {//商品查询列表public List findItemsList(ItemsQueryVo itemsQueryVo) throws Exception;}package joanna.yan.ssm.service.impl;import java.util.List;import org.springframework.beans.factory.annotation.Autowired;import joanna.yan.ssm.mapper.ItemsMapperCustom;import joanna.yan.ssm.po.ItemsCustom;import joanna.yan.ssm.po.ItemsQueryVo;import joanna.yan.ssm.service.ItemsService;public class ItemsServiceImpl implements ItemsService{Autowiredprivate ItemsMapperCustom itemsMapperCustom;Overridepublic List findItemsList(ItemsQueryVo itemsQueryVo)throws Exception {//通过ItemsMapperCustom查询数据库return itemsMapperCustom.findItemsList(itemsQueryVo);}}5.2在spring容器配置service(applicationContext-service.xml)在classpath下创建spring/applicationContext-service.xml文件中配置service。5.3事务控制(applicationContext-transaction.xml)在classpath下创建spring/applicationContext-service.xml文件中使用spring声明式事务控制方法。6.整合springmvc6.1 springmvc.xml在classpath下创建spring/springvc.xml文件配置处理器映射器、适配器、视图解析器。6.2配置前端控制器参考入门程序SpringSpringMVCMyBatis深入学习及搭建(十二)——SpringMVC入门程序(一)在web.xml中配置SpringMVC_MyBatisindex.jspspringmvcorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:spring/springmvc.xml1springmvc*.action6.3编写Controller(就是Handler)Controllerpublic class ItemsController {Autowiredprivate ItemsService itemsService;//商品查询http://localhost:8080/SpringMVC_MyBatis/queryItems.actionRequestMapping(/queryItems)public ModelAndView queryItems() throws Exception{//调用service查找数据库查询商品列表List itemsListitemsService.findItemsList(null); //返回ModelAndViewModelAndView modelAndViewnew ModelAndView();modelAndView.addObject(itemsList, itemsList);//指定视图// modelAndView.setViewName(/WEB-INF/jsp/items/itemsList.jsp);//下边的路径如果在视图解析器中配置jsp路径的前缀和jsp路径的后缀修改为modelAndView.setViewName(items/itemsList);return modelAndView;}}6.4编写jsp查询商品列表查询条件商品列表商品名称商品价格生产日期商品描述操作${item.name }${item.price }${item.detail }修改7.加载spring容器将mapper、service、controller加载到spring容器中。建议使用通配符加载上边的配置文件。在web.xml中添加spring容器监听器加载spring容器。contextConfigLocation/WEB-INF/classes/spring/applicationContext-*.xmlorg.springframework.web.context.ContextLoaderListener8.商品查询调试访问地址http://localhost:8080/SpringMVC_MyBatis/queryItems.action查询结果
http://www.huolong8.cn/news/130730/

相关文章:

  • dede旅游网站模板edm营销网站
  • 飞沐网站建设北京做图片的软件app
  • 网站建设意义模板找推广平台需要多少钱
  • 北京网站设计公司飞沐黑龙江省建设网
  • 做网站设计需要多少钱陕西手机网站建设
  • 安徽中擎建设公司网站广州市律师网站建设价格
  • 无锡网站推广排名怎么做自己的快递查询网站
  • html5个人网站模板企业网站分析报告
  • 站长之家alexa排名新郑网站优化
  • 不同的网站前缀就是不同的域名吗wordpress换主题后打不开
  • 广州市建设工程检测中心网站常州网站建设软件
  • 网站不备案违法吗工业产品设计展板
  • 网站空间上传教程网站自定义链接怎么做
  • 做网站需要的图片去哪找互联网营销推广渠道
  • 自己买空间做网站怎么做网站建设销售
  • 网站推广的特点网络培训的优点包括什么
  • 张家界市住房和城乡建设局网站赣州网站优化推广
  • 网站服务合同模板wordpress记账
  • 个人网站模板html下载二级域名租用
  • 怎么看网站是不是php语言做的学做网站论坛vip学员码
  • 项城市建设规划局网站大型网站开发用什么语言
  • 江西新余网站建设通讯员队伍建设与网站新闻管理
  • 论坛建站哪个比较好网站推广有哪些常用的方法
  • 惠州网站推广网站服务器的功能
  • 怎么做网站备案wordpress多说
  • 北京产品网站建设陕西哪些公司做企业网站
  • 不同网站的主机和域名网上商城有哪些
  • 聊城企业做网站推广达州北京网站建设
  • 霸州建设局网站网站认证怎么做
  • 佛山市多语言营销型网站建站网上商城html模板