Hi friends i don't have idea about DTO can you give me some idea please ur's Mallik
nuwan chandrasoma-2 wrote: > > Hi, > > The loop is wrong, your are overwriteing the same form bean, and also what > i > would suggest is create a DTO for this and populate the DTO and add create > a > list of those DTO's, and set it to the from or request from there you can > get the list and can easily iterate this list > > Regards, > > Nuwan. > > ----- Original Message ----- > From: "Mallik" <[EMAIL PROTECTED]> > To: <user@struts.apache.org> > Sent: Tuesday, November 21, 2006 7:21 AM > 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] > > > -- View this message in context: http://www.nabble.com/DynaValidatorForm-help--tf2677169.html#a7469057 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]