PRivate ActionForward executeManageAction(ActionMapping mapping, ActionForm form,
&nbs
p; HttpServletRequest request, HttpServletResponse response) {
UserForm userForm = (UserForm)form;
ArrayList userlist = new ArrayList();
SessionFactory sf= new
configuration().configure().buildSessionFactory();
Session session=sf.o
PEnSession();
Transaction tx=session.be
ginTransaction();
String
SQLQuery="
From User";
Query lQuery=session.createQuery(sqlQuery);
userlist=(ArrayList)lQuery.list();
tx
.COMm
IT();
session.close();
userForm.setUserlist(userlist);
return mapping.fin
DForward("m
ain_user");
}
private ArrayList userlist;
p
ublic ArrayList getUserlist(){
return userlist;
}
public void setUserlist(ArrayList userlist){
this.userlist=userlist;
}
<table id="id1" style="border-right: darkgreen 1px solid;border
-top:darkgreen 1px solid;border-left: darkgreen 1px solid;width:100%;
border-bottom;darkgreen 1px solid;border-collapse:collapse" borderColor="darkgreen" cellSpacing="0" border="1">
<
LOGic:notEmpty n
ame="userForm" property="userlist">
<tr nowrap="nowrap">
<td style="width:80px;h
eight:16px" nowrap><b>用户名</b></td>
<td style="width:80px;height:16px" nowrap><b>角色</b></td>
<td style="width:84px;height:16px" ><b>姓名</b></td>
<td style="width:88px;height:16px" ><b>
电话</b></td>
<td style="width:73px;height:16px" ><b>电子邮件</b></td>
<td style="width:273px;height:16px" ><b>动作</b></td>
</tr>
<logic:iterate indexId="index" id="user" name="userForm" property="userlist">
<tr>
<td noWrap style="width:80px" ><bean:write name="user" property="username"/></td>
<td noWrap style="width:80px" ><bean:write name="user" property="role"/></td>
<td noWrap style="width:80px" ><bean:write name="user" property="name"/></td>
<td noWrap style="width:80px" ><bean:write name="user" property="tel"/></td>
<td noWrap style="width:80px" ><bean:write name="user" property="email"/></td>
<td nowrap sryle="width:273px" >
<a
href="javascript:submitSid(document.fview,'<bean:write name="user" property="username"/>')">查看</a>
<font >||</font>
<a href="javascript:submitSid(document.fview,'<bean:write name="user" property="username"/>')">更新</a>
<font >||</font>
<a href="javascript:if (confirm('删除此用户么?')){ submitSid(document.fview,'<bean:write name="user" property="username"/>')}">删除</a>
</td></tr>
</logic:iterate>
</logic:notEmpty>
</table>
private ActionForward executeManageAction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
UserForm userForm = (UserForm)form;
ArrayList userlist = new ArrayList();
SessionFactory sf= new Configuration().configure().buildSessionFactory();
Session session=sf.openSession();
Transaction tx=session.beginTransaction();
String sqlQuery="f
rom User";
Query lQuery=session.createQuery(sqlQuery);
userlist=(ArrayList)lQuery.list();
tx.commit();
session.close();
request.
setattribute("userlist", userlist);
return mapping.findForward("main_user");
}