日期:2014-05-19 浏览次数:20861 次
<td width="73" height="30" bgcolor="F9F9F9">用户名</td> <td width="288" height="30" align="left" bgcolor="#FFFFFF"><s:textfield name="account"/><s:fielderror><s:param [color=#FF0000]value="%{'account'}"[/color]/></s:fielderror></td>
public String addUserInfo() { objectDao = new ObjectDao<UserInfo>(); boolean flag = objectDao.saveT(userInfo); …… return "operationUser"; }
[code=Java]public boolean saveT(T t) { Session session = sessionFactory.openSession();//开启Session try { tx = session.beginTransaction();//开启事务 session.save(t);//执行数据添加操作 tx.commit();//事务提交 } catch (Exception e) { e.printStackTrace(); return false; } finally { session.close();//关闭Session } return true; }