struts+dao+hibernate的问题
这是我的UserinfoDAOImpl.java
public List QueryAll() throws Exception {
//查询全部
List all=null;
String hql="from Userinfo as u";
Query q=this.session.createQuery(hql);
all=q.list();
return all;
}
这是我的ACTION:
public class UserinfoAction extends DispatchAction {
public ActionForward selectall(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
try {
request.setAttribute("all", DAOFactory.getUserinfoInstance().QueryAll());
}catch (Exception e) {
}
return mapping.findForward("list");
}
}
这是我的DAO:
//查询全部
public List QueryAll()throws Exception;
请问ACTION里怎么样子写才能在页面上输出这样啊:
<logic:iterate id="userinfo" name="all">
<tr>
<td><bean:write name="userinfo" property="username"></bean:write></td>
<td><bean:write name="userinfo" property="realname"></bean:write></td>
<td><bean:write name="userinfo" property="roleid"></bean:write></td>
<td><bean:write name="userinfo" property="departmentid"></bean:write></td>
<td><bean:write name="userinfo" property="usertype"></bean:write></td>
<td><bean:write name="userinfo" property="mphone"></bean:write></td>
<td align="center"><a href="../user/add_user.jsp?uid=${user.userid }">详细</a></td>
</tr>