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

做四级题目的网站南通建设网站哪家好

做四级题目的网站,南通建设网站哪家好,地产广告设计网站,苏州做网站企业文章出处#xff1a;课程资料 web.xml等配置文件的解释#xff1a;打开博客 为了更好的学习 springmvc和mybatis整合开发的方法#xff0c;需要将springmvc和mybatis进行整合。 整合目标#xff1a;控制层采用springmvc、持久层使用mybatis实现。 步骤详解#xff1a; …文章出处课程资料 web.xml等配置文件的解释打开博客 为了更好的学习 springmvc和mybatis整合开发的方法需要将springmvc和mybatis进行整合。 整合目标控制层采用springmvc、持久层使用mybatis实现。 步骤详解 创建数据库表 需要的jar包 spring包括springmvcmybatismybatis-spring整合包数据库驱动第三方连接池。 整合思路 Dao层 1、SqlMapConfig.xml空文件即可但是需要文件头。 2、applicationContext-dao.xml 数据库连接池 b) SqlSessionFactory对象需要spring和mybatis整合包下的。 c) 配置mapper文件扫描器。 Service层 1、applicationContext-service.xml包扫描器扫描service注解的类。 2、applicationContext-trans.xml配置事务。 Controller层 1、Springmvc.xml a) 包扫描器扫描Controller注解的类。 b) 配置注解驱动 c) 配置视图解析器 Web.xml文件 1、配置spring 2、配置前端控制器。 创建工程 创建动态web工程springmvc-web选2.5可以自动生成web.xml 加入jar包 复制jar包到/WEB-INF/lib中 工程自动加载jar包 加入配置文件 创建资源文件夹config 在其下创建mybatis和spring文件夹用来存放配置文件如下图 sqlMapConfig.xml 使用逆向工程来生成Mapper相关代码不需要配置别名。 在config/mybatis下创建SqlMapConfig.xml ?xml version1.0 encodingUTF-8? !DOCTYPE configuration PUBLIC -//mybatis.org//DTD Config 3.0//EN http://mybatis.org/dtd/mybatis-3-config.dtd configuration/configurationapplicationContext-dao.xml 配置数据源、配置SqlSessionFactory、mapper扫描器。 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:contexthttp://www.springframework.org/schema/context xmlns:phttp://www.springframework.org/schema/pxmlns:aophttp://www.springframework.org/schema/aop xmlns:txhttp://www.springframework.org/schema/txxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd!-- 加载配置文件 --context:property-placeholder locationclasspath:db.properties /!-- 数据库连接池 --bean iddataSource classorg.apache.commons.dbcp.BasicDataSourcedestroy-methodcloseproperty namedriverClassName value${jdbc.driver} /property nameurl value${jdbc.url} /property nameusername value${jdbc.username} /property namepassword value${jdbc.password} /property namemaxActive value10 /property namemaxIdle value5 //bean!-- 配置SqlSessionFactory --bean idsqlSessionFactory classorg.mybatis.spring.SqlSessionFactoryBean!-- 数据库连接池 --property namedataSource refdataSource /!-- 加载mybatis的全局配置文件 --property nameconfigLocation valueclasspath:mybatis/SqlMapConfig.xml //bean!-- 配置Mapper扫描 --bean classorg.mybatis.spring.mapper.MapperScannerConfigurer!-- 配置Mapper扫描包 --property namebasePackage valuecn.itcast.ssm.mapper //bean/beansdb.properties 配置数据库相关信息 jdbc.drivercom.mysql.jdbc.Driver jdbc.urljdbc:mysql://localhost:3306/springmvc?characterEncodingutf-8 jdbc.usernameroot jdbc.passwordrootapplicationContext-service.xml ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:contexthttp://www.springframework.org/schema/context xmlns:phttp://www.springframework.org/schema/pxmlns:aophttp://www.springframework.org/schema/aop xmlns:txhttp://www.springframework.org/schema/txxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsdhttp://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd!-- 配置service扫描 --context:component-scan base-packagecn.itcast.ssm.service //beansspringmvc.xml ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:phttp://www.springframework.org/schema/pxmlns:contexthttp://www.springframework.org/schema/contextxmlns:mvchttp://www.springframework.org/schema/mvcxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd!-- 配置controller扫描包 --context:component-scan base-packagecn.itcast.ssm.controller /!-- 注解驱动 --mvc:annotation-driven /!-- Example: prefix/WEB-INF/jsp/, suffix.jsp, viewnametest - /WEB-INF/jsp/test.jsp --!-- 配置视图解析器 --beanclassorg.springframework.web.servlet.view.InternalResourceViewResolver!-- 配置逻辑视图的前缀 --property nameprefix value/WEB-INF/jsp/ /!-- 配置逻辑视图的后缀 --property namesuffix value.jsp //bean/beansweb.xml ?xml version1.0 encodingUTF-8? web-app xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlnshttp://java.sun.com/xml/ns/javaeexsi:schemaLocationhttp://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsdidWebApp_ID version2.5display-namespringmvc-web/display-namewelcome-file-listwelcome-fileindex.html/welcome-filewelcome-fileindex.htm/welcome-filewelcome-fileindex.jsp/welcome-filewelcome-filedefault.html/welcome-filewelcome-filedefault.htm/welcome-filewelcome-filedefault.jsp/welcome-file/welcome-file-list!-- 配置spring --context-paramparam-namecontextConfigLocation/param-nameparam-valueclasspath:spring/applicationContext*.xml/param-value/context-param!-- 使用监听器加载Spring配置文件 --listenerlistener-classorg.springframework.web.context.ContextLoaderListener/listener-class/listener!-- 配置SrpingMVC的前端控制器 --servletservlet-namespringmvc-web/servlet-nameservlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-classinit-paramparam-namecontextConfigLocation/param-nameparam-valueclasspath:spring/springmvc.xml/param-value/init-param/servlet!-- 1. /* 拦截所有 jsp js png .css 真的全拦截 建议不使用2. *.action *.do 拦截以do action 结尾的请求 肯定能使用 ERP 3. / 拦截所有 不包括jsp) (包含.js .png.css) 强烈建议使用 前台 面向消费者 www.jd.com/search /对静态资源放行--servlet-mappingservlet-namespringmvc-web/servlet-name!-- 配置所有以action结尾的请求进入SpringMVC --url-pattern*.action/url-pattern/servlet-mapping/web-app加入jsp页面 itemList.jsp % page languagejava contentTypetext/html; charsetUTF-8pageEncodingUTF-8% % taglib urihttp://java.sun.com/jsp/jstl/core prefixc % % taglib urihttp://java.sun.com/jsp/jstl/fmt prefixfmt% !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetUTF-8 title查询商品列表/title /head body form action${pageContext.request.contextPath }/item/queryitem.action methodpost 查询条件 table width100% border1 tr tdinput typesubmit value查询//td /tr /table 商品列表 table width100% border1 trtd商品名称/tdtd商品价格/tdtd生产日期/tdtd商品描述/tdtd操作/td /tr c:forEach items${itemList } varitem trtd${item.name }/tdtd${item.price }/tdtdfmt:formatDate value${item.createtime} patternyyyy-MM-dd HH:mm:ss//tdtd${item.detail }/tdtda href${pageContext.request.contextPath }/itemEdit.action?id${item.id}修改/a/td/tr /c:forEach/table /form /body/html itemEdit.jsp % page languagejava contentTypetext/html; charsetUTF-8pageEncodingUTF-8% % taglib urihttp://java.sun.com/jsp/jstl/core prefixc % % taglib urihttp://java.sun.com/jsp/jstl/fmt prefixfmt% !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd html head meta http-equivContent-Type contenttext/html; charsetUTF-8 title修改商品信息/title/head body !-- 上传图片是需要指定属性 enctypemultipart/form-data --!-- form iditemForm action methodpost enctypemultipart/form-data --form iditemForm action${pageContext.request.contextPath }/updateitem.action methodpostinput typehidden nameitems.id value${item.id } / 修改商品信息table width100% border1trtd商品名称/tdtdinput typetext nameitems.name value${item.name } //td/trtrtd商品价格/tdtdinput typetext nameitems.price value${item.price } //td/trtrtd商品生产日期/tdtdinput typetext nameitems.createtimevaluefmt:formatDate value${item.createtime} patternyyyy-MM-dd HH:mm:ss/ //td/tr%-- trtd商品图片/tdtdc:if test${item.pic !null}img src/pic/${item.pic} width100 height100/br//c:ifinput typefile namepictureFile/ /td/tr--%trtd商品简介/tdtdtextarea rows3 cols30 nameitems.detail${item.detail }/textarea/td/trtrtd colspan2 aligncenterinput typesubmit value提交 //td/tr/table/form /body/html
http://www.huolong8.cn/news/279901/

相关文章:

  • 游戏门户网站建设wordpress解析完403
  • 邯郸市建设局查中级职称网站网站通栏图片代码
  • iis提示网站建设中网站建设1
  • 怎么做打码网站阿里云空间如何装wordpress
  • 网站建设程序有哪些内容网站备案需要钱吗
  • 手机网站开发环境搭建山东企业展厅设计公司
  • 亿赐客网站云南省建设厅网站处长
  • 宁波做网站gs软件开发主要工作内容
  • 成都做网站开发的公司接了做网站的单子流程
  • 做网站和网页有什么区别北京seo服务行者
  • 重庆门户网站推广方案北京王府井集团股份有限公司
  • 家具网站开发设计论文一级水蜜桃
  • 太原网站建设推广公司推荐成都网站建设技术外包
  • 自动生成效果图的软件网站seo分析工具
  • 怎么做网站的步骤成都的做网站公司
  • 黄龙云 加强网站建设卧龙区网站建设价格
  • 知名广州网站建设qq电脑版
  • 最新采购求购信息网站wordpress 获取文章第一张图片
  • 做单挣钱的网站芭嘞seo
  • 上海网站建设技术做网站营销发布文章
  • 东营做网站优化多少钱wordpress 电子商务
  • 企业网站推广方案设计毕业设计邯郸网站设计报价
  • 揭阳中小企业网站制作建筑八大员证书怎么查询
  • 做区域链的网站做网站端口映射
  • 电子商务网站建设成果ppy酒生产企业网站建设的目的
  • 徐州城乡建设局网站中国建设网官方网站平台
  • php企业公司网站源码魔艺极速建站
  • 做公司网站成本媒体公关公司
  • 网站建设目的及意义网站是做排行榜
  • 郑州企业自助建站wordpress集成到app