Hi @all,
Sharad's approach worked well form me. In fact I implemented something 
comparable (after I found the idea in the javamagazin.de ;) But I still
could not figure out, how to do the necessary validation. I already have

some basic Stuff like:

        HashMap valueMap = new HashMap();
        Enumeration param = request.getParameterNames();
        while(param.hasMoreElements()){
                String elm = (String)param.nextElement();
                valueMap.put(elem,request.getParameter(elem));
                if(elem.indexOF(DynDataFormHandler.ITEM_KEY_BEGIN)!=-1){
        
validateIsNumeric(request.getParameter(elm),elm);
                }
        } 

in the Action Class. But what I really need, as I us this for a
registration form, is (pre-) validation for email, zip, telephone ...

Has anyone an idea how to solve this problem? Sharad how do you handle
validation in your approach?


Thanks
Oliver Thiel
 

-----Ursprüngliche Nachricht-----
Von: Sharad Acharya [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 11. Dezember 2003 05:47
An: [EMAIL PROTECTED]
Betreff: Handle dynamic contents using map backed form

Hi all;
>From Ted and others comments, it looks like some of you are trying to 
implement forms that should handle 'real' dynamic contents. In my recent

project, I had pleasure to work handling dynamic contents in which the 
contents to render were not available until the time to render. 
DynaActionForm does not help because we need to fix form attributes in 
configuration element. Sooo the solution? we implemented map backed
forms. I 
have discussed the technique in my recent JavaPro article, which you can

read online in the following links:

Part I:
http://www.fawcette.com/javapro/2003_11/online/dynamic_sacharya_11_11_03
/

Part II:
http://www.fawcette.com/javapro/2003_11/online/dynamic_sacharya_11_17_03
/

If you have any question about my approach, please let me know.

Thanks

Sharad Acharya



>From: Ted Husted <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: Struts Users Mailing List <[EMAIL PROTECTED]>
>Subject: Re: When HashMap will replace ActionForm ?
>Date: Wed, 10 Dec 2003 13:01:55 -0500
>
>As mentioned, you can use a map-backed ActionForm to store whatever
fields 
>you need without defining them elsewhere.
>
>http://tinyurl.com/ymkr
>
>You do need to code the forms a little differently, and your forms
still 
>need to know what properties/entries to ask for.
>
>Personally, I would strongly recommnend using DynaActionForms. The
overhead 
>of defining the elements in the configuration is negligable in
practice, 
>and it clearly defines which properties are used with which forms.
>
>In practice, what really costs projects time is miscommunication. For 
>example, is the entry name in the Map userName or username? With 
>DynaActionForms all the entry names are documented in the
configuration. 
>Otherwise, you will have to document them elsewhere and redo what has 
>already been done.
>
>I *am* a big fan of using Maps for Contexts, especially between
application 
>layers, and with the Commons Chain influence, we're sure to see more of

>that. The thing about DynaActionForms is that you get the agility of a
Map 
>with the documentation of a JavaBean.
>
>HTH, Ted.
>
>
>Antony Paul wrote:
>>but it prints the form field name like this map(username). I want to
get 
>>the
>>key as name of form field. here username. possible ?
>>
>>rgds
>>Antony Paul.
>>
>>----- Original Message -----
>>From: "Fullam, Jonathan" <[EMAIL PROTECTED]>
>>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>>Sent: Wednesday, December 10, 2003 7:30 PM
>>Subject: RE: When HashMap will replace ActionForm ?
>>
>>
>>
>>>That's where a map-backed Hashmap is useful.
>>>
>>>-----Original Message-----
>>>From: Antony Paul [mailto:[EMAIL PROTECTED]
>>>Sent: Wednesday, December 10, 2003 6:02 AM
>>>To: Struts Users Mailing List
>>>Subject: Re: When HashMap will replace ActionForm ?
>>>
>>>
>>>I know that but one have to define 10 to 30 elements in
struts-config.xml
>>>for that. With a hash map one have to say whether it is needed ot
not. It
>>>could be accessed like DynaValidator form. And my requirement is to
store
>>>simple text field values.
>>>
>>>rgds
>>>Antony Paul.
>>>
>>>----- Original Message -----
>>>From: "Kalra, Ashwani" <[EMAIL PROTECTED]>
>>>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>>Sent: Wednesday, December 10, 2003 4:05 PM
>>>Subject: RE: When HashMap will replace ActionForm ?
>>>
>>>
>>>
>>>>DynaValidator forms stores data in Hashmap internally if you dont
want
>>
>>to
>>
>>>>define norma action forms.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>-----Original Message-----
>>>>>From: Antony Paul [mailto:[EMAIL PROTECTED]
>>>>>Sent: Wednesday, December 10, 2003 2:40 PM
>>>>>To: struts
>>>>>Subject: When HashMap will replace ActionForm ?
>>>>>
>>>>>
>>>>>Hi,
>>>>>   Is there any move to support HashMap in place of
>>>>>ActionForm ?. I dont
>>>>>want to start any argument. I have read a lot on ActionForm in
>>>>>this archive.
>>>>>
>>>>>rgds
>>>>>Antony Paul.
>>>>>
>>>>>-------------------------------------------------------------------
--
>>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>For additional commands, e-mail:
[EMAIL PROTECTED]
>>>>>
>>>>
>>>>____________________________________________________
>>>>This message contains information that may be privileged or
confidential
>>>
>>>and
>>>
>>>>is the property of the Cap Gemini Ernst & Young Group. It is
intended
>>
>>only
>>
>>>>for the person to whom it is addressed. If you are not the intended
>>>>recipient, you are not authorised to read, print, retain, copy,
>>>
>>>disseminate,
>>>
>>>>distribute, or use this message or any part thereof. If you receive
this
>>>>message in error, please notify the sender immediately and delete
all
>>>
>>>copies
>>>
>>>>of this message.
>>>>
>>>>--------------------------------------------------------------------
-
>>>>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]
>

_________________________________________________________________
Get holiday tips for festive fun. 
http://special.msn.com/network/happyholidays.armx


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