日期:2014-05-20  浏览次数:20698 次

Hibrnate sql语句页面取值问题!!!!
String sql = "select * from account a ,department b where a.id=b.id";
Query query = getSession().createSQLQuery(sql); 
List li = query.list();  
request.setAttribute("obj",li); 


页面上这样取的
<c:choose>
<c:when test="${obj!=null}"> 
<c:forEach items="${obj}" var="accou">
<tr class=datagrid_itemstyle_normal align=middle
nowrap="nowrap">
<td height="27" valign="top" >
  ${accou[0]}  
</td>  
<td height="27" valign="top" > 
</td>  
<td height="27" valign="top" > 
   
</td>  
<td height="27" valign="top" > 
   
</td>  
</tr>  
</c:forEach>  
</c:when> 
<c:otherwise> 
<%
response.sendRedirect(request.getContextPath()
+ "/views.do?method=all_acount");
%>
</c:otherwise>
</c:choose>


这样取是可以 但要 ${accou[到N个数了]} 请问如何修改一下 我要什么取什么,要详细点 最好能在我这个方法上改,谢谢了

------解决方案--------------------
MARK
------解决方案--------------------
up