You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pille <al...@flipsonline.de> on 2006/12/19 00:12:29 UTC

initialize a DynaValidatorForm property

hi,
how can i initialize a property of type ArrayList in a DynaValidatorForm?
i saw that i can do some simple initialization with the initial
attribute in the form-peoperty tag in struts-config.

at the moment i do some initialization in a prepare action that sets the
attributes some combo boxes.

<action path="/prepareBuyOnline"
                type="software.BuyOnlineAction"
                parameter="prepareForm">
            <forward name="success" path="/BuyOnline.jsp"/>

it seems that a form of type DynaValidatorFrom doesn´t allow the
attribute name="formName" in the prepare action statement. do i need
this attribute to access the form bean?
i always get a ForwardConfig exception when i try to do this but i need
to initialize a form property (ArrayList) in the action statement. i
think i need an instance of the form bean to set a property with
PropertyUtils.setSimpleProperty(yourForm,"propertyName",object);
in a action method. is that right?

which data types can i use in a DynaValidatorForm? i have a book here
and the author says that only arrays, lists and maps of primitive data
types are allowed. is it possible to use a java.util.ArrayList with my
own beans of same type as elements?
thank you

regards
philippe

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


Re: initialize a DynaValidatorForm property

Posted by Laurie Harper <la...@holoweb.net>.
Pille wrote:
>> And in the action mapping specify the name of the Form Bean that you are
>> about to use. In this case the form bean that contains the List you'r going
>> to initiate..
> 
> i tried all of this. when i spcified the name of DynaValidatorForm in
> the prepare-mapping i got an exception. but it worked with
> DynActionForm. why?
> 
> but i solved it right now. i just implemented my own Form class as
> extension of ValidatorForm.

Good to know you found a solution, but creating a class shouldn't be 
necessary; without seeing the exception you got, and how you configured 
your form bean and action mapping to get it, it's hard to say what went 
wrong. If you'd like to solve that, post the relevant configuration and 
the full stack trace for us to take a look at.

L.


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


Re: initialize a DynaValidatorForm property

Posted by Pille <al...@flipsonline.de>.

mano dasanayake wrote:
> Hi,
> Yes you can initiate an attribute of type arrayList in the DynaForm as
> follows,
> 
> <form-property name="yourList" type="java.util.List" />

i know that.

> 
> And in the action mapping specify the name of the Form Bean that you are
> about to use. In this case the form bean that contains the List you'r going
> to initiate..

i tried all of this. when i spcified the name of DynaValidatorForm in
the prepare-mapping i got an exception. but it worked with
DynActionForm. why?

but i solved it right now. i just implemented my own Form class as
extension of ValidatorForm.



> 
> Regards,
> Mano
> 

thank you

regards
philippe

> 
> -----Original Message-----
> From: Pille [mailto:alsa-users@flipsonline.de] 
> Sent: Tuesday, December 19, 2006 5:12 AM
> To: user@struts.apache.org
> Subject: initialize a DynaValidatorForm property
> 
> hi,
> how can i initialize a property of type ArrayList in a DynaValidatorForm?
> i saw that i can do some simple initialization with the initial
> attribute in the form-peoperty tag in struts-config.
> 
> at the moment i do some initialization in a prepare action that sets the
> attributes some combo boxes.
> 
> <action path="/prepareBuyOnline"
>                 type="software.BuyOnlineAction"
>                 parameter="prepareForm">
>             <forward name="success" path="/BuyOnline.jsp"/>
> 
> it seems that a form of type DynaValidatorFrom doesn´t allow the
> attribute name="formName" in the prepare action statement. do i need
> this attribute to access the form bean?
> i always get a ForwardConfig exception when i try to do this but i need
> to initialize a form property (ArrayList) in the action statement. i
> think i need an instance of the form bean to set a property with
> PropertyUtils.setSimpleProperty(yourForm,"propertyName",object);
> in a action method. is that right?
> 
> which data types can i use in a DynaValidatorForm? i have a book here
> and the author says that only arrays, lists and maps of primitive data
> types are allowed. is it possible to use a java.util.ArrayList with my
> own beans of same type as elements?
> thank you
> 
> regards
> philippe
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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


RE: initialize a DynaValidatorForm property

Posted by mano dasanayake <ma...@mubasher.net>.
Hi,
Yes you can initiate an attribute of type arrayList in the DynaForm as
follows,

<form-property name="yourList" type="java.util.List" />

And in the action mapping specify the name of the Form Bean that you are
about to use. In this case the form bean that contains the List you'r going
to initiate..

Regards,
Mano


-----Original Message-----
From: Pille [mailto:alsa-users@flipsonline.de] 
Sent: Tuesday, December 19, 2006 5:12 AM
To: user@struts.apache.org
Subject: initialize a DynaValidatorForm property

hi,
how can i initialize a property of type ArrayList in a DynaValidatorForm?
i saw that i can do some simple initialization with the initial
attribute in the form-peoperty tag in struts-config.

at the moment i do some initialization in a prepare action that sets the
attributes some combo boxes.

<action path="/prepareBuyOnline"
                type="software.BuyOnlineAction"
                parameter="prepareForm">
            <forward name="success" path="/BuyOnline.jsp"/>

it seems that a form of type DynaValidatorFrom doesn´t allow the
attribute name="formName" in the prepare action statement. do i need
this attribute to access the form bean?
i always get a ForwardConfig exception when i try to do this but i need
to initialize a form property (ArrayList) in the action statement. i
think i need an instance of the form bean to set a property with
PropertyUtils.setSimpleProperty(yourForm,"propertyName",object);
in a action method. is that right?

which data types can i use in a DynaValidatorForm? i have a book here
and the author says that only arrays, lists and maps of primitive data
types are allowed. is it possible to use a java.util.ArrayList with my
own beans of same type as elements?
thank you

regards
philippe

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





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