RE: Dynamic name to the text fields

2002-09-02 Thread MerrilG

you r right anoop. Ive faced this difficulty many times, when you have a 
table containing textfiled in a row which can be increased dynamically. 
The only solution i found was to have the number of rows in a hidden field 
and append the index to each textfield in a row and extract the data from 
the request parameters manually within the action class. I dont know 
whether you can change the setter and getter methods of a form bean at 
runtime.

Merrill




"Anoop" <[EMAIL PROTECTED]>
09/02/02 05:39 PM
Please respond to "Struts Users Mailing List"

 
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
        cc: 
    Subject:RE: Dynamic name to the text fields


But, the same case arrises here, as in defining number of beans. How will 
be
the number of beans be pre-defined??

-Anoop.

-Original Message-
From: Darryl Nortje [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 4:19 PM
To: 'Struts Users Mailing List'
Subject: RE: Dynamic name to the text fields


Anoop, I did it by iterating through a collection of beans, each bean in 
the
collection for eg had a getKey() and getValue() method then the jsp looks
like this.


   
  
 "/>
  
   


It's very simple but it works

cheers
Darryl

-Original Message-
From: Donald Ball [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 4:44 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Dynamic name to the text fields


On 8/30/2002 at 7:28 PM Anoop wrote:

>Hi All,
>
>I am a newbie to struts and taglibs, was trying to 
display text
fields
>dynamically using "html:iterator". Below is the scenario I was
>trying out.

You may be in luck, I've been recently trying to learn how to do something
similar myself.



>The html snippet for the above is something like:
>
>
>
>
>But I want it to be something like:
>
>
>
>
>Where the values("a" & "b") for the name attribute comes from an array
>defined in the Form Bean. What are the changes required in my jsp 
snippet?
>
>Also, if only it is possible to get an output as desired, does the
FormBean
>be modified to support this. As there won't be any getter/setter for "a"
>and
>"b".
>
>Appreciate any kind of help regarding this.

First, google around for "map-backed ActionForms" or similar. There's some
stuff over on jguru that might be helpful. Also, I'm trying to write
documentation for the struts user's guide for this, so I'd appreciate your
comments on how (un)clear the following is (apologies for the formatting,
my mail client sucks):


  The DynaActionForm classes offer the ability to create ActionForm
beans
 at initialization time, based on a list of properties enumerated in the
struts
configuration file. However, many HTML forms are generated dynamically at
request-time. Their ActionForm beans' properties are not all known ahead 
of
time, so we need a new approach.
  Struts allows you to make one (or more) of your ActionForm's
properties
' values a Map instead of a traditional atomic object. You can then store
your form's dynamic fields' data in that Map. Here is an example of a
map-backed ActionForm class:



  In its corresponding JSP page, you can access objects stored in
the values map using a special notation: mapname(keyname). The
parantheses in the bean property name serve to indicate that the bean
property named mapname should be a Map, and that struts should look
at the value stored with the key keyname in that Map to find the
"real" property for mapname(keyname).
  Here is a simple example:



  This will call the getValue() method on FooForm with a key value
of "foo" to find the property value. To create a form with dynamic field
names, you might do something like this:





Hope it helps, thanks in advance for any comments.

- donald


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>






RE: Dynamic name to the text fields

2002-09-02 Thread Darryl Nortje

Well, the way I did it was select from a table and in the while (rs.next())
loop build up the collection.

I don't know your particular scenario so can't help you there, other than to
say that you build up the collection as part of an action, or from a
database, depending on what you want to do at the end of the day

-Original Message-
From: Anoop [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 2:10 PM
To: 'Struts Users Mailing List'
Subject: RE: Dynamic name to the text fields


But, the same case arrises here, as in defining number of beans. How will be
the number of beans be pre-defined??

-Anoop.

-Original Message-
From: Darryl Nortje [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 4:19 PM
To: 'Struts Users Mailing List'
Subject: RE: Dynamic name to the text fields


Anoop, I did it by iterating through a collection of beans, each bean in the
collection for eg had a getKey() and getValue() method then the jsp looks
like this.


   
  
 "/>
  
   


It's very simple but it works

cheers
Darryl

-Original Message-
From: Donald Ball [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 4:44 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Dynamic name to the text fields


On 8/30/2002 at 7:28 PM Anoop wrote:

>Hi All,
>
>   I am a newbie to struts and taglibs, was trying to display text
fields
>dynamically using "html:iterator". Below is the scenario I was
>trying out.

You may be in luck, I've been recently trying to learn how to do something
similar myself.



>The html snippet for the above is something like:
>
>   
>   
>
>But I want it to be something like:
>
>   
>   
>
>Where the values("a" & "b") for the name attribute comes from an array
>defined in the Form Bean. What are the changes required in my jsp snippet?
>
>Also, if only it is possible to get an output as desired, does the
FormBean
>be modified to support this. As there won't be any getter/setter for "a"
>and
>"b".
>
>Appreciate any kind of help regarding this.

First, google around for "map-backed ActionForms" or similar. There's some
stuff over on jguru that might be helpful. Also, I'm trying to write
documentation for the struts user's guide for this, so I'd appreciate your
comments on how (un)clear the following is (apologies for the formatting,
my mail client sucks):


  The DynaActionForm classes offer the ability to create ActionForm
beans
 at initialization time, based on a list of properties enumerated in the
struts
configuration file. However, many HTML forms are generated dynamically at
request-time. Their ActionForm beans' properties are not all known ahead of
time, so we need a new approach.
  Struts allows you to make one (or more) of your ActionForm's
properties
' values a Map instead of a traditional atomic object. You can then store
your form's dynamic fields' data in that Map. Here is an example of a
map-backed ActionForm class:



  In its corresponding JSP page, you can access objects stored in
the values map using a special notation: mapname(keyname). The
parantheses in the bean property name serve to indicate that the bean
property named mapname should be a Map, and that struts should look
at the value stored with the key keyname in that Map to find the
"real" property for mapname(keyname).
  Here is a simple example:



  This will call the getValue() method on FooForm with a key value
of "foo" to find the property value. To create a form with dynamic field
names, you might do something like this:





Hope it helps, thanks in advance for any comments.

- donald


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Dynamic name to the text fields

2002-09-02 Thread Anoop

But, the same case arrises here, as in defining number of beans. How will be
the number of beans be pre-defined??

-Anoop.

-Original Message-
From: Darryl Nortje [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 4:19 PM
To: 'Struts Users Mailing List'
Subject: RE: Dynamic name to the text fields


Anoop, I did it by iterating through a collection of beans, each bean in the
collection for eg had a getKey() and getValue() method then the jsp looks
like this.


   
  
 "/>
  
   


It's very simple but it works

cheers
Darryl

-Original Message-
From: Donald Ball [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 4:44 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Dynamic name to the text fields


On 8/30/2002 at 7:28 PM Anoop wrote:

>Hi All,
>
>   I am a newbie to struts and taglibs, was trying to display text
fields
>dynamically using "html:iterator". Below is the scenario I was
>trying out.

You may be in luck, I've been recently trying to learn how to do something
similar myself.



>The html snippet for the above is something like:
>
>   
>   
>
>But I want it to be something like:
>
>   
>   
>
>Where the values("a" & "b") for the name attribute comes from an array
>defined in the Form Bean. What are the changes required in my jsp snippet?
>
>Also, if only it is possible to get an output as desired, does the
FormBean
>be modified to support this. As there won't be any getter/setter for "a"
>and
>"b".
>
>Appreciate any kind of help regarding this.

First, google around for "map-backed ActionForms" or similar. There's some
stuff over on jguru that might be helpful. Also, I'm trying to write
documentation for the struts user's guide for this, so I'd appreciate your
comments on how (un)clear the following is (apologies for the formatting,
my mail client sucks):


  The DynaActionForm classes offer the ability to create ActionForm
beans
 at initialization time, based on a list of properties enumerated in the
struts
configuration file. However, many HTML forms are generated dynamically at
request-time. Their ActionForm beans' properties are not all known ahead of
time, so we need a new approach.
  Struts allows you to make one (or more) of your ActionForm's
properties
' values a Map instead of a traditional atomic object. You can then store
your form's dynamic fields' data in that Map. Here is an example of a
map-backed ActionForm class:



  In its corresponding JSP page, you can access objects stored in
the values map using a special notation: mapname(keyname). The
parantheses in the bean property name serve to indicate that the bean
property named mapname should be a Map, and that struts should look
at the value stored with the key keyname in that Map to find the
"real" property for mapname(keyname).
  Here is a simple example:



  This will call the getValue() method on FooForm with a key value
of "foo" to find the property value. To create a form with dynamic field
names, you might do something like this:





Hope it helps, thanks in advance for any comments.

- donald


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Dynamic name to the text fields

2002-09-02 Thread Anoop

But how will be the formbean pre-defined with the getter/setter's for the
textfields textFieldName1, textFieldName2. generated at runtime??

-Anoop.

-Original Message-
From: Adolfo Miguelez [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 4:52 PM
To: [EMAIL PROTECTED]
Subject: RE: Dynamic name to the text fields


I did by a similar approach:



...


In tha way you can take advantage of the iteration to set different property
names to your input: textFieldName1, textFieldName2

Just another choice for you



>From: Darryl Nortje <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
>Subject: RE: Dynamic name to the text fields
>Date: Mon, 2 Sep 2002 12:48:37 +0200
>
>Anoop, I did it by iterating through a collection of beans, each bean in
>the
>collection for eg had a getKey() and getValue() method then the jsp looks
>like this.
>
>
>
>   
>  "/>
>   
>
>
>
>It's very simple but it works
>
>cheers
>Darryl
>
>-Original Message-
>From: Donald Ball [mailto:[EMAIL PROTECTED]]
>Sent: Friday, August 30, 2002 4:44 PM
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Subject: Re: Dynamic name to the text fields
>
>
>On 8/30/2002 at 7:28 PM Anoop wrote:
>
> >Hi All,
> >
> > I am a newbie to struts and taglibs, was trying to display text
>fields
> >dynamically using "html:iterator". Below is the scenario I was
> >trying out.
>
>You may be in luck, I've been recently trying to learn how to do something
>similar myself.
>
>
>
> >The html snippet for the above is something like:
> >
> > 
> > 
> >
> >But I want it to be something like:
> >
> > 
> > 
> >
> >Where the values("a" & "b") for the name attribute comes from an array
> >defined in the Form Bean. What are the changes required in my jsp
>snippet?
> >
> >Also, if only it is possible to get an output as desired, does the
>FormBean
> >be modified to support this. As there won't be any getter/setter for "a"
> >and
> >"b".
> >
> >Appreciate any kind of help regarding this.
>
>First, google around for "map-backed ActionForms" or similar. There's some
>stuff over on jguru that might be helpful. Also, I'm trying to write
>documentation for the struts user's guide for this, so I'd appreciate your
>comments on how (un)clear the following is (apologies for the formatting,
>my mail client sucks):
>
> href="map_action_form_classes">
>   The DynaActionForm classes offer the ability to create ActionForm
>beans
>  at initialization time, based on a list of properties enumerated in the
>struts
>configuration file. However, many HTML forms are generated dynamically at
>request-time. Their ActionForm beans' properties are not all known ahead of
>time, so we need a new approach.
>   Struts allows you to make one (or more) of your ActionForm's
>properties
>' values a Map instead of a traditional atomic object. You can then store
>your form's dynamic fields' data in that Map. Here is an example of a
>map-backed ActionForm class:
>
>
>
>   In its corresponding JSP page, you can access objects stored in
>the values map using a special notation: mapname(keyname). The
>parantheses in the bean property name serve to indicate that the bean
>property named mapname should be a Map, and that struts should look
>at the value stored with the key keyname in that Map to find the
>"real" property for mapname(keyname).
>   Here is a simple example:
>
>
>
>   This will call the getValue() method on FooForm with a key value
>of "foo" to find the property value. To create a form with dynamic field
>names, you might do something like this:
>
>
>
> 
>
>Hope it helps, thanks in advance for any comments.
>
>- donald
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>

_
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Dynamic name to the text fields

2002-09-02 Thread Jon.Ridgway

Hi All,

I might be wrong, but I thought the nested tags (when in a nested:iterate)
did this automatically for you  ie name0, name1, name2 etc.

Jon Ridgway


-Original Message-
From: Adolfo Miguelez [mailto:[EMAIL PROTECTED]] 
Sent: 02 September 2002 12:22
To: [EMAIL PROTECTED]
Subject: RE: Dynamic name to the text fields

I did by a similar approach:



...


In tha way you can take advantage of the iteration to set different property

names to your input: textFieldName1, textFieldName2

Just another choice for you



>From: Darryl Nortje <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
>Subject: RE: Dynamic name to the text fields
>Date: Mon, 2 Sep 2002 12:48:37 +0200
>
>Anoop, I did it by iterating through a collection of beans, each bean in 
>the
>collection for eg had a getKey() and getValue() method then the jsp looks
>like this.
>
>
>
>   
>  "/>
>   
>
>
>
>It's very simple but it works
>
>cheers
>Darryl
>
>-Original Message-
>From: Donald Ball [mailto:[EMAIL PROTECTED]]
>Sent: Friday, August 30, 2002 4:44 PM
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Subject: Re: Dynamic name to the text fields
>
>
>On 8/30/2002 at 7:28 PM Anoop wrote:
>
> >Hi All,
> >
> > I am a newbie to struts and taglibs, was trying to display text
>fields
> >dynamically using "html:iterator". Below is the scenario I was
> >trying out.
>
>You may be in luck, I've been recently trying to learn how to do something
>similar myself.
>
>
>
> >The html snippet for the above is something like:
> >
> > 
> > 
> >
> >But I want it to be something like:
> >
> > 
> > 
> >
> >Where the values("a" & "b") for the name attribute comes from an array
> >defined in the Form Bean. What are the changes required in my jsp 
>snippet?
> >
> >Also, if only it is possible to get an output as desired, does the
>FormBean
> >be modified to support this. As there won't be any getter/setter for "a"
> >and
> >"b".
> >
> >Appreciate any kind of help regarding this.
>
>First, google around for "map-backed ActionForms" or similar. There's some
>stuff over on jguru that might be helpful. Also, I'm trying to write
>documentation for the struts user's guide for this, so I'd appreciate your
>comments on how (un)clear the following is (apologies for the formatting,
>my mail client sucks):
>
> href="map_action_form_classes">
>   The DynaActionForm classes offer the ability to create ActionForm
>beans
>  at initialization time, based on a list of properties enumerated in the
>struts
>configuration file. However, many HTML forms are generated dynamically at
>request-time. Their ActionForm beans' properties are not all known ahead of
>time, so we need a new approach.
>   Struts allows you to make one (or more) of your ActionForm's
>properties
>' values a Map instead of a traditional atomic object. You can then store
>your form's dynamic fields' data in that Map. Here is an example of a
>map-backed ActionForm class:
>
>
>
>   In its corresponding JSP page, you can access objects stored in
>the values map using a special notation: mapname(keyname). The
>parantheses in the bean property name serve to indicate that the bean
>property named mapname should be a Map, and that struts should look
>at the value stored with the key keyname in that Map to find the
>"real" property for mapname(keyname).
>   Here is a simple example:
>
>
>
>   This will call the getValue() method on FooForm with a key value
>of "foo" to find the property value. To create a form with dynamic field
>names, you might do something like this:
>
>
>
> 
>
>Hope it helps, thanks in advance for any comments.
>
>- donald
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


The contents of this email are intended only for the named addressees and
may contain confidential and/or privileged material. If received in error
please contact UPCO on +44 (0) 113 201 0600 and then delete the entire
e-mail from your system. Unauthorised review, distribution, disclosure or
other use of this information could constitute a breach of confidence. Your
co-operation in this matter is greatly appreciated. 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Dynamic name to the text fields

2002-09-02 Thread Adolfo Miguelez

I did by a similar approach:



...


In tha way you can take advantage of the iteration to set different property 
names to your input: textFieldName1, textFieldName2

Just another choice for you



>From: Darryl Nortje <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
>Subject: RE: Dynamic name to the text fields
>Date: Mon, 2 Sep 2002 12:48:37 +0200
>
>Anoop, I did it by iterating through a collection of beans, each bean in 
>the
>collection for eg had a getKey() and getValue() method then the jsp looks
>like this.
>
>
>
>   
>  "/>
>   
>
>
>
>It's very simple but it works
>
>cheers
>Darryl
>
>-Original Message-
>From: Donald Ball [mailto:[EMAIL PROTECTED]]
>Sent: Friday, August 30, 2002 4:44 PM
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Subject: Re: Dynamic name to the text fields
>
>
>On 8/30/2002 at 7:28 PM Anoop wrote:
>
> >Hi All,
> >
> > I am a newbie to struts and taglibs, was trying to display text
>fields
> >dynamically using "html:iterator". Below is the scenario I was
> >trying out.
>
>You may be in luck, I've been recently trying to learn how to do something
>similar myself.
>
>
>
> >The html snippet for the above is something like:
> >
> > 
> > 
> >
> >But I want it to be something like:
> >
> > 
> > 
> >
> >Where the values("a" & "b") for the name attribute comes from an array
> >defined in the Form Bean. What are the changes required in my jsp 
>snippet?
> >
> >Also, if only it is possible to get an output as desired, does the
>FormBean
> >be modified to support this. As there won't be any getter/setter for "a"
> >and
> >"b".
> >
> >Appreciate any kind of help regarding this.
>
>First, google around for "map-backed ActionForms" or similar. There's some
>stuff over on jguru that might be helpful. Also, I'm trying to write
>documentation for the struts user's guide for this, so I'd appreciate your
>comments on how (un)clear the following is (apologies for the formatting,
>my mail client sucks):
>
> href="map_action_form_classes">
>   The DynaActionForm classes offer the ability to create ActionForm
>beans
>  at initialization time, based on a list of properties enumerated in the
>struts
>configuration file. However, many HTML forms are generated dynamically at
>request-time. Their ActionForm beans' properties are not all known ahead of
>time, so we need a new approach.
>   Struts allows you to make one (or more) of your ActionForm's
>properties
>' values a Map instead of a traditional atomic object. You can then store
>your form's dynamic fields' data in that Map. Here is an example of a
>map-backed ActionForm class:
>
>
>
>   In its corresponding JSP page, you can access objects stored in
>the values map using a special notation: mapname(keyname). The
>parantheses in the bean property name serve to indicate that the bean
>property named mapname should be a Map, and that struts should look
>at the value stored with the key keyname in that Map to find the
>"real" property for mapname(keyname).
>   Here is a simple example:
>
>
>
>   This will call the getValue() method on FooForm with a key value
>of "foo" to find the property value. To create a form with dynamic field
>names, you might do something like this:
>
>
>
> 
>
>Hope it helps, thanks in advance for any comments.
>
>- donald
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Dynamic name to the text fields

2002-09-02 Thread Darryl Nortje

Anoop, I did it by iterating through a collection of beans, each bean in the
collection for eg had a getKey() and getValue() method then the jsp looks
like this.


   
  
 "/>
  
   


It's very simple but it works

cheers
Darryl

-Original Message-
From: Donald Ball [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 4:44 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Dynamic name to the text fields


On 8/30/2002 at 7:28 PM Anoop wrote:

>Hi All,
>
>   I am a newbie to struts and taglibs, was trying to display text
fields
>dynamically using "html:iterator". Below is the scenario I was
>trying out.

You may be in luck, I've been recently trying to learn how to do something
similar myself.



>The html snippet for the above is something like:
>
>   
>   
>
>But I want it to be something like:
>
>   
>   
>
>Where the values("a" & "b") for the name attribute comes from an array
>defined in the Form Bean. What are the changes required in my jsp snippet?
>
>Also, if only it is possible to get an output as desired, does the
FormBean
>be modified to support this. As there won't be any getter/setter for "a"
>and
>"b".
>
>Appreciate any kind of help regarding this.

First, google around for "map-backed ActionForms" or similar. There's some
stuff over on jguru that might be helpful. Also, I'm trying to write
documentation for the struts user's guide for this, so I'd appreciate your
comments on how (un)clear the following is (apologies for the formatting,
my mail client sucks):


  The DynaActionForm classes offer the ability to create ActionForm
beans
 at initialization time, based on a list of properties enumerated in the
struts
configuration file. However, many HTML forms are generated dynamically at
request-time. Their ActionForm beans' properties are not all known ahead of
time, so we need a new approach.
  Struts allows you to make one (or more) of your ActionForm's
properties
' values a Map instead of a traditional atomic object. You can then store
your form's dynamic fields' data in that Map. Here is an example of a
map-backed ActionForm class:



  In its corresponding JSP page, you can access objects stored in
the values map using a special notation: mapname(keyname). The
parantheses in the bean property name serve to indicate that the bean
property named mapname should be a Map, and that struts should look
at the value stored with the key keyname in that Map to find the
"real" property for mapname(keyname).
  Here is a simple example:



  This will call the getValue() method on FooForm with a key value
of "foo" to find the property value. To create a form with dynamic field
names, you might do something like this:





Hope it helps, thanks in advance for any comments.

- donald


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Dynamic name to the text fields

2002-08-30 Thread Ted Husted

Don,

Don't hestitate to submit this through Bugzilla when you are ready.

-Ted.

Donald Ball wrote:

>On 8/30/2002 at 7:28 PM Anoop wrote:
>
>>Hi All,
>>
>>  I am a newbie to struts and taglibs, was trying to display text fields
>>dynamically using "html:iterator". Below is the scenario I was
>>trying out.
>>
>
>You may be in luck, I've been recently trying to learn how to do something
>similar myself.
>
>
>
>>The html snippet for the above is something like:
>>
>>  
>>  
>>
>>But I want it to be something like:
>>
>>  
>>  
>>
>>Where the values("a" & "b") for the name attribute comes from an array
>>defined in the Form Bean. What are the changes required in my jsp snippet?
>>
>>Also, if only it is possible to get an output as desired, does the
>>
>FormBean
>
>>be modified to support this. As there won't be any getter/setter for "a"
>>and
>>"b".
>>
>>Appreciate any kind of help regarding this.
>>
>
>First, google around for "map-backed ActionForms" or similar. There's some
>stuff over on jguru that might be helpful. Also, I'm trying to write
>documentation for the struts user's guide for this, so I'd appreciate your
>comments on how (un)clear the following is (apologies for the formatting,
>my mail client sucks):
>
>href="map_action_form_classes">
>  The DynaActionForm classes offer the ability to create ActionForm
>beans
> at initialization time, based on a list of properties enumerated in the
>struts
>configuration file. However, many HTML forms are generated dynamically at
>request-time. Their ActionForm beans' properties are not all known ahead of
>time, so we need a new approach.
>  Struts allows you to make one (or more) of your ActionForm's
>properties
>' values a Map instead of a traditional atomic object. You can then store
>your form's dynamic fields' data in that Map. Here is an example of a
>map-backed ActionForm class:
>
>
>
>  In its corresponding JSP page, you can access objects stored in
>the values map using a special notation: mapname(keyname). The
>parantheses in the bean property name serve to indicate that the bean
>property named mapname should be a Map, and that struts should look
>at the value stored with the key keyname in that Map to find the
>"real" property for mapname(keyname).
>  Here is a simple example:
>
>
>
>  This will call the getValue() method on FooForm with a key value
>of "foo" to find the property value. To create a form with dynamic field
>names, you might do something like this:
>
>
>
>
>
>Hope it helps, thanks in advance for any comments.
>
>- donald
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Dynamic name to the text fields

2002-08-30 Thread Donald Ball

On 8/30/2002 at 7:28 PM Anoop wrote:

>Hi All,
>
>   I am a newbie to struts and taglibs, was trying to display text fields
>dynamically using "html:iterator". Below is the scenario I was
>trying out.

You may be in luck, I've been recently trying to learn how to do something
similar myself.



>The html snippet for the above is something like:
>
>   
>   
>
>But I want it to be something like:
>
>   
>   
>
>Where the values("a" & "b") for the name attribute comes from an array
>defined in the Form Bean. What are the changes required in my jsp snippet?
>
>Also, if only it is possible to get an output as desired, does the
FormBean
>be modified to support this. As there won't be any getter/setter for "a"
>and
>"b".
>
>Appreciate any kind of help regarding this.

First, google around for "map-backed ActionForms" or similar. There's some
stuff over on jguru that might be helpful. Also, I'm trying to write
documentation for the struts user's guide for this, so I'd appreciate your
comments on how (un)clear the following is (apologies for the formatting,
my mail client sucks):


  The DynaActionForm classes offer the ability to create ActionForm
beans
 at initialization time, based on a list of properties enumerated in the
struts
configuration file. However, many HTML forms are generated dynamically at
request-time. Their ActionForm beans' properties are not all known ahead of
time, so we need a new approach.
  Struts allows you to make one (or more) of your ActionForm's
properties
' values a Map instead of a traditional atomic object. You can then store
your form's dynamic fields' data in that Map. Here is an example of a
map-backed ActionForm class:



  In its corresponding JSP page, you can access objects stored in
the values map using a special notation: mapname(keyname). The
parantheses in the bean property name serve to indicate that the bean
property named mapname should be a Map, and that struts should look
at the value stored with the key keyname in that Map to find the
"real" property for mapname(keyname).
  Here is a simple example:



  This will call the getValue() method on FooForm with a key value
of "foo" to find the property value. To create a form with dynamic field
names, you might do something like this:





Hope it helps, thanks in advance for any comments.

- donald


--
To unsubscribe, e-mail:   
For additional commands, e-mail: