You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "C.F. Scheidecker Antunes" <na...@antunes.eti.br> on 2005/08/25 08:26:12 UTC

Questions about RowSetDynaClass

Hello all,

I would like to ask a few questions about RowSetDynaClass.

I can successfully set up one in a DAO class and include it in the 
request scope of an action class to forward to a JSP.

The problem is with the JSP.

Problem number one:
- If the bean is null or empty I have an error, that is if the database 
does not return anything. So is there a way to check if it is null or empty
before iterating so that I have no errors? Further, if the bean is not 
in the request scope I also have an error saying that the bean was not 
defined. How can I avoid this error? That is check to see if there is a 
rowSet bean before using it in the JSP?

Problem number two:
- The following code iterates the entire cols set and write all the 
columns from that row:
<logic:iterate id="row" name="rowSet" property="rows>
<tr>
  <logic:iterate id="col" name="cols">
  <td>
  <bean:write name="row" property="<%=((DynaProperty)col).getName()%>"/>
  </td>
</tr>
</logic:html>

OK, the second iterate writes as many <td></td> as the number of columns 
for that row. However I wanted to do that for each and every column as I 
need to add links to a few. Hence, shall I strip the inner most iterate 
and have <td></td> for each column? How can I get an
specific column name? Shall I pass that to .getName() function so that 
.getName("column1") ?
How does it work?

Thanks,

C.F.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org