君子博学而日参省乎己 则知明而行无过矣

博客园 首页 新随笔 联系 订阅 管理
上一页 1 ··· 90 91 92 93 94 95 96 97 98 ··· 106 下一页

2012年3月8日 #

摘要: I have a very simple MySql table with an auto increament primary key,1CREATE TABLE sampah2(3id INT(10) NOT NULL AUTO_INCREMENT,4name VARCHAR(30),5PRIMARY KEY (id)6)my question is, how can i get my object’s generated primary key if i insert a new object to table “sampah”?The answer is actually quite 阅读全文
posted @ 2012-03-08 23:52 刺猬的温驯 阅读(297) 评论(0) 推荐(0) 编辑

摘要: One of the latest MyBatis feature is the ability to use Annotations or XML to do One-to-One or One-to-Many queries. Let’s start with an example, as usual im using PostgreSQL, Netbeans 6.9 and MyBatis 3.0.2.First is a simple database with 2 different tables,CREATE DATABASE test CREATE TABLE master .. 阅读全文
posted @ 2012-03-08 23:46 刺猬的温驯 阅读(948) 评论(0) 推荐(0) 编辑

2012年3月7日 #

摘要: In lastSpring auto-wiring in XMLexample, it will autowired the matched property of any bean in current Spring container. In most cases, you may need autowired property in a particular bean only.In Spring, you can use@Autowiredannotation to auto wire bean on the setter method, constructor or a field. 阅读全文
posted @ 2012-03-07 18:47 刺猬的温驯 阅读(451) 评论(0) 推荐(0) 编辑

摘要: packagecom.epeer.dao;publicinterfaceUserDao{publicvoidinsertUserIp(Stringstartip,Stringendip);}packagecom.epeer.dao;importjava.text.MessageFormat;importorg.springframework.jdbc.core.support.JdbcDaoSupport;publicclassUserDaoImplextendsJdbcDaoSupportimplementsUserDao{privatestaticfinalStringINSERT=&qu 阅读全文
posted @ 2012-03-07 18:11 刺猬的温驯 阅读(295) 评论(0) 推荐(0) 编辑

摘要: Spring applicationContext.xml的<context:component-scan>標籤用途比我想像的還要實用。而且後來才知道,有了<context:component-scan>,另一個<context:annotation-config/>標籤根本可以移除掉,因為被包含進去了。原本我survery Spring3通常只配置成<context:component-scan base-package="com.foo.bar"/>,意即在base-package下尋找有@Component和@Confi 阅读全文
posted @ 2012-03-07 17:18 刺猬的温驯 阅读(1641) 评论(0) 推荐(0) 编辑

摘要: 13.9.使用Spring的表单标签库 - Spring Framework reference 2.0.5 参考手册中文版13.9.使用Spring的表单标签库从2.0开始,Spring提供全面的,支持数据绑定的JSP标签来处理表单元素(如果你使用JSP和Spring的Web MVC框架的话)。 每个标签所支持的属性跟其对应的HTML标签相同,这样这些标签看起来就不陌生,而且很容易用。 由这些标签库生成的HTML页面符合HTML 4.01/XHTML 1.0标准。与其它的标签库不同,Spring的表单标签库和Spring Web MVC框架是集成在一起的,因此它们可以直接使用命令对象(com 阅读全文
posted @ 2012-03-07 17:16 刺猬的温驯 阅读(913) 评论(0) 推荐(0) 编辑

2012年3月6日 #

摘要: 在低版本的Spring中,你必须通过JSTL或<spring:bind>将表单对象绑定到HTML表单页面中,对于习惯了Struts表单标签的开发者来说,Spring MVC的这一表现确实让人失望。不过这一情况已经一去不复返了,从Spring 2.0开始,Spring MVC开始全面支持表单标签,通过Spring MVC表单标签,我们可以很容易地将控制器相关的表单对象绑定到HTML表单元素中。在上一篇文章《Spring MVC的表单控制器》中(http://tech.it168.com/j/2007-07-26/200707261434046.shtml)我们已经使用到了部分的Spr 阅读全文
posted @ 2012-03-06 02:07 刺猬的温驯 阅读(7414) 评论(0) 推荐(0) 编辑

摘要: spring mvc 是类似于 Struts 的框架。他们都有一个最主要的功能就是URL路由。URL路由能将请求与响应请求处理逻辑的类(在Struts中即是action,在spring mvc 中即是 controller )映射起来。抛开其他的功能,spring mvc 要比 Struts 在URL路由功能上灵活很多。比如要实现 RESTful,如果用 Struts ,需要安装 一些插件,而且插件也常常限制的很死。但是如果用 spring mvc ,那就驾轻就熟。下面具体看一下spring mvc在 spring 2.5 以后,可以利用注解写进行路由映射,简单,直观。配置 web.xmlXm 阅读全文
posted @ 2012-03-06 01:08 刺猬的温驯 阅读(1154) 评论(0) 推荐(1) 编辑

2012年3月4日 #

摘要: 【一】Spring应用Spring支持json格式的jarjackson-all-1.7.3http://jackson.codehaus.org/Spring MVC 3.x annotated controller的几点心得体会(最优化使用http://www.javaeye.com/topic/828513)一、callback回调template method(模板方法设计模式)-hibernateTemplate二、JPA2.0的配置src/META-INF/persistence.xmlwebContent/META-INF/context.xmlwebContent/WEB-IN 阅读全文
posted @ 2012-03-04 17:20 刺猬的温驯 阅读(1299) 评论(0) 推荐(0) 编辑

摘要: 1. 所需要Jar包.//Spring3.0.1包org.springframework.web-3.0.1 系列//公共包slf4j-api-1.5.6.jar slf4j-log4j12-1.5.6.jar log4j-1.2.13.jarcommons-logging-1.1.1.jar asm-3.1.jar cglib-2.2.jar//mybatis与Spring的整合所需的包mybatis-3.0.5.jar aopalliance-1.0.jar mybatis-spring-1.0.1.jarmybatis... 阅读全文
posted @ 2012-03-04 16:38 刺猬的温驯 阅读(15677) 评论(0) 推荐(0) 编辑

上一页 1 ··· 90 91 92 93 94 95 96 97 98 ··· 106 下一页