Hi,
I am new to struts and JSP and am working on an application that accesses a database and returns multiple records as DTOs (class name "Annotation")into an ArrayList.
Within my Action class:
ArrayList resultList=new ArrayList();
resultList= dataAccessObject.getRecords(); // returns an ArrayList of Annotation" objects
The ArrayList is then placed as an attribute in the session object:
HttpSession session=request.getSession();
session.setAttribute("resultList",resultList);
I then access the ArrayList in the JSP page as:
<logic:iterate id="resultList" name="resultList" scope="session" type="search.Annotation" >
<td width="70"> <bean:write name="resultList" property="genome"/>(Chr <bean:write name="resultList" property="chromosome"/>) </td>
<td width="48"> <bean:write name="resultList" property="geneName"/></td>
<td width="120"> <bean:write name="resultList" property="productName"/> </td>
<td width="83"> <bean:write name="resultList" property="start"/></td>
<td width="50"> <bean:write name="resultList" property="stop"/></td> </tr>
</logic:iterate>
The above code works fine, however several hundred results can be returned and I would like to view/navigate around 20 of them at a time (similar to google results). I am familiar with the <html:iterate> tag's 'offset' and 'length' attibutes and am wondering what the best approach would be to dynamically set this value. I would be open to completely different approaches to solving this problem as well and appreciate any suggestions.
Thanks,
Geoff
I am new to struts and JSP and am working on an application that accesses a database and returns multiple records as DTOs (class name "Annotation")into an ArrayList.
Within my Action class:
ArrayList resultList=new ArrayList();
resultList= dataAccessObject.getRecords(); // returns an ArrayList of Annotation" objects
The ArrayList is then placed as an attribute in the session object:
HttpSession session=request.getSession();
session.setAttribute("resultList",resultList);
I then access the ArrayList in the JSP page as:
<logic:iterate id="resultList" name="resultList" scope="session" type="search.Annotation" >
<td width="70"> <bean:write name="resultList" property="genome"/>(Chr <bean:write name="resultList" property="chromosome"/>) </td>
<td width="48"> <bean:write name="resultList" property="geneName"/></td>
<td width="120"> <bean:write name="resultList" property="productName"/> </td>
<td width="83"> <bean:write name="resultList" property="start"/></td>
<td width="50"> <bean:write name="resultList" property="stop"/></td> </tr>
</logic:iterate>
The above code works fine, however several hundred results can be returned and I would like to view/navigate around 20 of them at a time (similar to google results). I am familiar with the <html:iterate> tag's 'offset' and 'length' attibutes and am wondering what the best approach would be to dynamically set this value. I would be open to completely different approaches to solving this problem as well and appreciate any suggestions.
Thanks,
Geoff