怎样在JSP页面上显示HQL查询结果
lookareaDaoImpl.java代码publicclasslookareaActionextendsDispatchAction{lookareaBizbiz=n...
lookareaDaoImpl.java代码
public class lookareaAction extends DispatchAction {
lookareaBiz biz=new lookareaBizImpl();
public ActionForward dolookArea(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try{
String servtype=request.getParameter("type");
List look=biz.lookarea(servtype);
request.setAttribute("lookarea",look);
return mapping.findForward("lookarea");
}catch(Exception e){
return mapping.findForward("index.jsp");
}
}
}
怎么样子在JSP页面上显示出我这查询的结果?麻烦各位高手知道下,小弟感激不尽
上面只有lookareaAction的代码,漏了lookareaDaoImpl.java代码,在这里补充下。
public List lookarea(String type){
try {
queryString="select sps.id.areaname,count(*)from SpsUserservice as sps where status=0 and servicetype=? group by sps.id.areaname";
Query query=session.createQuery(queryString);
query.setParameter(0, type);
return query.list();
} catch (RuntimeException re) {
re.printStackTrace();
throw re;
}
} 展开
public class lookareaAction extends DispatchAction {
lookareaBiz biz=new lookareaBizImpl();
public ActionForward dolookArea(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try{
String servtype=request.getParameter("type");
List look=biz.lookarea(servtype);
request.setAttribute("lookarea",look);
return mapping.findForward("lookarea");
}catch(Exception e){
return mapping.findForward("index.jsp");
}
}
}
怎么样子在JSP页面上显示出我这查询的结果?麻烦各位高手知道下,小弟感激不尽
上面只有lookareaAction的代码,漏了lookareaDaoImpl.java代码,在这里补充下。
public List lookarea(String type){
try {
queryString="select sps.id.areaname,count(*)from SpsUserservice as sps where status=0 and servicetype=? group by sps.id.areaname";
Query query=session.createQuery(queryString);
query.setParameter(0, type);
return query.list();
} catch (RuntimeException re) {
re.printStackTrace();
throw re;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询