摘要: 一、创建ssm项目ssm: spring4.3+spring4.3+mybatis3.2ssh: spring+struts2+hibernate 1.spring环境 a.添加spring环境 b.准备spring配置文件(引入注解驱动和组件扫描范围) c.web.xml中,上下文参数指定spri 阅读全文
posted @ 2020-07-28 20:52 IT搬砖者 阅读(103) 评论(0) 推荐(0) 编辑
摘要: mvc处理乱码:①public String isreg(User u,HttpServletRequest request)②String name = u.getname(); String str = new String(name.getBytes("iso-8859-1"),"utf-8" 阅读全文
posted @ 2020-07-28 20:50 IT搬砖者 阅读(111) 评论(0) 推荐(0) 编辑
摘要: spring在创建对象之后,为对象注入值的时候,三种注入方式: 1.getter/setter注入 a.类中的属性,必须有getter/setter方法; b.在bean中,通过property来完成对响应属性的注入; 在注入时,如果注入的单个值,就是用value,其他(比如对象)就使用ref 2. 阅读全文
posted @ 2020-07-28 20:44 IT搬砖者 阅读(2217) 评论(0) 推荐(0) 编辑
摘要: 1.在jsp阶段,web.xml中,提供了error-page的写法,当发生指定异常的时候,指定跳转页面: <error-page> <error-code>500</error-code> <location>/error.jsp</location> </error-page> <error-p 阅读全文
posted @ 2020-07-28 20:38 IT搬砖者 阅读(118) 评论(0) 推荐(0) 编辑
摘要: spring的事务: 分为编程式事务和申明式事务两种 这里推荐使用申明式事务 申明式事务的实现,有两种:配置文件配置的方式;注解 配置文件方式处理事务: 1.准备事务管理对象; 2.制定事务管理规则 3.指定规则应用的范围; 事务管理对象 <bean id="transactionManager" 阅读全文
posted @ 2020-07-28 20:33 IT搬砖者 阅读(280) 评论(0) 推荐(0) 编辑