刚查到了……是用List<>这样的吧……但是在JSP页面的时候,EL表达式又出错了 The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer. 这样选出来的id为什么类型啊?
这是个分页 String queryCountHql = "select t.id,t.name,b.num from producttype_t t left join ( select count(id) as num,type as type from product_t group by type ) b on b.type = t.id"; List<Producttype> data = getSession().createSQLQuery(queryCountHql) .setFirstResult(pageroffset) .setMaxResults(pageSize) .list(); //得到结果集 PageModel pm = new PageModel(); pm.setData(data);
The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer.
这样选出来的id为什么类型啊?
String queryCountHql = "select t.id,t.name,b.num from producttype_t t left join ( select count(id) as num,type as type from product_t group by type ) b on b.type = t.id";
List<Producttype> data = getSession().createSQLQuery(queryCountHql)
.setFirstResult(pageroffset)
.setMaxResults(pageSize)
.list();
//得到结果集
PageModel pm = new PageModel();
pm.setData(data);
<pg:item>
<tr <c:if test="${status.count%2 == 0 }">class="even"</c:if>
<c:if test="${status.count%2 == 1 }">class="odd"</c:if>>
<td>
${data.id }
</td>
<td>
<a href="<c:url value='/back/sysProductInfo.do?method=showProductInfoByType&id=${producttype.id }'/>">${producttype.name }</a>
</td>
<td>
${producttype.num }
</td>
<td>
<a href="<c:url value='/back/sysProducttype.do?method=forwardUpdate&id=${producttype.id }' />">编辑</a>
</td>
</tr>
</pg:item>
</c:forEach>