Never mind. It was fixed by using low caps property names for the bean.
Thanks.

C.F. Scheidecker Antunes wrote:

Hello all,

I've done it before, in one project it works perfectly in the other it doesn't so I was hoping I could get some help from you. This new project tries to create a Radiobutton table on the fly
using RowSetDynaClass

I have an action that calls a DAO which returns a RowSetDynaClass like this:

*public* ActionForward execute(
        ActionMapping mapping,
        ActionForm form,
        HttpServletRequest request,
        HttpServletResponse response) {
*DataSource* dataSource = *null*;
        *Connection* conn = *null*;
        RowSetDynaClass rowSet = *null*;
*try* {
            dataSource = getDataSource(request,"ds1");
            conn = dataSource.getConnection();
CategoryDAO dao = *new* CategoryDAO();
            *String* SQL = "SELECT catID,Title FROM tbl_catSimple";
            rowSet = dao.getUsersRowSet(dataSource,SQL);
            *if* (!rowSet.getRows().isEmpty()) {
                request.setAttribute("rowCatSet",rowSet);
            }
        } *catch* (*SQLException* sqle) {
            getServlet().log("Connection process ",sqle);
        } *catch* (*Exception* e) {
            getServlet().log("Exception ",e);
        } *finally* {
            *try* {
                *if* (conn != *null*) {
                    conn.close();
                }
            } *catch* (*SQLException* e) {
                getServlet().log("Connection close ",e);
            }
        }

        *if* (request.getSession().getAttribute("userid") != *null*) {
DynaActionForm catForm = (DynaActionForm) request.getSession().getAttribute("catForm");
            *if* (catForm.getString("cat_ID") != *null*) {
request.setAttribute("cat_ID",catForm.getString("cat_ID"));
            }
            *return* mapping.findForward("form");
        }
*return* mapping.findForward("error");
    }


The CategoryDao class has the following method which returns a RowSetDynaClass

* public* RowSetDynaClass getUsersRowSet(*DataSource* dataSource, *String* SQL) *throws* *Exception* { *Connection* conn = *null*;
        *ResultSet* rs           = *null*;
        *Statement* stm          = *null*;
        RowSetDynaClass rowSet = *null*;
*try* {
            conn = dataSource.getConnection();
            stm = conn.createStatement();
            rs = stm.executeQuery(SQL);
            rowSet = *new* RowSetDynaClass(rs);
        } *catch* (*SQLException* sqle) {
            ///getServlet().log("Connection process ",sqle);/
        } *finally* {
            *if* (conn != *null*) {
                    conn.close();
            }
        }
        *return* rowSet;
    }



The action works perfectly, the rowSet is saved on the request scope as rowCatSet and the findForward("form") is called which is my catform.jsp.

The JSP content is as follows:

*<%* *if* (request.getAttribute("rowCatSet") != *null*) { *%>*
<form method="post" action="category.do">
<table width="88%"  border="0">
*<bean:define* id="cols" name="rowCatSet" property="dynaProperties"*/>*

   <tr>
      *<logic:iterate* id="col" name="cols"*>*
      <th>*<bean:write* name="col" property="name"*/>*</th>
      *</logic:iterate>*
   </tr>
  *<logic:iterate* id="row" name="rowCatSet" property="rows"*>*      <tr>
<td width="6%" bgcolor="#FFFFCC"><input name="cat_ID" type="radio" value="*<bean:write* name="row" property="catID"*/>*"></td> <td bgcolor="#FFFFCC"><span class="style32">*<bean:write* name="row" property="Title"*/>*</span></td>
    </tr>
  *</logic:iterate>*   <tr>
<td bgcolor="#D5D5FF"><input name="cat_ID" type="radio" value="4"></td>
   <td bgcolor="#D5D5FF"><span class="style32">motorcycles</span></td>
 </tr>
</table>
</form>

*<%* } *%>

Please notice, that I first check to see if rowCatSet is null, since it is not I do the iteration.

However I get the following error: "No getter method for property catID of bean row"!
If I erase it I have the same error for the second property Title.
*

What is going on with this RowSetDynaClass? What have I done wrong? Why is that my row does not have a property named catID if it is specified on the SQL statement and does return correctly?

Thanks,

C.F.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to