public List findteachers(){
Session session=this.getHibernateTemplate().getSessionFactory() .openSession();
String queryString = "select username,count(id) from TXiaoc group by username order by count(id) desc";
Query a = session.createQuery(queryString);
List list = a.list();
session.close();
return list;
}查询返回的是 用户名和该用户出现的次数请问这返回的List怎么在JSP页面中显示出来?<%
List res = (List) request.getAttribute("teach");
%>
<%
for(int i=0;i<res.size();i++) {
XXXXXXXXXXXXXX
}
%>XXXXXXXx中的代码应该怎么写?
1、首先在Jsp页面中导入相关标签
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>2、然后在页面中用标签c:foreach遍历即可,类似
<table class="table table-bordered" style="font-family: 微软雅黑">注释:personList是后台传来的一个list,list中是Person对象,包含name、age、address三个属性。