1. 遇到 一个奇怪的查询方式和显示
servcie层是这样
public List<object[]> getobj(){ }
String hql="select a.id,a.name ,a.cont from a inner join b where .......";
list<obj[]> dd= xiaoServiceImpl.findByHql(hql,ids)
return dd;
dao底层是 这样的
public List finByHql(String hql ,Object...obj){ }
Query q = getSessionFactory().getCurrentSession().createQuery(hql);
if(objs!=null){
int index=0;
for(Object obj:objs){
q.setParameter(index, obj);
index++;
}
}
return q.list();
action层直接就是
this.getRe().setAtrrbute("object",xiaoImpl.getobj())
jsp层就是:
<c:if test="${obj!=null}">
<c:forEach var="ob" items="${obj}" varStatus="idx">
<tr style="text-align:center;">
<td>${idx.index+1 }</td>
<td>${ob[1]}</td>
<td>${ob[2]}</td>
<td>${ob[0]}</td>
</tr>
</c:forEach>
</c:if>