if this works, it will take care of writing the table to the jsp but i need an html input type of field so i can also set the properties of the ActionForm by editing the fields and submiting the form.
----- Original Message ----- From: "Cedric Levieux" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>; "Hubert Rabago" <[EMAIL PROTECTED]>
Sent: Tuesday, January 25, 2005 3:36 PM
Subject: Re: A table on a form from a List of Lists



Hi,

There is a way :

<table>
<logic:iterate id="row" name="myForm" proprties="listOfRows">
   <tr>
   <logic:iterate id="myField" name="row" proprties="listOfFields">
       <td>
           <bean:write name="myField"/>
       </td>
   </logic:iterate>
   </tr>
</logic:iterate>
</table>

Regards,

Cedric

----- Original Message ----- From: "Olasoji Ajayi" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>; "Hubert Rabago"
<[EMAIL PROTECTED]>
Sent: Tuesday, January 25, 2005 3:25 PM
Subject: Re: A table on a form from a List of Lists



the method did not work, i think its because the nested tags deal with
beans
nested in beans but this deals with lists in a list in a bean (like a 2
dimensional array), i was hoping if i code the property like
property[row][col], if will call my getter method String getProperty(int
row, int col) since it calls String getProperty(int index) for property
specified as property[index].
all the methods i have used either comes up with the erron no gettter
method
for this or that or null attribute.

i am begining to think there is no way to get/set a two dimentional array
type of data in a form bean other than to make the property also beans.

i would really appreciate any help because i want to keep my property as a
list of lists. the form bean is like:


public class myBean extends ActionForm{
  private List table = new ArrayList();
/// other propeties that are of type string

public List getTable(){
  return table;
}

public List getRow(int row){
  return (List)table.get(row);
}

public String getField(int row, int col){
  return (String)((List)table.get(row)).get(col);
}

//// and corresponding setter methods

i wrote the acessor methods this way so i can specify different property
to
get different componentof the bean's property.

the problem i have is how to code a jsp to call the getter/setter methods

with two int arguments, i dont know very much about the bean
specification.
can anyone tell me how to code my jsp or ActionForm to get the third
accessor methods called, to populate an html:text or set the ActionForm
property from html:text



----- Original Message ----- From: "Hubert Rabago" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Monday, January 24, 2005 4:18 PM
Subject: Re: A table on a form from a List of Lists



> Take a look at the nested tags. > In your case, your code may end up looking like: > > <nested:form action="/myAction"> > <table> > <nested:iterate property="listOfRows"> > <tr> > <nested:iterate property="listOfFields"> > <td> > <nested:text property="myField"> > </td> > </nested:iterate> > <tr/> > </nested:iterate> > </table> > </nested:form> > > Hubert > > On Mon, 24 Jan 2005 10:31:59 +0100, Olasoji Ajayi
<[EMAIL PROTECTED]>
> wrote:
>> Hi,
>> i have been trying to create a table on my form from a single property
in
>> my actionForm. the property is a List (actually an ArrayList) containg
>> the rows of the table, each element (i.e row on the table) is
represented
>> by a List of Strings representing the fields of the list. i can code >> my
>> JSP page to display the contents of the proprety in a table but i cant
>> get it to set the values of the property from the page on submit. all
the
>> efforts has failed, i my latest effort, i coded the property as
>> property[row][col] but i get an error that dia is no getter method for
>> property[0][0]. i wrote the access methods like
>> String getProperty(int row, int col){
>> return  (String)((List)property.get(row)).get(col);
>> }
>>
>> it did not work, any ideas will be apreciated.
>>
>
> ---------------------------------------------------------------------
> 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]



---------------------------------------------------------------------
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