Hi Tim,
Thanks a lot for your help. One more question:

Can you please tell me if this approach works for the multi-part requests
like file uploads? 
If so, then how does the html tag for file upload gets expanded? what should
be the setProperty for this one that I will have to write in the form class?

Ajay

-----Original Message-----
From: Pedone, Tim [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 5:03 PM
To: 'Struts Users Mailing List'; '[EMAIL PROTECTED]'
Subject: RE: PLEASE HELP !!!


If you have control over the html that is rendered then you can use the
property="property(name)" technique.  Just add

void setProperty(String key, String value) 
String getProperty(String key)

to your ActionForm and have them store the values in an underlying HashMap.
You can generate "name" above dynamically in your html form and Struts will
call setProperty(name, value) for you.

Tim

-----Original Message-----
From: Jeremy Prellwitz [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 4:41 PM
To: Struts Users Mailing List
Subject: RE: PLEASE HELP !!!


I have a need for this also....here's an example of where i 
would like to use them:

  I'm pulling an arbitrary amount of records from a database, 
and for each record, shown in an HTML table, it has a radio 
button that has 3 options: Approve; Reject; Do Nothing.  I 
then need to submit this form and process the data 
accordingly.  The names of the form fields for the radio 
button need to be created dynamically and to properly 
associate the name/value pair to the database record, i 
currently include a unique key in the name generation, as 
well as a simple sequence number.

If there was a "Struts" way to do this dynamically with an 
Array or Hashtable, or Vector, ...... that would be COOL.  

If anyone would suggest a better...or even different approach 
to the way i'm doing this now, it would be appreciated.

Jeremy

---- Original message ----
>Date: Mon, 29 Apr 2002 17:27:16 -0600
>From: "Phase Web and Multimedia" <[EMAIL PROTECTED]>  
>Subject: RE: PLEASE HELP !!!  
>To: "Struts Users Mailing List" <struts-
[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
>
>The only thing I know of is the DynaBean. This allows you to 
declare values
>in your struts.xml action declaration that will need to be 
gathered from the
>request and stored in a Bean as a HashMap. This allows the 
flexibility of
>being able to gather request parameters without having to 
recompile the
>class. But, I am not aware of any truly dynamic form bean 
creation. If I
>hear you correctly you want to have request name/value pairs 
that you can
>use without having them declared or predefined anywhere? 
When would you need
>to do that?
>
>Brandon
>
>-----Original Message-----
>From: Joseph Barefoot [mailto:[EMAIL PROTECTED]]
>Sent: Monday, April 29, 2002 4:57 PM
>To: Struts Users Mailing List
>Subject: RE: PLEASE HELP !!!
>
>
>I was unable to address this issue myself, Ajay.  I use a 
combination of an
>ActionForm for the static fields and naming conventions for 
the dynamically
>generated fields plus parameter handling for these in the 
Action class.
>This is not very aesthetically pleasing, however.
>
>I have heard that Struts support for this is in development, 
but don't quote
>me on that.  What we need is the ability to specify input 
name patterns for
>fields that will get stored in an ArrayList when the request 
is processed.
>
>For instance:
>// in the new Struts tag:
> <dynaList pattern="param*" name="myFieldList" />
>
>// Some dynamically generated stuff in the request:
>param1 = value1
>param2 = value2
>param3 = value3
>
>
>...and these key-value pairs would get stored in 
myFieldList, an instance of
>ArrayList.  Anybody know if this is in the works?
>
>
>cheers,
>Joe
>
>
>
>> -----Original Message-----
>> From: Ajay Mallik [mailto:[EMAIL PROTECTED]]
>> Sent: Monday, April 29, 2002 2:54 PM
>> To: 'Struts Users Mailing List'
>> Subject: PLEASE HELP !!!
>>
>>
>>
>> Hi All,
>> I am new to Struts. I need to create an action-form 
dynamically when the
>> user submits a form. The form in the client side is 
generated dynamically,
>> as a result I cannot create any fields in the action-form 
class associated
>> with the action. The user can submit simple data as 
textbox or can submit
>> MIME type multipart request as in file upload.
>>
>> For the above problem I can retrieve the values by using
>> request.getParameterNames() and so on, but that is not 
elegant, I
>> guess. Can
>> I do that "the struts way"? Also, do I need to distinguish 
between
>> mulitipart form data from the simple ones like textboxes?
>>
>> I will highly appreciate any help in this regard. I have 
been struggling
>> with it.
>> Thanks.
>> Ajay
>>
>> --
>> 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:struts-user-
[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:struts-user-
[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]>

Reply via email to