You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bjorn T Johansen <bt...@havleik.no> on 2003/06/23 05:51:50 UTC

Dynamic number of properties in an ActionForm?

I have a little question. How do I setup a page with a form where I
don't know the number of properties in the form at design time? I have a
table of rows with a known number of columns but I don't know the number
of rows at design time, so how do I implement this using an ActionForm?
I need to read back the values also, not only display them...


Regards,

BTJ


-----------------------------------------------------------------------------------------------
Bjørn T Johansen (BSc,MNIF)
Executive Manager
btj@havleik.no                  Havleik Consulting
Phone : +47 67 54 15 17         Conradisvei 4
Fax : +47 67 54 13 91           N-1338 Sandvika
Cellular : +47 926 93 298       http://www.havleik.no
-----------------------------------------------------------------------------------------------
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."
-----------------------------------------------------------------------------------------------


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


Re: Dynamic number of properties in an ActionForm?

Posted by FrenzyGNX <xu...@yahoo.com.sg>.
You can use a Collection or array to hold the data and
use <logic:iterate> or <c:forEach> tags to interate
through the collection and display the items.

You can use a Map backed form to send back the values.

 --- Bjorn T Johansen <bt...@havleik.no> wrote: > I have
a little question. How do I setup a page with
> a form where I
> don't know the number of properties in the form at
> design time? I have a
> table of rows with a known number of columns but I
> don't know the number
> of rows at design time, so how do I implement this
> using an ActionForm?
> I need to read back the values also, not only
> display them...
> 
> 
> Regards,
> 
> BTJ
> 
> 
>
-----------------------------------------------------------------------------------------------
> Bjørn T Johansen (BSc,MNIF)
> Executive Manager
> btj@havleik.no                  Havleik Consulting
> Phone : +47 67 54 15 17         Conradisvei 4
> Fax : +47 67 54 13 91           N-1338 Sandvika
> Cellular : +47 926 93 298      
> http://www.havleik.no
>
-----------------------------------------------------------------------------------------------
> "The stickers on the side of the box said "Supported
> Platforms: Windows
> 98, Windows NT 4.0,
> Windows 2000 or better", so clearly Linux was a
> supported platform."
>
-----------------------------------------------------------------------------------------------
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>  

__________________________________________________
Do You Yahoo!?
Send free SMS from your PC!
http://sg.sms.yahoo.com

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


RE: Dynamic number of properties in an ActionForm?

Posted by Andrew Hill <an...@gridnode.com>.
The 'simple' way involves using properties that take an array
If your columns are foo, bar, etc... you could have:
setFoo(String[] foo)
setBar(String[] bar)

but... a *better* way would probably be to leverage the power of nested
action forms - where you have a property on your form whose value is a
collection of (nested) forms - each of which has the data for one row of the
table.

For a full tutorial check out the KeyboardMonkey site:
http://www.keyboardmonkey.com/next/index.jsp

-----Original Message-----
From: Bjorn T Johansen [mailto:btj@havleik.no]
Sent: Monday, 23 June 2003 11:52
To: struts-user@jakarta.apache.org
Subject: Dynamic number of properties in an ActionForm?


I have a little question. How do I setup a page with a form where I
don't know the number of properties in the form at design time? I have a
table of rows with a known number of columns but I don't know the number
of rows at design time, so how do I implement this using an ActionForm?
I need to read back the values also, not only display them...


Regards,

BTJ


----------------------------------------------------------------------------
-------------------
Bjørn T Johansen (BSc,MNIF)
Executive Manager
btj@havleik.no                  Havleik Consulting
Phone : +47 67 54 15 17         Conradisvei 4
Fax : +47 67 54 13 91           N-1338 Sandvika
Cellular : +47 926 93 298       http://www.havleik.no
----------------------------------------------------------------------------
-------------------
"The stickers on the side of the box said "Supported Platforms: Windows
98, Windows NT 4.0,
Windows 2000 or better", so clearly Linux was a supported platform."
----------------------------------------------------------------------------
-------------------


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


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