ITeye博客

X_boy的博客

X_boy · 共 12 篇文章

struts2整合spring3

http://hi.baidu.com/kongfufattie/blog/item/dcc03e1d8d0fcdff1bd57641.html

2011-10-04 02:04 · J2EE · 评论(0)

hibernate3 简单的 CRUD 示例

CRUD是指在做计算处理时增加、查询、更新和删除几个单词的首字母简写。主要被用在描述软件系统中数据库或者持久层的基本操作功能。下面示例演示了如何创建session实例,并使用session的相关方法,实现对数据库表记录的添加。修改。删除和查找。 1、 首先登录MySQL数据库,建立表box,SQL语句如下: create table box( id int(11) not null auto_increment, width float default null, length float default null, height float default null, name varch…

2011-10-04 01:37 · J2EE · 评论(0)

struts2+spring3+hibernate3整合

网上看了很多例子,ssh整合都没有往数据库中插入记录,比如像注册这样的例子。刚接触ssh整合,写得不好。我用的是eclipse for j2ee,先上图看看整体架构 1、LoginAction.java package action; import impl.MyServiceImpl; import com.opensymphony.xwork2.Action; import model.User; public class LoginAction implements Action{ private User user; private MyServiceImpl ms; private…

2011-10-04 00:56 · J2EE · 评论(0)

在jsp页面中显示action中的setter的值

Action: // 属性 private List<Bean> lst; lst属性对应有get/set方法。 Bean: // 属性 private String id; private String name; id和name属性有get/set方法。 Jsp: <table> <s:iterator value="lst"> <tr> <td><s:property value="id" /></td> <td><s:property value="name" /></td> </tr> </s:iterator> <table>

2011-10-02 17:24 · J2EE · 评论(0)

spring3整合hibernate3

1、bean.xml文件 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" va…

2011-10-01 23:19 · J2EE · 评论(0)

struts2 包和命名空间

Struts2 框架中核心组件就是Action、拦截器等,Struts2框架使用包来管理Action和拦截器等 。每个包就是多个Action、多个拦截器、多个拦截器引用的集合。 配置<package.../>元素时必须指定name属性,这个属性是引用该包的唯一标识。除此之外,还可以指定一个可选的extends属性,extends属性值必须是另一个包的name属性。 在struts.xml文件中,<package.../>元素用于定义包配置,每个<package.../>元素定义了一个包配置。定义<package.../>元素时可以指定如下几个属性。 name:这是一个必需属性,该属性指定该包…

2011-09-20 19:41 · J2EE · 评论(0)

Struts 2 + Spring的3 + Hibernate的整合笔记

http://www.psjay.com/struts-2-spring-3-hibernate-integration-notes.html

2011-09-17 14:33 · J2EE · 评论(0)

spring3.0 为Bean实例的属性指定值

由于JAVA实例的属性值可以是各种数据类型,除了基本类型值、字符串类型值等,还可以是其他Java实例,也可以是容器中其他Bean实例,甚至是Java集合、数组等,所以spring允许通过如下元素为Bean实例的属性指定值: value ref bean list、set、map及props 1:设置普通属性值 <value.../>元素用于指定字符串类型、基本类型的属性值。 2:配置合作者Bean 如果需要为Bean设置的属性值是容器中的另一个Bean实例,则应该使用<ref.../>元素。使用<ref.../>元素时可指定如下两个属性: bean:引用不在同一份XML配置文件中的其他Bea…

2011-09-16 14:56 · J2EE · 评论(0)

spring3.0 配置依赖

根据注入的方式不同,Bean的依赖注入通常表现为如下两种形式: 1.属性:通过<property.../>元素配置,对应设值注入。 注:使用设值注入必须有setter方法 2.构造器参数:通过<constructor-arg.../>元素指定,对应构造注入。

2011-09-16 14:38 · J2EE · 评论(0)

spring3.0配置

Spring3.0最基本配置需要一下几个包 org.springframework.asm-3.0.2.RELEASE.jar org.springframework.beans-3.0.2.RELEASE.jar org.springframework.context-3.0.2.RELEASE.jar org.springframework.core-3.0.2.RELEASE.jar org.springframework.expression-3.0.2.RELEASE.jar org.springframework.web-3.0.2.RELEASE.jar commons-log…

2011-09-15 23:44 · J2EE · 评论(0)

struts2中jsp页面表单提交到action中文乱码问题

struts2中默认提交的格式是UTF-8格式的,故需要把中文字符转码后才能正常显示,解决方法: 直接在struts.xml文件中<struts> 标签内部添加一句如下代码: <constant name="struts.i18n.encoding" value="gbk" /> 注意:如果你jsp页面中使用的是utf-8格式,那么此处也写成utf-8格式。

2011-09-14 16:17 · J2EE · 评论(0)

MySql数据库插入数据出现中文乱码的解决方法

1、JSP向MySql数据库插入数据出现中文乱码的解决方法 jdbc:mysql://localhost:3306/dbname?useUnicode=true&characterEncoding= utf-8 在连接数据库的url 后面加上参数 2、hibernate3向MySql数据库插入数据出现中文乱码的解决方法 <session-factory> <property name="connection.url">jdbc:mysql://localhost:3306/hibernate</property> <property name="connection.useUnicode">…

2011-09-14 16:15 · J2EE · 评论(0)