Hi Malik,
It seems a problem with your do Loop,
Try using this instead of do()..
while (rs.next()) {}
any how, calling DB directly through your action class is not a good
practice as I know..:p
Regards,
Mano
-----Original Message-----
From: Mallik [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 21, 2006 12:51 PM
To: [email protected]
Subject: RE: DynaValidatorForm help?
hi friend
i have no idea about resetting
this is my source code
please help me in finding worng..
Action Class
----------------------------------------------------------------------------
-
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception
{
DynaValidatorForm block = null;
try // try start
{
ds = getDataSource(request);
conn = ds.getConnection();
stmt = conn.createStatement();
String query = "SELECT UNIQUE B.BLOCKID AS BLOCKID,
B.SHORTDESCRIPTION AS
BLOCKSHORTDESCRIPTION, B.DESCRIPTION AS DESCRIPTION, B.ADDRESS AS LOCATION,
B.PHONE AS PHONENO, B.COLLEGEID AS COLLEGEID, C.SHORTDESCRIPTION AS
COLLEGESHORTDESCRIPTION FROM BLOCKS B, COLLEGES C ORDER BY
B.SHORTDESCRIPTION";
rs = stmt.executeQuery(query);
blocks = new ArrayList();
if(rs.next())
{
do
{
block = (DynaValidatorForm)form;
block.set("id",rs.getString("BLOCKID"));
block.set("shortDesc",rs.getString("BLOCKSHORTDESCRIPTION"));
block.set("desc",rs.getString("DESCRIPTION"));
block.set("location",rs.getString("LOCATION"));
block.set("phoneNo",rs.getString("PHONENO"));
block.set("collegeShortDesc",rs.getString("COLLEGESHORTDESCRIPTION"));
block.set("college",rs.getString("COLLEGEID"));
blocks.add(block);
}while(rs.next());
}else
{
return
mapping.findForward("noCollegeSetup");
}
}}catch(SQLException e)
{
e.printStackTrace();
return mapping.findForward("sqlException");
}catch(Exception e)
{
e.printStackTrace();
return mapping.findForward("exception");
}finally
{
if(conn!=null)
conn.close();
}
request.setAttribute("BLOCKS", blocks);
return mapping.findForward("continue");
}
----------------------------------------------------------------------------
-
this is my jsp
----------------------------------------------------------------------------
-
<logic:iterate id="blocks" name="BLOCKS">
<tr>
<td class="centersubheading1"><bean:write name="blocks"
property="shortDesc"/></td>
<td class="centersubheading1"><bean:write name="blocks"
property="location"/></td>
<td class="centersubheading1"><bean:write name="blocks"
property="phoneNo"/></td>
<td class="centersubheading1"><bean:write name="blocks"
property="collegeShortDesc"/></td>
<td class="centersubheading1"> 'blocksModify.do?id=<bean:write
name="blocks" property="id" '><bean:message key="label.modify"/> </td>
</tr>
</logic:iterate>
----------------------------------------------------------------------------
-
Hi,
Are you resetting the property correctly in your action class?
Using,
PropertyUtils.setSimpleProperty(form, "obj", List);?
Regards,
Mano
--
View this message in context:
http://www.nabble.com/DynaValidatorForm-help--tf2677169.html#a7466886
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
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]