You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mallik <ma...@yahoo.com> on 2006/11/21 07:28:22 UTC

DynaValidatorForm help?

Hi friends 
first of all thanks for your great help

situation is:
i have to setup some details and display those details
for the setup service, i use DynaValidatorForm. it is working well for
validations also.
i want to use the same DyanActionForm for view also but 

problem  is:
if i use DynaValidatotForm for displaying the data, i am getting last record
only as many times as  i got for "select count(*) from blocks".
but if i use System.out.println() in action class over that ArrayList in
loop, i am getting correctly.

if i code ActionForm for those fields, i am getting correctly.

why this ?
cann't i use DynaActionForm for both setup and Viewing details
help me please...

ur's
Mallik
-- 
View this message in context: http://www.nabble.com/DynaValidatorForm-help--tf2677169.html#a7466483
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: DynaValidatorForm help?

Posted by Mallik <ma...@yahoo.com>.
HI friends 
this is my code
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"></td> 
                                                                               
</tr> 
                                                                       
</logic:iterate> 
---------------------------------------------------------------------------------------------------

help me please

ur's
Mallik

-- 
View this message in context: http://www.nabble.com/DynaValidatorForm-help--tf2677169.html#a7467107
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: DynaValidatorForm help?

Posted by Nuwan Chandrasoma <my...@gmail.com>.
Hi,

Can i see the you jsp code, are you iterateing the list propertly

Thanks,

Nuwan
----- Original Message ----- 
From: "Mallik" <ma...@yahoo.com>
To: <us...@struts.apache.org>
Sent: Tuesday, November 21, 2006 6:28 AM
Subject: DynaValidatorForm help?


>
> Hi friends
> first of all thanks for your great help
>
> situation is:
> i have to setup some details and display those details
> for the setup service, i use DynaValidatorForm. it is working well for
> validations also.
> i want to use the same DyanActionForm for view also but
>
> problem  is:
> if i use DynaValidatotForm for displaying the data, i am getting last 
> record
> only as many times as  i got for "select count(*) from blocks".
> but if i use System.out.println() in action class over that ArrayList in
> loop, i am getting correctly.
>
> if i code ActionForm for those fields, i am getting correctly.
>
> why this ?
> cann't i use DynaActionForm for both setup and Viewing details
> help me please...
>
> ur's
> Mallik
> -- 
> View this message in context: 
> http://www.nabble.com/DynaValidatorForm-help--tf2677169.html#a7466483
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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


Re: DynaValidatorForm help?

Posted by Nuwan Chandrasoma <my...@gmail.com>.
Hi,

DTO's.. its nothing much.. just create a POJO's with what ever attribuetes 
you want to have.
for eg:

class Block {
     private String blockNo;
     private String location;

    // public setter and getter method.
}

In you action class.. you populate each of these objects for the each row 
you get from the DB. and add this bean to a list, so you get a list of 
objects you want to display in page.., then add this list to the request and 
in the jsp just iterate and display

eg:

<logic:iterate id="block" name="blocks" type="com.mycomapny.dpo.Block">
<bean:write name="block" property="blockNo"/>
</logic:iterate>

Thanks & Regards,

Nuwan

----- Original Message ----- 
From: "Mallik" <ma...@yahoo.com>
To: <us...@struts.apache.org>
Sent: Tuesday, November 21, 2006 10:38 AM
Subject: Re: DynaValidatorForm help?


>
> 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" <ma...@yahoo.com>
>> To: <us...@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: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
> -- 
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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


Re: DynaValidatorForm help?

Posted by Mallik <ma...@yahoo.com>.
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" <ma...@yahoo.com>
> To: <us...@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: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: DynaValidatorForm help?

Posted by Nuwan Chandrasoma <my...@gmail.com>.
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" <ma...@yahoo.com>
To: <us...@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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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


RE: DynaValidatorForm help?

Posted by Mano Chinthaka Dasanayaka <ma...@mubasher.net>.
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:malli345@yahoo.com] 
Sent: Tuesday, November 21, 2006 12:51 PM
To: user@struts.apache.org
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org





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


RE: DynaValidatorForm help?

Posted by Mallik <ma...@yahoo.com>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: DynaValidatorForm help?

Posted by Mano Chinthaka Dasanayaka <ma...@mubasher.net>.
Hi,
Are you resetting the property correctly in your action class?
Using,
PropertyUtils.setSimpleProperty(form, "obj", List);?

Regards,
Mano

-----Original Message-----
From: Mallik [mailto:malli345@yahoo.com] 
Sent: Tuesday, November 21, 2006 11:58 AM
To: user@struts.apache.org
Subject: DynaValidatorForm help?


Hi friends 
first of all thanks for your great help

situation is:
i have to setup some details and display those details
for the setup service, i use DynaValidatorForm. it is working well for
validations also.
i want to use the same DyanActionForm for view also but 

problem  is:
if i use DynaValidatotForm for displaying the data, i am getting last record
only as many times as  i got for "select count(*) from blocks".
but if i use System.out.println() in action class over that ArrayList in
loop, i am getting correctly.

if i code ActionForm for those fields, i am getting correctly.

why this ?
cann't i use DynaActionForm for both setup and Viewing details
help me please...

ur's
Mallik
-- 
View this message in context:
http://www.nabble.com/DynaValidatorForm-help--tf2677169.html#a7466483
Sent from the Struts - User mailing list archive at Nabble.com.


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





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