You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Heligon Sandra <sa...@thomson.net> on 2003/03/18 16:54:51 UTC

RE: [displaytag-user] Problem to display Collection with Display tag

I undoubtedly badly expressed myself, I am sorry but I am French and I have
sometimes evil to express myself in English. 
I do not have a list of DynaValidatorForm, I want use a DynaActionForm 
which must allow to display a collection (of objects) in a JSP. 
The JSP will be a table with several rows and columns.
I always try to hopelessly post a collection of objects with the tag
display. 
But unfortunately that still does not go even with the last version of the
file.
 
If somebody has a idea thank you a lot in advance.

Struts-config.xml:

<form-bean name="callForm" dynamic="true"
type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="calls" type="java.util.Collection" />
</form-bean>

In the PopulateAction:

Collection callslist = new ArrayList(); 
CallBean call1 = new CallBean(1,"toto","France")
callslist.add( call1); 

CallBean call2 = new CallBean(2,"tata","France")
callslist.add( call2); 

BeanUtils.copyProperties(form,callslist);

In the JSP page:

<display:table border="0" pagesize="3" cellspacing="0" cellpadding="0"
name="callForm" property="calls" scope="session">
  <display:column property="id" title="ID" />
  <display:column property="service" title="Service"/>
</display:table>

When I run the application I have the new error:

I do not know how to iterate over 'class java.lang.String'.' 

it is probably a problem of conversion, with BeanUtils.copyProperties  
isn't it.

I tried to create a sub-class of DynaValidatorForm with a property
private ArrayList calls.
But when I debug the application the form parameter is null 
in the method
executeAction(ActionMapping mapping, ActionForm form, HttpServletRequest
request, HttpServletResponse response).

What must I do ?


----------------------------------------------------------------------------

As of February 12th, 2003 Thomson unifies its email addresses on a worldwide
basis. 
Please note my new email address: sandra.heligon@thomson.net 

http://www.thomson.net/ 

----Original Message-----
From: Matt Raible [mailto:matt@raibledesigns.com]
Sent: 12 March 2003 15:29
To: displaytag-user@lists.sourceforge.net
Subject: RE: [displaytag-user] Problem to display Collection with
Display tag


I simply mean to say the display tag library will not work with a collection
of DynaActionForms (you might want to enter a bug for it) similar to how
JSTL
will not work with a collection of DynaActionForms.  If you use a collection
of ActionForms, it will work fine.

Matt

> My interpretation of DynaActionForm with a collection of 
> object is perhaps not good either.         But does that mean that 
> to use <display:*> tag to display a collection of objects we have to 
> pass        the business collection to the JSP page ?         We can 
> not separate the view from the model implementation, isn't it ?
> 
> -----Original Message-----
> From: Matt Raible [mailto:matt@raibledesigns.com]
> Sent: 12 March 2003 13:13
> To: Heligon Sandra; displaytag-user@lists.sourceforge.net
> Subject: RE: [displaytag-user] Problem to display Collection with Display
> tag
> 
> I don't believe that the displaytag will work with an ArrayList of
> DynaActionForms.  Not yet anyway.
>  
> Matt
>