DynaActionForms

2003-10-13 Thread Edgar P Dollin
I have an application with configuration files already.  Rather than have
struts-config configure DynaForms, I would like to populate the forms
myself.

Does anyone have any experience with how this behaves in struts?

Thanks

Edgar

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



DynaActionForms

2002-05-14 Thread Christopher Book

Hello,

I've used struts 1.0 with forms before but I'm having problems using
DynaActionForms instead.
I've setup my struts-config properly (I beleive), and I'm using the
following code in my action to set my form bean:
DynaActionForm myForm = new DynaActionForm();
myForm.set("name","this is my name");
request.setAttribute("MyForm",myForm);

WIthin my jsp (that the action forwards to), I have:




But when I load the page my textbox is blank.  Can someone tell my why the
dynaactionform variable isn't being set?

Thanks,
Chris Book
[EMAIL PROTECTED]

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




RE: DynaActionForms

2003-10-13 Thread Carlos Sanchez
yourdynaform.set("propertyname",propertyvalue);

> -Mensaje original-
> De: Edgar P Dollin [mailto:[EMAIL PROTECTED] 
> Enviado el: lunes, 13 de octubre de 2003 19:35
> Para: Struts Users Mailing List
> Asunto: DynaActionForms
> 
> 
> I have an application with configuration files already.  
> Rather than have struts-config configure DynaForms, I would 
> like to populate the forms myself.
> 
> Does anyone have any experience with how this behaves in struts?
> 
> Thanks
> 
> Edgar
> 
> -
> 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]



RE: DynaActionForms

2003-10-13 Thread Chen, Gin
I'm assuming that he meant create a new property that is not already defined
in the struts-config.
In which case I think your reply would fail with an property not found type
exception. :-/
One way around this is to have a Hashmap within the hashmapped dynaform.
That will allow you to do something like:

Hashmap myDynaproperties = (Hashmap)myDynaform.get("dynaProperties");
myDynaproperties.set("foo", bar);
Etc.

Another possibility (although I havent tried it) is to operate directly on
the map.

myDynaproperties.getMap().put("foo", bar);

-Tim

-Original Message-
From: Carlos Sanchez [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 13, 2003 3:21 PM
To: 'Struts Users Mailing List'
Subject: RE: DynaActionForms


yourdynaform.set("propertyname",propertyvalue);

> -Mensaje original-
> De: Edgar P Dollin [mailto:[EMAIL PROTECTED] 
> Enviado el: lunes, 13 de octubre de 2003 19:35
> Para: Struts Users Mailing List
> Asunto: DynaActionForms
> 
> 
> I have an application with configuration files already.  
> Rather than have struts-config configure DynaForms, I would 
> like to populate the forms myself.
> 
> Does anyone have any experience with how this behaves in struts?
> 
> Thanks
> 
> Edgar
> 
> -
> 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]



Re: DynaActionForms

2003-10-13 Thread Nick
I do not believe that you can do dynamically add fields to a DynaForm, as the
config is frozen at app startup.  Might work with an internal HashMap though.

On Mon, Oct 13, 2003 at 03:31:32PM -0400, Chen, Gin wrote:
> I'm assuming that he meant create a new property that is not already defined
> in the struts-config.
> In which case I think your reply would fail with an property not found type
> exception. :-/
> One way around this is to have a Hashmap within the hashmapped dynaform.
> That will allow you to do something like:
> 
> Hashmap myDynaproperties = (Hashmap)myDynaform.get("dynaProperties");
> myDynaproperties.set("foo", bar);
> Etc.
> 
> Another possibility (although I havent tried it) is to operate directly on
> the map.
> 
> myDynaproperties.getMap().put("foo", bar);
> 
> -Tim
> 
> -Original Message-
> From: Carlos Sanchez [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 13, 2003 3:21 PM
> To: 'Struts Users Mailing List'
> Subject: RE: DynaActionForms
> 
> 
> yourdynaform.set("propertyname",propertyvalue);
> 
> > -Mensaje original-
> > De: Edgar P Dollin [mailto:[EMAIL PROTECTED] 
> > Enviado el: lunes, 13 de octubre de 2003 19:35
> > Para: Struts Users Mailing List
> > Asunto: DynaActionForms
> > 
> > 
> > I have an application with configuration files already.  
> > Rather than have struts-config configure DynaForms, I would 
> > like to populate the forms myself.
> > 
> > Does anyone have any experience with how this behaves in struts?
> > 
> > Thanks
> > 
> > Edgar
> > 
> > -
> > 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]

-- 
Nick Heudecker
SystemMobile, Inc.
Email: [EMAIL PROTECTED]
Web: http://www.systemmobile.com

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



RE: DynaActionForms

2003-10-13 Thread Chen, Gin
I just looked through the code and your right.
So I guess it's either use my first option or do your own subclass of
DynaActionForm that will by-pass the lock implemented via the dynaClass
lookup.
-Tim

-Original Message-
From: Nick [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 13, 2003 3:41 PM
To: Struts Users Mailing List
Subject: Re: DynaActionForms


I do not believe that you can do dynamically add fields to a DynaForm, as
the
config is frozen at app startup.  Might work with an internal HashMap
though.

On Mon, Oct 13, 2003 at 03:31:32PM -0400, Chen, Gin wrote:
> I'm assuming that he meant create a new property that is not already
defined
> in the struts-config.
> In which case I think your reply would fail with an property not found
type
> exception. :-/
> One way around this is to have a Hashmap within the hashmapped dynaform.
> That will allow you to do something like:
> 
> Hashmap myDynaproperties = (Hashmap)myDynaform.get("dynaProperties");
> myDynaproperties.set("foo", bar);
> Etc.
> 
> Another possibility (although I havent tried it) is to operate directly on
> the map.
> 
> myDynaproperties.getMap().put("foo", bar);
> 
> -Tim
> 
> -Original Message-
> From: Carlos Sanchez [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 13, 2003 3:21 PM
> To: 'Struts Users Mailing List'
> Subject: RE: DynaActionForms
> 
> 
> yourdynaform.set("propertyname",propertyvalue);
> 
> > -Mensaje original-
> > De: Edgar P Dollin [mailto:[EMAIL PROTECTED] 
> > Enviado el: lunes, 13 de octubre de 2003 19:35
> > Para: Struts Users Mailing List
> > Asunto: DynaActionForms
> > 
> > 
> > I have an application with configuration files already.  
> > Rather than have struts-config configure DynaForms, I would 
> > like to populate the forms myself.
> > 
> > Does anyone have any experience with how this behaves in struts?
> > 
> > Thanks
> > 
> > Edgar
> > 
> > -
> > 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]

-- 
Nick Heudecker
SystemMobile, Inc.
Email: [EMAIL PROTECTED]
Web: http://www.systemmobile.com

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



RE: DynaActionForms

2003-10-13 Thread Edgar P Dollin
Thanks for the input.  I did some more research and I think I understand the
forms a little better.

The following code will create a DynaActionForm with one String field:

FormBeanConfig formBean = new FormBeanConfig();
FormPropertyConfig fpc = null;

fpc = new FormPropertyConfig();
fpc.setName("testField1");
fpc.setType(java.lang.String.class.getName());
fpc.setInitial("testField1Value");

formBean.addFormPropertyConfig(fpc);

formBean.setType(org.apache.struts.action.DynaActionForm.class.getName());
formBean.freeze();

DynaActionFormClass dFC =
DynaActionFormClass.createDynaActionFormClass(formBean);
DynaActionForm dynaForm = (DynaActionForm)
dFC.newInstance();


I think I know the answer already (my apologies), but will this code break
with new releases of struts.

Thanks

Edgar

> -Original Message-
> From: Nick [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 13, 2003 2:41 PM
> To: Struts Users Mailing List
> Subject: Re: DynaActionForms
> 
> 
> I do not believe that you can do dynamically add fields to a 
> DynaForm, as the config is frozen at app startup.  Might work 
> with an internal HashMap though.
> 
> On Mon, Oct 13, 2003 at 03:31:32PM -0400, Chen, Gin wrote:
> > I'm assuming that he meant create a new property that is 
> not already 
> > defined in the struts-config. In which case I think your 
> reply would 
> > fail with an property not found type exception. :-/
> > One way around this is to have a Hashmap within the 
> hashmapped dynaform.
> > That will allow you to do something like:
> > 
> > Hashmap myDynaproperties = 
> (Hashmap)myDynaform.get("dynaProperties");
> > myDynaproperties.set("foo", bar);
> > Etc.
> > 
> > Another possibility (although I havent tried it) is to operate 
> > directly on the map.
> > 
> > myDynaproperties.getMap().put("foo", bar);
> > 
> > -Tim
> > 
> > -Original Message-
> > From: Carlos Sanchez [mailto:[EMAIL PROTECTED]
> > Sent: Monday, October 13, 2003 3:21 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: DynaActionForms
> > 
> > 
> > yourdynaform.set("propertyname",propertyvalue);
> > 
> > > -Mensaje original-
> > > De: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > > Enviado el: lunes, 13 de octubre de 2003 19:35
> > > Para: Struts Users Mailing List
> > > Asunto: DynaActionForms
> > > 
> > > 
> > > I have an application with configuration files already.
> > > Rather than have struts-config configure DynaForms, I would 
> > > like to populate the forms myself.
> > > 
> > > Does anyone have any experience with how this behaves in struts?
> > > 
> > > Thanks
> > > 
> > > Edgar
> > > 
> > > 
> 
> > > -
> > > 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]
> 
> -- 
> Nick Heudecker
> SystemMobile, Inc.
> Email: [EMAIL PROTECTED]
> Web: http://www.systemmobile.com
> 

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



RE: DynaActionForms

2003-10-13 Thread Robert Taylor
Edgar, have you thought about using indexed properties together with
ListUtils.lazylist()
with DynaActionForms.

I've successfully used them with DynaActionForms where my fields are
completely
dynamic.

Just a thought.

robert


> -Original Message-
> From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 13, 2003 4:39 PM
> To: Struts Users Mailing List
> Subject: RE: DynaActionForms
>
>
> Thanks for the input.  I did some more research and I think I
> understand the
> forms a little better.
>
> The following code will create a DynaActionForm with one String field:
>
>   FormBeanConfig formBean = new FormBeanConfig();
>   FormPropertyConfig fpc = null;
>
>   fpc = new FormPropertyConfig();
>   fpc.setName("testField1");
>   fpc.setType(java.lang.String.class.getName());
>   fpc.setInitial("testField1Value");
>
>   formBean.addFormPropertyConfig(fpc);
>
> formBean.setType(org.apache.struts.action.DynaActionForm.class.getName());
>   formBean.freeze();
>
>   DynaActionFormClass dFC =
> DynaActionFormClass.createDynaActionFormClass(formBean);
>   DynaActionForm dynaForm = (DynaActionForm)
> dFC.newInstance();
>
>
> I think I know the answer already (my apologies), but will this code break
> with new releases of struts.
>
> Thanks
>
> Edgar
>
> > -Original Message-
> > From: Nick [mailto:[EMAIL PROTECTED]
> > Sent: Monday, October 13, 2003 2:41 PM
> > To: Struts Users Mailing List
> > Subject: Re: DynaActionForms
> >
> >
> > I do not believe that you can do dynamically add fields to a
> > DynaForm, as the config is frozen at app startup.  Might work
> > with an internal HashMap though.
> >
> > On Mon, Oct 13, 2003 at 03:31:32PM -0400, Chen, Gin wrote:
> > > I'm assuming that he meant create a new property that is
> > not already
> > > defined in the struts-config. In which case I think your
> > reply would
> > > fail with an property not found type exception. :-/
> > > One way around this is to have a Hashmap within the
> > hashmapped dynaform.
> > > That will allow you to do something like:
> > >
> > > Hashmap myDynaproperties =
> > (Hashmap)myDynaform.get("dynaProperties");
> > > myDynaproperties.set("foo", bar);
> > > Etc.
> > >
> > > Another possibility (although I havent tried it) is to operate
> > > directly on the map.
> > >
> > > myDynaproperties.getMap().put("foo", bar);
> > >
> > > -Tim
> > >
> > > -Original Message-
> > > From: Carlos Sanchez [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, October 13, 2003 3:21 PM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: DynaActionForms
> > >
> > >
> > > yourdynaform.set("propertyname",propertyvalue);
> > >
> > > > -Mensaje original-
> > > > De: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > > > Enviado el: lunes, 13 de octubre de 2003 19:35
> > > > Para: Struts Users Mailing List
> > > > Asunto: DynaActionForms
> > > >
> > > >
> > > > I have an application with configuration files already.
> > > > Rather than have struts-config configure DynaForms, I would
> > > > like to populate the forms myself.
> > > >
> > > > Does anyone have any experience with how this behaves in struts?
> > > >
> > > > Thanks
> > > >
> > > > Edgar
> > > >
> > > >
> > 
> > > > -
> > > > 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]
> >
> > --
> > Nick Heudecker
> > SystemMobile, Inc.
> > Email: [EMAIL PROTECTED]
> > Web: http://www.systemmobile.com
> >
>
> -
> 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]



RE: DynaActionForms

2003-10-14 Thread Mark Galbreath
Yes.

-Original Message-
From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
Sent: Monday, October 13, 2003 1:35 PM

...I would like to populate the (DynaAction)forms myself.

Does anyone have any experience with how this behaves in struts?


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



RE: DynaActionForms

2003-10-14 Thread Edgar P Dollin
Interesting idea.  My other choice is to stick a map in a standard action
form.  What view technology are you using with these lists?

Edgar

> -Original Message-
> From: Robert Taylor [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 13, 2003 4:07 PM
> To: Struts Users Mailing List
> Subject: RE: DynaActionForms
> 
> 
> Edgar, have you thought about using indexed properties together with
> ListUtils.lazylist()
> with DynaActionForms.
> 
> I've successfully used them with DynaActionForms where my 
> fields are completely dynamic.
> 
> Just a thought.
> 
> robert
> 
> 
> > -Original Message-
> > From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > Sent: Monday, October 13, 2003 4:39 PM
> > To: Struts Users Mailing List
> > Subject: RE: DynaActionForms
> >
> >
> > Thanks for the input.  I did some more research and I think I 
> > understand the forms a little better.
> >
> > The following code will create a DynaActionForm with one 
> String field:
> >
> > FormBeanConfig formBean = new FormBeanConfig();
> > FormPropertyConfig fpc = null;
> >
> > fpc = new FormPropertyConfig();
> > fpc.setName("testField1");
> > fpc.setType(java.lang.String.class.getName());
> > fpc.setInitial("testField1Value");
> >
> > formBean.addFormPropertyConfig(fpc);
> >
> > 
> formBean.setType(org.apache.struts.action.DynaActionForm.class
> .getName());
> > formBean.freeze();
> >
> > DynaActionFormClass dFC = 
> > DynaActionFormClass.createDynaActionFormClass(formBean);
> > DynaActionForm dynaForm = (DynaActionForm) 
> dFC.newInstance();
> >
> >
> > I think I know the answer already (my apologies), but will 
> this code 
> > break with new releases of struts.
> >
> > Thanks
> >
> > Edgar
> >
> > > -Original Message-
> > > From: Nick [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, October 13, 2003 2:41 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: DynaActionForms
> > >
> > >
> > > I do not believe that you can do dynamically add fields to a 
> > > DynaForm, as the config is frozen at app startup.  Might 
> work with 
> > > an internal HashMap though.
> > >
> > > On Mon, Oct 13, 2003 at 03:31:32PM -0400, Chen, Gin wrote:
> > > > I'm assuming that he meant create a new property that is
> > > not already
> > > > defined in the struts-config. In which case I think your
> > > reply would
> > > > fail with an property not found type exception. :-/
> > > > One way around this is to have a Hashmap within the
> > > hashmapped dynaform.
> > > > That will allow you to do something like:
> > > >
> > > > Hashmap myDynaproperties =
> > > (Hashmap)myDynaform.get("dynaProperties");
> > > > myDynaproperties.set("foo", bar);
> > > > Etc.
> > > >
> > > > Another possibility (although I havent tried it) is to operate 
> > > > directly on the map.
> > > >
> > > > myDynaproperties.getMap().put("foo", bar);
> > > >
> > > > -Tim
> > > >
> > > > -Original Message-
> > > > From: Carlos Sanchez [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, October 13, 2003 3:21 PM
> > > > To: 'Struts Users Mailing List'
> > > > Subject: RE: DynaActionForms
> > > >
> > > >
> > > > yourdynaform.set("propertyname",propertyvalue);
> > > >
> > > > > -Mensaje original-
> > > > > De: Edgar P Dollin [mailto:[EMAIL PROTECTED] Enviado el: 
> > > > > lunes, 13 de octubre de 2003 19:35
> > > > > Para: Struts Users Mailing List
> > > > > Asunto: DynaActionForms
> > > > >
> > > > >
> > > > > I have an application with configuration files 
> already. Rather 
> > > > > than have struts-config configure DynaForms, I would like to 
> > > > > populate the forms myself.
> > > > >
> > > > > Does anyone have any experience with how this behaves 
> in struts?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Edgar
> > > > >
> > > > >
> > > 

RE: DynaActionForms

2003-10-14 Thread Robert Taylor
I'm not sure what you mean when you ask "what view technology".

You can find ListUtils here:
http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect
ions/ListUtils.html

I've rendered these lists using a variety of 
components - checkboxes, multiboxes, select lists, text, hidden, etc...

I admit, I had a hard time getting my head around how to use indexed
properties
and dynamically generated fields but they work. You will most likely have to
subclass the DynaActionForm and override the reset().

Heres a link to using indexed properties:
http://jakarta.apache.org/struts/faqs/indexedprops.html

Let me know if I answered your question.

robert

> -Original Message-
> From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 14, 2003 8:12 AM
> To: Struts Users Mailing List
> Subject: RE: DynaActionForms
>
>
> Interesting idea.  My other choice is to stick a map in a standard action
> form.  What view technology are you using with these lists?
>
> Edgar
>
> > -Original Message-
> > From: Robert Taylor [mailto:[EMAIL PROTECTED]
> > Sent: Monday, October 13, 2003 4:07 PM
> > To: Struts Users Mailing List
> > Subject: RE: DynaActionForms
> >
> >
> > Edgar, have you thought about using indexed properties together with
> > ListUtils.lazylist()
> > with DynaActionForms.
> >
> > I've successfully used them with DynaActionForms where my
> > fields are completely dynamic.
> >
> > Just a thought.
> >
> > robert
> >
> >
> > > -Original Message-
> > > From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, October 13, 2003 4:39 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: DynaActionForms
> > >
> > >
> > > Thanks for the input.  I did some more research and I think I
> > > understand the forms a little better.
> > >
> > > The following code will create a DynaActionForm with one
> > String field:
> > >
> > >   FormBeanConfig formBean = new FormBeanConfig();
> > >   FormPropertyConfig fpc = null;
> > >
> > >   fpc = new FormPropertyConfig();
> > >   fpc.setName("testField1");
> > >   fpc.setType(java.lang.String.class.getName());
> > >   fpc.setInitial("testField1Value");
> > >
> > >   formBean.addFormPropertyConfig(fpc);
> > >
> > >
> > formBean.setType(org.apache.struts.action.DynaActionForm.class
> > .getName());
> > >   formBean.freeze();
> > >
> > >   DynaActionFormClass dFC =
> > > DynaActionFormClass.createDynaActionFormClass(formBean);
> > >   DynaActionForm dynaForm = (DynaActionForm)
> > dFC.newInstance();
> > >
> > >
> > > I think I know the answer already (my apologies), but will
> > this code
> > > break with new releases of struts.
> > >
> > > Thanks
> > >
> > > Edgar
> > >
> > > > -Original Message-
> > > > From: Nick [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, October 13, 2003 2:41 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: DynaActionForms
> > > >
> > > >
> > > > I do not believe that you can do dynamically add fields to a
> > > > DynaForm, as the config is frozen at app startup.  Might
> > work with
> > > > an internal HashMap though.
> > > >
> > > > On Mon, Oct 13, 2003 at 03:31:32PM -0400, Chen, Gin wrote:
> > > > > I'm assuming that he meant create a new property that is
> > > > not already
> > > > > defined in the struts-config. In which case I think your
> > > > reply would
> > > > > fail with an property not found type exception. :-/
> > > > > One way around this is to have a Hashmap within the
> > > > hashmapped dynaform.
> > > > > That will allow you to do something like:
> > > > >
> > > > > Hashmap myDynaproperties =
> > > > (Hashmap)myDynaform.get("dynaProperties");
> > > > > myDynaproperties.set("foo", bar);
> > > > > Etc.
> > > > >
> > > > > Another possibility (although I havent tried it) is to operate
> > > > > directly on the map.
> > > > >
> > > > > my

RE: DynaActionForms

2003-10-14 Thread Edgar P Dollin
Doesn't this answer require an [OT] designation.

> -Original Message-
> From: Mark Galbreath [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, October 14, 2003 7:03 AM
> To: Struts Users Mailing List
> Subject: RE: DynaActionForms
> 
> 
> Yes.
> 
> -Original Message-
> From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 13, 2003 1:35 PM
> 
> ...I would like to populate the (DynaAction)forms myself.
> 
> Does anyone have any experience with how this behaves in struts?
> 
> 

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



RE: DynaActionForms

2003-10-14 Thread Edgar P Dollin
My question was regarding, JSTL, Velocity, etc.  I prefer the standard tags
with the nested extensions and standard JSP expressions (I can read the JSP
after I walk away for a week), which is probably what I will end up doing.  

Yes, you answered my question.

I don't use reset, if I can help it.  BTW, since you are really putting a
collection in a form, do you really need to use a DynaForm?

Thanks

Edgar

> -Original Message-
> From: Robert Taylor [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, October 14, 2003 8:18 AM
> To: Struts Users Mailing List
> Subject: RE: DynaActionForms
> 
> 
> I'm not sure what you mean when you ask "what view technology".
> 
> You can find ListUtils here: 
> http://jakarta.apache.org/commons/collections/api/org/apache/c
> ommons/collect
> ions/ListUtils.html
> 
> I've rendered these lists using a variety of  
> components - checkboxes, multiboxes, select lists, text, 
> hidden, etc...
> 
> I admit, I had a hard time getting my head around how to use 
> indexed properties and dynamically generated fields but they 
> work. You will most likely have to subclass the 
> DynaActionForm and override the reset().
> 
> Heres a link to using indexed properties: 
> http://jakarta.apache.org/struts/faqs/indexedprops.html
> 
> Let me know if I answered your question.
> 
> robert
> 
> > -Original Message-
> > From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, October 14, 2003 8:12 AM
> > To: Struts Users Mailing List
> > Subject: RE: DynaActionForms
> >
> >
> > Interesting idea.  My other choice is to stick a map in a standard 
> > action form.  What view technology are you using with these lists?
> >
> > Edgar
> >
> > > -Original Message-
> > > From: Robert Taylor [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, October 13, 2003 4:07 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: DynaActionForms
> > >
> > >
> > > Edgar, have you thought about using indexed properties 
> together with
> > > ListUtils.lazylist()
> > > with DynaActionForms.
> > >
> > > I've successfully used them with DynaActionForms where my 
> fields are 
> > > completely dynamic.
> > >
> > > Just a thought.
> > >
> > > robert
> > >
> > >
> > > > -Original Message-
> > > > From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, October 13, 2003 4:39 PM
> > > > To: Struts Users Mailing List
> > > > Subject: RE: DynaActionForms
> > > >
> > > >
> > > > Thanks for the input.  I did some more research and I think I 
> > > > understand the forms a little better.
> > > >
> > > > The following code will create a DynaActionForm with one
> > > String field:
> > > >
> > > > FormBeanConfig formBean = new FormBeanConfig();
> > > > FormPropertyConfig fpc = null;
> > > >
> > > > fpc = new FormPropertyConfig();
> > > > fpc.setName("testField1");
> > > > fpc.setType(java.lang.String.class.getName());
> > > > fpc.setInitial("testField1Value");
> > > >
> > > > formBean.addFormPropertyConfig(fpc);
> > > >
> > > >
> > > formBean.setType(org.apache.struts.action.DynaActionForm.class
> > > .getName());
> > > > formBean.freeze();
> > > >
> > > > DynaActionFormClass dFC = 
> > > > DynaActionFormClass.createDynaActionFormClass(formBean);
> > > > DynaActionForm dynaForm = (DynaActionForm)
> > > dFC.newInstance();
> > > >
> > > >
> > > > I think I know the answer already (my apologies), but will
> > > this code
> > > > break with new releases of struts.
> > > >
> > > > Thanks
> > > >
> > > > Edgar
> > > >
> > > > > -Original Message-
> > > > > From: Nick [mailto:[EMAIL PROTECTED]
> > > > > Sent: Monday, October 13, 2003 2:41 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Re: DynaActionForms
> > > > >
> > > > >
> > > > > I do not believe that you can do dynamically add fields to a 
> > > > > DynaF

RE: DynaActionForms

2003-10-14 Thread Robert Taylor
I tend to use DynaActionForms exclusively because they are easy 
to create (declarative). I haven't had a need to use non "Dyna"
ActionForms.

robert

> -Original Message-
> From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 14, 2003 10:15 AM
> To: Struts Users Mailing List
> Subject: RE: DynaActionForms
> 
> 
> My question was regarding, JSTL, Velocity, etc.  I prefer the 
> standard tags
> with the nested extensions and standard JSP expressions (I can 
> read the JSP
> after I walk away for a week), which is probably what I will end 
> up doing.  
> 
> Yes, you answered my question.
> 
> I don't use reset, if I can help it.  BTW, since you are really putting a
> collection in a form, do you really need to use a DynaForm?
> 
> Thanks
> 
> Edgar
> 
> > -Original Message-
> > From: Robert Taylor [mailto:[EMAIL PROTECTED] 
> > Sent: Tuesday, October 14, 2003 8:18 AM
> > To: Struts Users Mailing List
> > Subject: RE: DynaActionForms
> > 
> > 
> > I'm not sure what you mean when you ask "what view technology".
> > 
> > You can find ListUtils here: 
> > http://jakarta.apache.org/commons/collections/api/org/apache/c
> > ommons/collect
> > ions/ListUtils.html
> > 
> > I've rendered these lists using a variety of  
> > components - checkboxes, multiboxes, select lists, text, 
> > hidden, etc...
> > 
> > I admit, I had a hard time getting my head around how to use 
> > indexed properties and dynamically generated fields but they 
> > work. You will most likely have to subclass the 
> > DynaActionForm and override the reset().
> > 
> > Heres a link to using indexed properties: 
> > http://jakarta.apache.org/struts/faqs/indexedprops.html
> > 
> > Let me know if I answered your question.
> > 
> > robert
> > 
> > > -Original Message-
> > > From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, October 14, 2003 8:12 AM
> > > To: Struts Users Mailing List
> > > Subject: RE: DynaActionForms
> > >
> > >
> > > Interesting idea.  My other choice is to stick a map in a standard 
> > > action form.  What view technology are you using with these lists?
> > >
> > > Edgar
> > >
> > > > -Original Message-
> > > > From: Robert Taylor [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, October 13, 2003 4:07 PM
> > > > To: Struts Users Mailing List
> > > > Subject: RE: DynaActionForms
> > > >
> > > >
> > > > Edgar, have you thought about using indexed properties 
> > together with
> > > > ListUtils.lazylist()
> > > > with DynaActionForms.
> > > >
> > > > I've successfully used them with DynaActionForms where my 
> > fields are 
> > > > completely dynamic.
> > > >
> > > > Just a thought.
> > > >
> > > > robert
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > > > > Sent: Monday, October 13, 2003 4:39 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: RE: DynaActionForms
> > > > >
> > > > >
> > > > > Thanks for the input.  I did some more research and I think I 
> > > > > understand the forms a little better.
> > > > >
> > > > > The following code will create a DynaActionForm with one
> > > > String field:
> > > > >
> > > > >   FormBeanConfig formBean = new FormBeanConfig();
> > > > >   FormPropertyConfig fpc = null;
> > > > >
> > > > >   fpc = new FormPropertyConfig();
> > > > >   fpc.setName("testField1");
> > > > >   fpc.setType(java.lang.String.class.getName());
> > > > >   fpc.setInitial("testField1Value");
> > > > >
> > > > >   formBean.addFormPropertyConfig(fpc);
> > > > >
> > > > >
> > > > formBean.setType(org.apache.struts.action.DynaActionForm.class
> > > > .getName());
> > > > >   formBean.freeze();
> > > > >
> > > > >   DynaActionFormClass dFC = 
> > > > > DynaActionFormClass.createDynaActionFormCla

Re: DynaActionForms

2003-10-14 Thread balaji

- Original Message -
From: "Robert Taylor" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 14, 2003 6:47 PM
Subject: RE: DynaActionForms


> I'm not sure what you mean when you ask "what view technology".
>
> You can find ListUtils here:
>
http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect
> ions/ListUtils.html
>
> I've rendered these lists using a variety of 
> components - checkboxes, multiboxes, select lists, text, hidden, etc...
>
> I admit, I had a hard time getting my head around how to use indexed
> properties
> and dynamically generated fields but they work. You will most likely have
to
> subclass the DynaActionForm and override the reset().
>
> Heres a link to using indexed properties:
> http://jakarta.apache.org/struts/faqs/indexedprops.html
>
> Let me know if I answered your question.
>
> robert
>
> > -Original Message-
> > From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, October 14, 2003 8:12 AM
> > To: Struts Users Mailing List
> > Subject: RE: DynaActionForms
> >
> >
> > Interesting idea.  My other choice is to stick a map in a standard
action
> > form.  What view technology are you using with these lists?
> >
> > Edgar
> >
> > > -Original Message-
> > > From: Robert Taylor [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, October 13, 2003 4:07 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: DynaActionForms
> > >
> > >
> > > Edgar, have you thought about using indexed properties together with
> > > ListUtils.lazylist()
> > > with DynaActionForms.
> > >
> > > I've successfully used them with DynaActionForms where my
> > > fields are completely dynamic.
> > >
> > > Just a thought.
> > >
> > > robert
> > >
> > >
> > > > -Original Message-
> > > > From: Edgar P Dollin [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, October 13, 2003 4:39 PM
> > > > To: Struts Users Mailing List
> > > > Subject: RE: DynaActionForms
> > > >
> > > >
> > > > Thanks for the input.  I did some more research and I think I
> > > > understand the forms a little better.
> > > >
> > > > The following code will create a DynaActionForm with one
> > > String field:
> > > >
> > > > FormBeanConfig formBean = new FormBeanConfig();
> > > > FormPropertyConfig fpc = null;
> > > >
> > > > fpc = new FormPropertyConfig();
> > > > fpc.setName("testField1");
> > > > fpc.setType(java.lang.String.class.getName());
> > > > fpc.setInitial("testField1Value");
> > > >
> > > > formBean.addFormPropertyConfig(fpc);
> > > >
> > > >
> > > formBean.setType(org.apache.struts.action.DynaActionForm.class
> > > .getName());
> > > > formBean.freeze();
> > > >
> > > > DynaActionFormClass dFC =
> > > > DynaActionFormClass.createDynaActionFormClass(formBean);
> > > > DynaActionForm dynaForm = (DynaActionForm)
> > > dFC.newInstance();
> > > >
> > > >
> > > > I think I know the answer already (my apologies), but will
> > > this code
> > > > break with new releases of struts.
> > > >
> > > > Thanks
> > > >
> > > > Edgar
> > > >
> > > > > -Original Message-
> > > > > From: Nick [mailto:[EMAIL PROTECTED]
> > > > > Sent: Monday, October 13, 2003 2:41 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Re: DynaActionForms
> > > > >
> > > > >
> > > > > I do not believe that you can do dynamically add fields to a
> > > > > DynaForm, as the config is frozen at app startup.  Might
> > > work with
> > > > > an internal HashMap though.
> > > > >
> > > > > On Mon, Oct 13, 2003 at 03:31:32PM -0400, Chen, Gin wrote:
> > > > > > I'm assuming that he meant create a new property that is
> > > > > not already
> > > > > > defined in the struts-config. In which case I think your
> > > > > reply would
> > > > > > fail with an property not found type exception. :-/
> > > > > > One way

nested DynaActionForms

2003-02-05 Thread J Beginner
How do i get nested beans using DynaActionForms?

Eg:I have two jsps with UserPasswordCredentials as the
common fields.
So I need a DynaActionForm with properties userName,
Password that will be nested within two other
DynaActionForms.

This is my first venture with Struts, so please have
patience with me. :-)

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




DynaActionForms - solved...

2003-02-06 Thread Robert S. Sfeir

Ok if I got everything correctly, I've setup the form in the struts 
config file then did this in my action:

	public ActionForward execute(
		ActionMapping mapping , ActionForm form , HttpServletRequest request ,
		HttpServletResponse response ) throws DatastoreException
	{
		UserDAO userImpl = DAOFactory.getDAOFactory( Constants.DAO_FACTORY 
).createUserDAO();
		UserBO user = new UserBO();
		DynaActionForm dForm = ( DynaActionForm ) form;

		user.setAccountStatus( ( String ) dForm.get( "accountStatus" ) );
		user.setUserID( ( Integer )dForm .get( "userID" ) );
		...
		//Adds user via DAO impl with OJB
		userImpl.addUser(user);
	}

If I understand this correctly, I can either have one form with all the 
possible fields in my application (YUK) or organize the fields by 
functionality of my application... like in this case it's called the 
securityForm and contains everything about a user, the address, phone 
info, group info etc... and I use it for registration, login, but not 
things like credit card for the store, since the store would have its 
own form for the credit card data and all that.

Is that pretty much the gist of it?  Or is there more to this?  It's 
pretty awesome just like that!

I noticed there was a size value for each field, is that to make sure 
that the value does not exceed a certain length?  if no isn't that what 
the validator is supposed to do?

Thanks
R


R

--
Robert S. Sfeir
Senior Java Engineer
National Institutes of Health
Center for Information Technology
Department of Enterprise Custom Applications
[EMAIL PROTECTED]


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



Dynamic DynaActionForms?

2003-06-10 Thread David Tobey
Hello all:

I'm writing what (I hope) will be a highly-configurable generic shopping 
cart program using (we hope) Struts. My issue is I want to be able to 
modify the elements of various forms on the fly, and I'm struggling with 
the best way to do this. For example, I have defined an order form as a 
subclass of DynaActionForm, like so:


 
  
  
  
  
  
  
  
  
...
  
  
  
  
...


Within this form I would like to be able to swap out different fields, 
depending on if the shopping cart is configured in certain ways. For 
example if instead of capturing credit card information, the store 
administrator wants to capture a purchase order number and an account id 
number.

The administrator must be able to change settings like this in a 
separate web-based application talking to a database (not by logging on 
to the server and modifying the config files!). I have no problem 
reading the settings from the database and exposing them to the view and 
to the controller. The issue is what's the best to dynamically change 
the fields in this DynaActionForm given the database settings.

My thoughts are revolving around two options:

1. Subclass the RequestProcessor. I could create mutilple ActionForms, 
one for address info, one for credit card info, and one for PO info, and 
then revamp the RequestProcessor to accept more than one Form per 
action, and populate and validate each one in turn. (During validation, 
I could check the settings to find out which of the optional forms must 
pass validation.)

2. Write functions to dynamically modify the struts-config.xml file and 
reload the settings whenever the administrator changes what information 
they want to collect. The problem with this is I have to worry about 
file locking, and interruptions in service as the configuration is 
reloaded. (Has anyone written tools to modify the config file through a 
web application?)

If anyone has come across or has any thoughts about the best way to 
approach this sort of thing, I would be very grateful to hear what you 
have to say.

Many thanks,
dave
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Problem with DynaActionForms

2003-07-10 Thread Richard Stack
I'm implementing DynaActionform for the first time. I'm defining them in 
struts-config.xml.

name="loginForm"
dynamic="true"
type="org.apache.struts.validator.DynaValidatorForm">


 


   
   
 
The problem seems to be when I try to reference the form in the Action 
class's execute method. I get an error message in LoginAction 
"Unresolved symbol LoginForm".

public ActionForward execute(){
String userName = ((LoginForm)form).getUserName();
String password = ((LoginForm)form).getPassword();
}
Anyone have an idea where I went wrong?

Richard

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


Re: Dynamic DynaActionForms?

2003-06-11 Thread Sandeep Takhar
Why not have the form capture all the info.

Have the administrator control a switch to suggest
which radio boxes should appear and if they only
choose one then don't show any radio boxes.

After filling in the address info have a next button
and take them to the additional info about credit etc.

At this point you can validate according to the radio
button (which will be auto-populated according to how
the user selected).

I have always found it better to add all the
attributes instead of getting too fancy on the
actionForms.

I believe Ted Husted mentions the same in his book. 
This is more like a "Domain DTO" pattern for action
forms.

sandeep
--- David Tobey <[EMAIL PROTECTED]> wrote:
> Hello all:
> 
> I'm writing what (I hope) will be a
> highly-configurable generic shopping 
> cart program using (we hope) Struts. My issue is I
> want to be able to 
> modify the elements of various forms on the fly, and
> I'm struggling with 
> the best way to do this. For example, I have defined
> an order form as a 
> subclass of DynaActionForm, like so:
> 
> 
>type="org.netpush.cart.customer.order.OrderForm">
> type="java.lang.String"/>
> type="java.lang.String"/>
> type="java.lang.String"/>
> type="java.lang.String"/>
> type="java.lang.String"/>
> type="java.lang.String"/>
> type="java.lang.String"/>
> type="java.lang.String"/>
> ...
> type="java.lang.String"/>
> type="java.lang.String"/>
> type="java.lang.String"/>
> type="java.lang.String"/>
> ...
> 
> 
> Within this form I would like to be able to swap out
> different fields, 
> depending on if the shopping cart is configured in
> certain ways. For 
> example if instead of capturing credit card
> information, the store 
> administrator wants to capture a purchase order
> number and an account id 
> number.
> 
> The administrator must be able to change settings
> like this in a 
> separate web-based application talking to a database
> (not by logging on 
> to the server and modifying the config files!). I
> have no problem 
> reading the settings from the database and exposing
> them to the view and 
> to the controller. The issue is what's the best to
> dynamically change 
> the fields in this DynaActionForm given the database
> settings.
> 
> My thoughts are revolving around two options:
> 
> 1. Subclass the RequestProcessor. I could create
> mutilple ActionForms, 
> one for address info, one for credit card info, and
> one for PO info, and 
> then revamp the RequestProcessor to accept more than
> one Form per 
> action, and populate and validate each one in turn.
> (During validation, 
> I could check the settings to find out which of the
> optional forms must 
> pass validation.)
> 
> 2. Write functions to dynamically modify the
> struts-config.xml file and 
> reload the settings whenever the administrator
> changes what information 
> they want to collect. The problem with this is I
> have to worry about 
> file locking, and interruptions in service as the
> configuration is 
> reloaded. (Has anyone written tools to modify the
> config file through a 
> web application?)
> 
> If anyone has come across or has any thoughts about
> the best way to 
> approach this sort of thing, I would be very
> grateful to hear what you 
> have to say.
> 
> Many thanks,
> dave
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



RE: Problem with DynaActionForms

2003-07-10 Thread Tan Khay Ong
You are using the Dynamic form. It doesn't create java class for
loginForm.
All values are stored in the Map of DynaValidatorFrom. You can retrieve
form value as below.

DynaValidatorForm dyform = (DynaValidator) form;
String userName = (String) dyform.get("userName");
String password = (String) dyform.get("password");

-Original Message-
From: Richard Stack [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 11, 2003 9:08 AM
To: [EMAIL PROTECTED]
Subject: Problem with DynaActionForms


I'm implementing DynaActionform for the first time. I'm defining them in

struts-config.xml.

 
 
  




  

The problem seems to be when I try to reference the form in the Action 
class's execute method. I get an error message in LoginAction 
"Unresolved symbol LoginForm".

public ActionForward execute(){
String userName = ((LoginForm)form).getUserName();
String password = ((LoginForm)form).getPassword();
}

Anyone have an idea where I went wrong?

Richard


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



Re: Problem with DynaActionForms

2003-07-12 Thread Richard Stack
Thanks That solved my problem.

Richard

Tan Khay Ong wrote:
You are using the Dynamic form. It doesn't create java class for
loginForm.
All values are stored in the Map of DynaValidatorFrom. You can retrieve
form value as below.
DynaValidatorForm dyform = (DynaValidator) form;
String userName = (String) dyform.get("userName");
String password = (String) dyform.get("password");
-Original Message-
From: Richard Stack [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 11, 2003 9:08 AM
To: [EMAIL PROTECTED]
Subject: Problem with DynaActionForms

I'm implementing DynaActionform for the first time. I'm defining them in

struts-config.xml.

 
 
  



  
The problem seems to be when I try to reference the form in the Action 
class's execute method. I get an error message in LoginAction 
"Unresolved symbol LoginForm".

public ActionForward execute(){
String userName = ((LoginForm)form).getUserName();
String password = ((LoginForm)form).getPassword();
}
Anyone have an idea where I went wrong?

Richard

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


DynaActionForms and html:text tags

2003-08-18 Thread Louise Pryor
I'm having problems getting a DynaActionForm to work with a jsp page,
and wondered if anyone could help.

I've defined all the properties in the DynaActionForm using
 tags. They all have type java.lang.String. The form
is mapped to the Action in the usual way. Actual extracts from the
files at the end of this message.

I have a jsp page with an html:form tag that refers to the action. The
trouble is, that none of the html:text tags work (they refer to
properties as defined in the form). The symptom of the not working is
org.apache.jasper.JasperException: No getter method for property
 of bean org.apache.struts.taglib.html.BEAN

An html:hidden tag and an html:password tag on the same form work
fine. Could this be something to do with the fact that the hidden tag
has a value set, and the password tag has redisplay="false", so that
neither of them are looking in the form bean for values?

Any help would be greatly appreciated. I am sure there is something
basic I haven't done right, but I can't think what.

-- 
Louise Pryor 
http://www.louisepryor.com

-
from struts-config.xml

   
   
   ...


from the jsp file:






  
:

  

  
:


  
  (the error happens on email



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



When to use DynaActionForms?

2003-06-05 Thread Barry Volpe
The docs say:
DynaActionForms are meant as an easy solution to a common problem: Your ActionForms 
use simple properties and standard validations, and you just pass these properties 
over to another JavaBean (say using BeanUtils.copyProperties(myBusinessBean,form)). 

Does this mean for example I would not use DynaActionForms where I require a form 
object in an Action that I am going to

use to populate a database?

If I require referencing a form object in an Action can I still use a DynaActionForm?



Thanks,

Barry







Re: DynaActionForms and html:text tags

2003-08-18 Thread Dirk Markert
Hello Louise,

  can you post your action mapping? Everything else looks fine.

***

LP> I'm having problems getting a DynaActionForm to work with a jsp page,
LP> and wondered if anyone could help.

LP> I've defined all the properties in the DynaActionForm using
LP>  tags. They all have type java.lang.String. The form
LP> is mapped to the Action in the usual way. Actual extracts from the
LP> files at the end of this message.

LP> I have a jsp page with an html:form tag that refers to the action. The
LP> trouble is, that none of the html:text tags work (they refer to
LP> properties as defined in the form). The symptom of the not working is
LP> org.apache.jasper.JasperException: No getter method for property
LP>  of bean org.apache.struts.taglib.html.BEAN

LP> An html:hidden tag and an html:password tag on the same form work
LP> fine. Could this be something to do with the fact that the hidden tag
LP> has a value set, and the password tag has redisplay="false", so that
LP> neither of them are looking in the form bean for values?

LP> Any help would be greatly appreciated. I am sure there is something
LP> basic I haven't done right, but I can't think what.




Regards,
Dirk

+--- Quality leads ---+
| Dirk Markert [EMAIL PROTECTED] |
| Dr. Markert Softwaretechnik AG  |
| Joseph-von-Fraunhofer-Str. 20   |
| 44227 Dortmund  |
+-->>> to success! <<-+ 


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



Re: DynaActionForms and html:text tags

2003-08-18 Thread Louise Pryor

On Monday, August 18, 2003 at 11:59:46 AM, Dirk Markert wrote:

DM> Hello Louise,

DM>   can you post your action mapping? Everything else looks fine.

   
  
  

DM> ***

LP>> I'm having problems getting a DynaActionForm to work with a jsp page,
LP>> and wondered if anyone could help.

LP>> I've defined all the properties in the DynaActionForm using
LP>>  tags. They all have type java.lang.String. The form
LP>> is mapped to the Action in the usual way. Actual extracts from the
LP>> files at the end of this message.

LP>> I have a jsp page with an html:form tag that refers to the action. The
LP>> trouble is, that none of the html:text tags work (they refer to
LP>> properties as defined in the form). The symptom of the not working is
LP>> org.apache.jasper.JasperException: No getter method for property
LP>>  of bean org.apache.struts.taglib.html.BEAN

LP>> An html:hidden tag and an html:password tag on the same form work
LP>> fine. Could this be something to do with the fact that the hidden tag
LP>> has a value set, and the password tag has redisplay="false", so that
LP>> neither of them are looking in the form bean for values?

LP>> Any help would be greatly appreciated. I am sure there is something
LP>> basic I haven't done right, but I can't think what.





-- 
Louise Pryor
http://www.louisepryor.com



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



RE: DynaActionForms and html:text tags

2003-08-18 Thread Hue Holleran
How are you accessing your page - if you're calling the jsp direct then then
struts will not have the opportunity to put the bean into scope for you?

Hue.

> -Original Message-
> From: Louise Pryor [mailto:[EMAIL PROTECTED]
> Sent: 18 August 2003 11:29
> To: Struts Users Mailing List
> Subject: DynaActionForms and html:text tags
>
>
> I'm having problems getting a DynaActionForm to work with a jsp page,
> and wondered if anyone could help.
>
> I've defined all the properties in the DynaActionForm using
>  tags. They all have type java.lang.String. The form
> is mapped to the Action in the usual way. Actual extracts from the
> files at the end of this message.
>
> I have a jsp page with an html:form tag that refers to the action. The
> trouble is, that none of the html:text tags work (they refer to
> properties as defined in the form). The symptom of the not working is
> org.apache.jasper.JasperException: No getter method for property
>  of bean org.apache.struts.taglib.html.BEAN
>
> An html:hidden tag and an html:password tag on the same form work
> fine. Could this be something to do with the fact that the hidden tag
> has a value set, and the password tag has redisplay="false", so that
> neither of them are looking in the form bean for values?
>
> Any help would be greatly appreciated. I am sure there is something
> basic I haven't done right, but I can't think what.
>
> --
> Louise Pryor
> http://www.louisepryor.com
>
> -
> from struts-config.xml
>  type="org.apache.struts.actions.DynaActionForm">
>
>
>...
> 
>
> from the jsp file:
>
> 
>
> 
>
> 
>   
> :
>  redisplay="false" />
>   
>
>   
> :
> 
> 
>   
>   (the error happens on email
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003


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



Re: DynaActionForms and html:text tags

2003-08-18 Thread Louise Pryor

On Monday, August 18, 2003 at 12:25:38 PM, Dirk Markert wrote:

DM> Hello Louise,
DM>   what's the action and its mapping you are using to forward to your
DM>   jsp containing

DM>   
DM>   

On Monday, August 18, 2003 at 12:22:31 PM, Hue Holleran wrote:

HH> How are you accessing your page - if you're calling the jsp direct then then
HH> struts will not have the opportunity to put the bean into scope for you?

Thanks. It looks like we are converging on an answer. I am calling the
jsp direct. From what you say it looks as if I should go via an
action. What should that action do, or what should its mapping
contain, to make things work?

-- 
Louise Pryor
http://www.louisepryor.com



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



RE: DynaActionForms and html:text tags

2003-08-18 Thread Hue Holleran
Hi,

One option would be to use the "input" attribute of the action or
alternatively use DispatchAction to setup the data for your form. In all
cases the recommendation is that you should not go directly to your .jsp but
always go through an action. To enforce this most people put .jsp files
under WEB-INF (I'm not a fan of this approach) or use a security-contraint
in web.xml, e.g. the following prohibits access to "/content/*" and
"/tiles-layouts/*" in your webapp:




TilesComponents
Application JSP Components
/content/*
/tiles-layouts/*
GET
POST


inaccessible


NONE



Using the "input" attribute is probably simpler - you need to determine a
condition in your action that means it is just the initialisation phase and
return the following:

return (new ActionForward(mapping.getInput()));

... that will fwd to your .jsp defined in the "input" attribute of your
action.

My preferred option is to use DispatchAction in combination with the "input"
attribute of the action that is beneficial when dealing with validation:





This action can then be called with various "dispatch" parameters that
perform, e.g. initialisation, update etc. So, for instance the link to this
action to setup the form would be something like:

Data entry Form

Or, alternatively use a global-forward that appends this parameter (in
struts-config):

...

...

...

...

... and then the following format for the html:link in the .jsp that will
call the data-entry page:

Data entry Form

Your form would then post to, say:

...

...

So, you need an action with 2 methods: "init" and "post", say an action
class similar to the following:

package tld.domain.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

import org.apache.struts.action.DynaActionForm;

import org.apache.struts.actions.DispatchAction;

public final class MyAction extends DispatchAction {

// This will be called when parameter (i.e. "dispatch") = "init"
public ActionForward init(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
// Get a reference to the form bean
DynaActionForm dynaForm = (DynaActionForm) form;
// Set some default parameters for this scenario
dynaForm.set("amount", "1");
// Fwd to the "input" mapping
return (new ActionForward(mapping.getInput()));
}

// This will be called when parameter (i.e. "dispatch") = "post"
public ActionForward post(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
// Get a reference to the form bean
DynaActionForm dynaForm = (DynaActionForm) form;
// Do some custom validation (or delegate to model)
if ... {
// Add some error messages here
...
// Error - return to input mapping
// so user can see errors and re-submit
return (new ActionForward(mapping.getInput()));
}
// We got here - so all must have OK - forward to "Success" page
return (mapping.findForward("Success"));
}
}


Hope that makes sense - it was copy-and-pasted from various places. Please
post back if this does not work!

Hue.


> -Original Message-
> From: Louise Pryor [mailto:[EMAIL PROTECTED]
> Sent: 18 August 2003 12:33
> To: Dirk Markert; Struts Users Mailing List; Hue Holleran
> Subject: Re: DynaActionForms and html:text tags
>
>
>
> On Monday, August 18, 2003 at 12:25:38 PM, Dirk Markert wrote:
>
> DM> Hello Louise,
> DM>   what's the action and its mapping you are using to forward to your
> DM>

Checkboxes with session-scoped DynaActionForms

2003-12-17 Thread Sgarlata Matt
Does anyone know a good reference on how to use checkboxes with
session-scoped DynaActionForms?  The problem I am running into is that when
the form bean is session scoped, the checkbox "sticks" to always being
checked even if the user unchecks the checkbox.  This makes some sense to
me, because I know that if the checkbox is unchecked then a value for the
checkbox is not passed along in the request, so the old value is kept.  I
think with ActionForms this is solved by making the underlying property of
the checkbox of type boolean and by setting the value of the checkbox to
false in the reset() method of the ActionForm.  So, what is the correct
setup with DynaActionForms?  Should I make my underlying form property of
type java.lang.Boolean?  Also, It looks like I am going to have to subclass
DynaActionForm or DynaValidatorForm so that I can reset the checkboxes in
the reset() method of the form bean.  That seems like quite a pain (kind of
defeats the purpose of Dyna forms, doesn't it?).  Is that correct?

Thanks,

Matt


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



muliple select lists and DynaActionForms

2002-11-21 Thread Watkins, Herb
Hello,

I am having trouble with the submitted results of the  where
multiple="true.  I have the form defined as a DynaActionForm with the
property in question defined as an ArrayList of the ids to pre-select.  The
pre selection works fine but when I submit the form, the exception below is
thrown.  Please let me know if you have a solution.

Thanks,
Herb Watkins


Root cause of ServletException
org.apache.commons.beanutils.ConversionException: Cannot assign value of
type 'j
ava.lang.String' to property 'winLossReasonIds' of type
'java.util.ArrayList'
at
org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:376)
at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(Property
Utils.java:1592)
at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(Property
Utils.java:1506)
at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.
java:1536)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:674
)
at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:504)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:978)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
essor.java:779)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:246)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:129
2)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
>

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




RE: When to use DynaActionForms?

2003-06-05 Thread Bailey, Shane C.

No, it just means if you don't have to validate() (say because you are using
the struts validator) and you don't have to reset() (because you are using
the form in request all the time) and you are lazy (hey I use 'em) and don't
want to write the form with a bunch of getters and setters then they are
great.

The main different is that a hash map is used underneath and instead of
getAttributeName() you do get("attributeName") in the action to get the
values out.  Then the only other thing to remember is to choose the right
one if you are using the struts validator (i.e. validating based on action
or based on form bean used for the action).

-Original Message-
From: Barry Volpe [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 04, 2003 5:18 PM
To: Struts Users Mailing List
Subject: When to use DynaActionForms?

The docs say:
DynaActionForms are meant as an easy solution to a common problem: Your
ActionForms use simple properties and standard validations, and you just
pass these properties over to another JavaBean (say using
BeanUtils.copyProperties(myBusinessBean,form)). 

Does this mean for example I would not use DynaActionForms where I require a
form object in an Action that I am going to

use to populate a database?

If I require referencing a form object in an Action can I still use a
DynaActionForm?



Thanks,

Barry






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



Re: When to use DynaActionForms?

2003-06-05 Thread Barry Volpe
Shane,

Great.  Thanks.

For any newbies out there I found a tutorial which was helpful to me.
(Had some additional stuff on DynaActionForms.)

I'm sure some are already aware of this but.

http://www.reumann.net/do/struts/main

Barry

- Original Message -
From: "Bailey, Shane C." <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Wednesday, June 04, 2003 2:19 PM
Subject: RE: When to use DynaActionForms?


>
> No, it just means if you don't have to validate() (say because you are
using
> the struts validator) and you don't have to reset() (because you are using
> the form in request all the time) and you are lazy (hey I use 'em) and
don't
> want to write the form with a bunch of getters and setters then they are
> great.
>
> The main different is that a hash map is used underneath and instead of
> getAttributeName() you do get("attributeName") in the action to get the
> values out.  Then the only other thing to remember is to choose the right
> one if you are using the struts validator (i.e. validating based on action
> or based on form bean used for the action).
>
> -Original Message-
> From: Barry Volpe [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 04, 2003 5:18 PM
> To: Struts Users Mailing List
> Subject: When to use DynaActionForms?
>
> The docs say:
> DynaActionForms are meant as an easy solution to a common problem: Your
> ActionForms use simple properties and standard validations, and you just
> pass these properties over to another JavaBean (say using
> BeanUtils.copyProperties(myBusinessBean,form)).
>
> Does this mean for example I would not use DynaActionForms where I require
a
> form object in an Action that I am going to
>
> use to populate a database?
>
> If I require referencing a form object in an Action can I still use a
> DynaActionForm?
>
>
>
> Thanks,
>
> Barry
>
>
>
>
>
>
> -
> 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]



Re[2]: DynaActionForms and html:text tags

2003-08-18 Thread Dirk Markert
Hello Louise,
  what's the action and its mapping you are using to forward to your
  jsp containing

  
  
  
   ?
***


LP> On Monday, August 18, 2003 at 11:59:46 AM, Dirk Markert wrote:

DM>> Hello Louise,

DM>>   can you post your action mapping? Everything else looks fine.

LP>   type="com.xlsior.actions.LicenseIssuer.java"
LP>   name="licForm"
LP>   validate="true"
LP>   scope="session"
LP>   input="/private/issue.jsp"
LP>   >
LP>   path="/private/issued.jsp"
LP>redirect="false" />
LP>   

DM>> ***

LP>>> I'm having problems getting a DynaActionForm to work with a jsp page,
LP>>> and wondered if anyone could help.

LP>>> I've defined all the properties in the DynaActionForm using
LP>>>  tags. They all have type java.lang.String. The form
LP>>> is mapped to the Action in the usual way. Actual extracts from the
LP>>> files at the end of this message.

LP>>> I have a jsp page with an html:form tag that refers to the action. The
LP>>> trouble is, that none of the html:text tags work (they refer to
LP>>> properties as defined in the form). The symptom of the not working is
LP>>> org.apache.jasper.JasperException: No getter method for property
LP>>>  of bean org.apache.struts.taglib.html.BEAN

LP>>> An html:hidden tag and an html:password tag on the same form work
LP>>> fine. Could this be something to do with the fact that the hidden tag
LP>>> has a value set, and the password tag has redisplay="false", so that
LP>>> neither of them are looking in the form bean for values?

LP>>> Any help would be greatly appreciated. I am sure there is something
LP>>> basic I haven't done right, but I can't think what.








Regards,
Dirk

+--- Quality leads ---+
| Dirk Markert [EMAIL PROTECTED] |
| Dr. Markert Softwaretechnik AG  |
| Joseph-von-Fraunhofer-Str. 20   |
| 44227 Dortmund  |
+-->>> to success! <<-+ 


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



RE: Checkboxes with session-scoped DynaActionForms

2003-12-17 Thread Barett McGavock
If your fields are currently Strings, just put
field = new String[0];
in your reset() method. You don't need to change it to a [Bb]oolean.

This advice should work for any type.

B

-Original Message-
From: Sgarlata Matt [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 17, 2003 12:48 PM
To: Struts Users Mailing List
Subject: Checkboxes with session-scoped DynaActionForms


Does anyone know a good reference on how to use checkboxes with
session-scoped DynaActionForms?  The problem I am running into is that when
the form bean is session scoped, the checkbox "sticks" to always being
checked even if the user unchecks the checkbox.  This makes some sense to
me, because I know that if the checkbox is unchecked then a value for the
checkbox is not passed along in the request, so the old value is kept.  I
think with ActionForms this is solved by making the underlying property of
the checkbox of type boolean and by setting the value of the checkbox to
false in the reset() method of the ActionForm.  So, what is the correct
setup with DynaActionForms?  Should I make my underlying form property of
type java.lang.Boolean?  Also, It looks like I am going to have to subclass
DynaActionForm or DynaValidatorForm so that I can reset the checkboxes in
the reset() method of the form bean.  That seems like quite a pain (kind of
defeats the purpose of Dyna forms, doesn't it?).  Is that correct?

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



RE: Checkboxes with session-scoped DynaActionForms

2003-12-17 Thread Wendy Smoak
> From: Sgarlata Matt [mailto:[EMAIL PROTECTED] 
> Also, It looks like I am going to have to subclass
> DynaActionForm or DynaValidatorForm so that I can reset the 
> checkboxes in the reset() method of the form bean.  
> That seems like quite a pain (kind of
> defeats the purpose of Dyna forms, doesn't it?).  

"Dyna" forms merely free you of the need to write all those get/set
methods.  Defining the properties in struts-config.xml does not mean you
can't or shouldn't override the 'reset' and/or 'validate' methods.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 





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



Re: Checkboxes with session-scoped DynaActionForms

2003-12-17 Thread Sgarlata Matt
Wendy & Barrett - Thanks for your help!  Both of your answers helped me fix
the problem I was having with checkboxes and session-scoped DynaActionForms.

Wendy - I feel like the reset method of the DynaActionForm should be able to
automatically take care of checkboxes, perhaps with a little extra help like
specifying clearOnReset="true" or isCheckbox="true" in the 
element for the property, but oh well... I'm not going to push it on the dev
list.

Matt
- Original Message - 
From: "Wendy Smoak" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, December 17, 2003 3:03 PM
Subject: RE: Checkboxes with session-scoped DynaActionForms


> From: Sgarlata Matt [mailto:[EMAIL PROTECTED]
> Also, It looks like I am going to have to subclass
> DynaActionForm or DynaValidatorForm so that I can reset the
> checkboxes in the reset() method of the form bean.
> That seems like quite a pain (kind of
> defeats the purpose of Dyna forms, doesn't it?).

"Dyna" forms merely free you of the need to write all those get/set
methods.  Defining the properties in struts-config.xml does not mean you
can't or shouldn't override the 'reset' and/or 'validate' methods.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management





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



RE: Checkboxes with session-scoped DynaActionForms

2003-12-17 Thread Mainguy, Mike
I think there is a common misconception that if you use DynaActionForms you
don't need to write an ActionForm AT ALL.  While this is true, you may also
subclass the DynaForm and provide a similar level of functionality as a
normal form.

Kmart Tech News
news://uskihsvtfinsys
 
The essence of knowledge is, having it, to apply it; not having it, to
confess your ignorance. 

-Original Message-
From: Sgarlata Matt [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 17, 2003 4:47 PM
To: Struts Users Mailing List
Subject: Re: Checkboxes with session-scoped DynaActionForms


Wendy & Barrett - Thanks for your help!  Both of your answers helped me fix
the problem I was having with checkboxes and session-scoped DynaActionForms.

Wendy - I feel like the reset method of the DynaActionForm should be able to
automatically take care of checkboxes, perhaps with a little extra help like
specifying clearOnReset="true" or isCheckbox="true" in the 
element for the property, but oh well... I'm not going to push it on the dev
list.

Matt
- Original Message - 
From: "Wendy Smoak" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, December 17, 2003 3:03 PM
Subject: RE: Checkboxes with session-scoped DynaActionForms


> From: Sgarlata Matt [mailto:[EMAIL PROTECTED]
> Also, It looks like I am going to have to subclass DynaActionForm or 
> DynaValidatorForm so that I can reset the checkboxes in the reset() 
> method of the form bean. That seems like quite a pain (kind of
> defeats the purpose of Dyna forms, doesn't it?).

"Dyna" forms merely free you of the need to write all those get/set methods.
Defining the properties in struts-config.xml does not mean you can't or
shouldn't override the 'reset' and/or 'validate' methods.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management





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

-
This message and its contents (to include attachments) are the property of Kmart 
Corporation (Kmart) and may contain confidential and proprietary information. You are 
hereby notified that any disclosure, copying, or distribution of this message, or the 
taking of any action based on information contained herein is strictly prohibited. 
Unauthorized use of information contained herein may subject you to civil and criminal 
prosecution and penalties. If you are not the intended recipient, you should delete 
this message immediately.


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



RE: muliple select lists and DynaActionForms

2002-11-21 Thread Watkins, Herb
Not sure if I my problem is clear but I would be happy to elaborate...Any
thoughts?

Herb

-Original Message-
From: Watkins, Herb [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 10:14 AM
To: '[EMAIL PROTECTED]'
Subject: muliple select lists and DynaActionForms 


Hello,

I am having trouble with the submitted results of the  where
multiple="true.  I have the form defined as a DynaActionForm with the
property in question defined as an ArrayList of the ids to pre-select.  The
pre selection works fine but when I submit the form, the exception below is
thrown.  Please let me know if you have a solution.

Thanks,
Herb Watkins


Root cause of ServletException
org.apache.commons.beanutils.ConversionException: Cannot assign value of
type 'j
ava.lang.String' to property 'winLossReasonIds' of type
'java.util.ArrayList'
at
org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:376)
at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(Property
Utils.java:1592)
at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(Property
Utils.java:1506)
at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.
java:1536)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:674
)
at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:504)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:978)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
essor.java:779)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:246)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:129
2)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
>

--
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: muliple select lists and DynaActionForms

2002-11-21 Thread Martin Cooper


On Thu, 21 Nov 2002, Watkins, Herb wrote:

> Hello,
>
> I am having trouble with the submitted results of the  where
> multiple="true.  I have the form defined as a DynaActionForm with the
> property in question defined as an ArrayList of the ids to pre-select.  The
> pre selection works fine but when I submit the form, the exception below is
> thrown.  Please let me know if you have a solution.

Per the documentation for , you need to use an array, not an
ArrayList.

--
Martin Cooper


>
> Thanks,
> Herb Watkins
>
>
> Root cause of ServletException
> org.apache.commons.beanutils.ConversionException: Cannot assign value of
> type 'j
> ava.lang.String' to property 'winLossReasonIds' of type
> 'java.util.ArrayList'
> at
> org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:376)
> at
> org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(Property
> Utils.java:1592)
> at
> org.apache.commons.beanutils.PropertyUtils.setNestedProperty(Property
> Utils.java:1506)
> at
> org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.
> java:1536)
> at
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:674
> )
> at
> org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:504)
> at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:978)
> at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
> essor.java:779)
> at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
> va:246)
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:129
> 2)
> at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
> >
>
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
>
>


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




DynaActionForms and persistence (wizard-type behavior)

2003-05-29 Thread Gregory F. March

Hi all...

Now that I've got me LookupDispatchAction problem worked out (it works
really well!), I'm struggling with a DynaActionForm problem.

I have an action who's scope is "session".  The associated form is a
DynaActionForm.  Since I'm just building the app, I have the "next"
button on the form pointing back to the same page.

When I enter data into the form and press next, I can see the fields
in the action (I print them), I find the appropriate forward (which is
back to the same page) and return it.

The form gets reset.

I read that if I subclass DynaActionForm and override the reset method
to do nothing, it should work.  It doesn't.

What is the proper way to have the DynaActionForm repopulate with the
previous data?

Thanks!

/greg

--
Gregory F. March-=-http://www.gfm.net:81/~march-=-AIM:GfmNet

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



FormPropertyConfig - reseting session scoped DynaActionForms checkbox properties

2003-07-24 Thread Mike Whittaker

Must reset checkbox properties to zero length in reset method as stated in
the docs.

If I have a session scoped DAF, then I can't just call initialize().

So I need to access this FormPropertyConfig object in my reset method to set
the array to zero length for specific cases and only when zero boxes are
selected.

However I cannot detect zero boxes because Struts has prevented zero being
selected!!

How can I do this please?

--
Mike W


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



FormPropertyConfig - reseting session scoped DynaActionForms checkbox properties

2003-07-24 Thread Mike Whittaker

Must reset checkbox properties to zero length in reset method as stated in
the docs.

If I have a session scoped DAF, then I can't just call initialize().

So I need to access this FormPropertyConfig object in my reset method to set
the array to zero length for specific cases and only when zero boxes are
selected.

However I cannot detect zero boxes because Struts has prevented zero being
selected!!

How can I do this please?

--
Mike W


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



Does the Struts Validator work with DynaActionForms?

2003-12-16 Thread Anderson, James H [IT]
I see that to setup server-side vaildations one must extend the ValidatorForm or 
ValidatorActionForm class, but for dynamic form support one must extend the 
DynaActionForm class...

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



problem with DynaActionForms in conversion of values

2004-02-11 Thread Marco Mistroni
Hi all,
In my app I am using a DynaActionForm to retrieve
Input values.
I have one problem: one field of the bean is of type BigDecimal.. in the
Jsp I am setting the default initial value of zero, but this does not
prevent the silly user from deleting the zero and leave the field blank.
At that point, when the form is submitted I receive an exception saying
that
There was an exception in the conversion.
11/02/04 10:41:39:688 GMT] 6b75e39b WebGroup  E SRVE0026E: [Servlet
Error]-[BeanUtils.populate]:
org.apache.commons.beanutils.ConversionException: Zero length BigDecimal
at
org.apache.commons.beanutils.converters.BigDecimalConverter.convert(BigD
ecimalConverter.java:162)
at
org.apache.commons.beanutils.ConvertUtils.convert(ConvertUtils.java:373)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:903)


Are there any other workaround other than using a 'String' copy of the
field
That is used as input, and then in the validate method of the bean I
retrieve this string value and build a BigDecimal out of it?

How and where can I catch the ConversionException?

Thanx in advance and regards
marco



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



QUESTION: Automatic Data Transfer To/From DynaActionForms

2002-10-01 Thread Hohlen, John

Here's a question regarding the transfer of data from a DynaActionForm to a
Value Object using the copyProperties() method in the
org.apache.commons.beanutils.PropertyUtils class:

My team just started experimenting with DynaActionForms.  Until now, we've
been using standard action forms (i.e. manually coded).  Wherever possible,
we're using Value Objects with matching property names.  This allows us to
use the "copyProperties" method to transfer user input data between the two
objects without writing special adapter code.  

Our basic approach was that all property fields in an ActionForm class would
be declared as strings -- as recommended with DynaForms.  Therefore, a
property always has a SETTER method that takes a string input.  However, a
property name in an ActionForm class would always end with the suffix
"String" (or "StringList" for an array list) if the string type is not its
real-world data type (e.g. a property representing a salary amount where
double would be the real-world type).  Otherwise, the property would not
have the "String" suffix in it's name (e.g. a property representing a last
name where String would be the real-world type).

However, if the property name does end with "String (again, indicating
String is not its real-world type), then there are two getters and two
setters.  More specifically, there is a string pair, and a real-world data
type pair.  As expected, the string pair deals exclusively with String data
types.  These methods are used by Struts and the JSPs.  Conversely, the
real-world data type pair deals exclusively with the real-world data types.
The getter method throws some type of StringFormatException since it tries
to convert a value from String to its real-world data type.  The real-world
data type methods are used to automatically copy data to/from value objects
via the "copyProperties" method.  Our Value Object always refer to the data
as their real-world type and not Strings (unless String is the real-world
type).

The code example below should make what I tried to say about our ActionForm
naming conventions, in the words above, easier to understand:
 
public class employeeForm extends ActionForm {
  private String lastName = null;
  private String salaryString = null;
 
  // Last name getter / setter
  public String setLastName(String lastName) {
this.lastName = lastName;
  }
  public Sting getLastName() {
return lastName;
  }
  
  // Salary getters / setters 
  public void setSalaryString(String salaryString) {
this.salaryString = salaryString;
  }
  public String getSalaryString() {
return salaryString;
  }
  public void setSalary(double salary) { // does not throw exception
salaryString = StringFormat.numberToString(salary, 2); // two decimal
places
  }  
  public double getSalary() throws StringFormatException {
return StringFormat.stringToFloat(salaryString);
  }

}

Here's the benefit.  This approach allows us to copy all the values to/from
the form bean to a corresponding value object in one line of code.  For
example,

PropertyUtils.copyProperties(employeeValueObject, employeeForm);

FYI, the EmployeeValueObject is declared as:
 
public class EmployeeValueObject {
  private String lastName = null;
  private double salary = 0.0;
 
  // Last name getter / setters
  public String setLastName(String lastName) {
this.lastName = lastName;
  }
  public Sting getLastName() {
return lastName;
  }
  
  public void setSalary(double salary) {
this.salary = salary
  }  
  public double getSalary() {
return salary;
  }

}

Now, if you've hung here for this long, I appreciate it.  We're getting to
the heart of my question.  If I use DynaActionForms, I lose the ability to
use the copyProperties method in this situation because there is no getter
method in the Employee "Dyna" Form which returns a double primitive.
Hence, I have to write additional adapter code to stuff the value into my
Value Object.  Therefore, by using DynaActionForms, I reduce the ActionForm
code that I have to write, but increase the adapter code that I have to
write.  Right?

What are others doing here?  Would it make sense to enhance the
DynaActionForm class to generate getter/setter methods for real-world  types
if there real-world data type is not String.  More specifically, there would
always be String methods for each property, but if the "form-property" is
not specified as String the struts-config.xml file, an additional setter and
getter method for the real-world data type would also generated.

By the way, the reason for using the "String" suffix in the String methods
corrresponding to non-string properties (i.e. real-world) is that you cannot
overload methods differing only by return type. 

Thanks for reading this.  Please let me know if there is a better way to do
this.  Obviously, I'm trying to keep the amount of 

RE: Does the Struts Validator work with DynaActionForms?

2003-12-16 Thread Robert Taylor
Yes. You should use DynaValidatorForm or DynaValidatorActionForm.

robert

> -Original Message-
> From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 16, 2003 9:21 AM
> To: Struts Users Mailing List
> Subject: Does the Struts Validator work with DynaActionForms?
> 
> 
> I see that to setup server-side vaildations one must extend the 
> ValidatorForm or ValidatorActionForm class, but for dynamic form 
> support one must extend the DynaActionForm class...
> 
> -
> 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]



Re: problem with DynaActionForms in conversion of values

2004-02-11 Thread Mark Lowe
I've always found that BeanUtils doesn't like BigDecimal and use type  
string then convert to BigDecimal before passing it up to the model .  
If you don't want to use string then perhaps Double or even its  
primitive (if you can get away with it) might work for you.

On 11 Feb 2004, at 11:47, Marco Mistroni wrote:

Hi all,
	In my app I am using a DynaActionForm to retrieve
Input values.
I have one problem: one field of the bean is of type BigDecimal.. in  
the
Jsp I am setting the default initial value of zero, but this does not
prevent the silly user from deleting the zero and leave the field  
blank.
At that point, when the form is submitted I receive an exception saying
that
There was an exception in the conversion.
11/02/04 10:41:39:688 GMT] 6b75e39b WebGroup  E SRVE0026E: [Servlet
Error]-[BeanUtils.populate]:
org.apache.commons.beanutils.ConversionException: Zero length  
BigDecimal
	at
org.apache.commons.beanutils.converters.BigDecimalConverter.convert(Big 
D
ecimalConverter.java:162)
	at
org.apache.commons.beanutils.ConvertUtils.convert(ConvertUtils.java: 
373)
	at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:903)

Are there any other workaround other than using a 'String' copy of the
field
That is used as input, and then in the validate method of the bean I
retrieve this string value and build a BigDecimal out of it?
How and where can I catch the ConversionException?

Thanx in advance and regards
marco


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


RE: QUESTION: Automatic Data Transfer To/From DynaActionForms

2002-10-01 Thread Hohlen, John

Follow-up to my earlier question:

The "copyProperties()" approach wouldn't work anyhow since a
"DynaActionForm" actually stores the properties in a hashmap keyed by name.
A DynaActionForm is not a Java class automatically generated with
getters/setters based on the information in the Struts config.  However,
something like that might be possible using the Proxy API.

Nonetheless, I think my overall question is still valid.  How are others
transfering data between a DynaActionForm and an object?  Are they writing
custom adapters or using some type of re-usable, intelligent adapter that
minimizes the amount of code required to transfer data.

Thanks!

JOHN

-Original Message-
From: Hohlen, John 
Sent: Tuesday, October 01, 2002 10:45 AM
To: Struts-Help (E-mail)
Cc: Molitor, Stephen
Subject: QUESTION: Automatic Data Transfer To/From DynaActionForms


Here's a question regarding the transfer of data from a DynaActionForm to a
Value Object using the copyProperties() method in the
org.apache.commons.beanutils.PropertyUtils class:

My team just started experimenting with DynaActionForms.  Until now, we've
been using standard action forms (i.e. manually coded).  Wherever possible,
we're using Value Objects with matching property names.  This allows us to
use the "copyProperties" method to transfer user input data between the two
objects without writing special adapter code.  

Our basic approach was that all property fields in an ActionForm class would
be declared as strings -- as recommended with DynaForms.  Therefore, a
property always has a SETTER method that takes a string input.  However, a
property name in an ActionForm class would always end with the suffix
"String" (or "StringList" for an array list) if the string type is not its
real-world data type (e.g. a property representing a salary amount where
double would be the real-world type).  Otherwise, the property would not
have the "String" suffix in it's name (e.g. a property representing a last
name where String would be the real-world type).

However, if the property name does end with "String (again, indicating
String is not its real-world type), then there are two getters and two
setters.  More specifically, there is a string pair, and a real-world data
type pair.  As expected, the string pair deals exclusively with String data
types.  These methods are used by Struts and the JSPs.  Conversely, the
real-world data type pair deals exclusively with the real-world data types.
The getter method throws some type of StringFormatException since it tries
to convert a value from String to its real-world data type.  The real-world
data type methods are used to automatically copy data to/from value objects
via the "copyProperties" method.  Our Value Object always refer to the data
as their real-world type and not Strings (unless String is the real-world
type).

The code example below should make what I tried to say about our ActionForm
naming conventions, in the words above, easier to understand:
 
public class employeeForm extends ActionForm {
  private String lastName = null;
  private String salaryString = null;
 
  // Last name getter / setter
  public String setLastName(String lastName) {
this.lastName = lastName;
  }
  public Sting getLastName() {
return lastName;
  }
  
  // Salary getters / setters 
  public void setSalaryString(String salaryString) {
this.salaryString = salaryString;
  }
  public String getSalaryString() {
return salaryString;
  }
  public void setSalary(double salary) { // does not throw exception
salaryString = StringFormat.numberToString(salary, 2); // two decimal
places
  }  
  public double getSalary() throws StringFormatException {
return StringFormat.stringToFloat(salaryString);
  }

}

Here's the benefit.  This approach allows us to copy all the values to/from
the form bean to a corresponding value object in one line of code.  For
example,

PropertyUtils.copyProperties(employeeValueObject, employeeForm);

FYI, the EmployeeValueObject is declared as:
 
public class EmployeeValueObject {
  private String lastName = null;
  private double salary = 0.0;
 
  // Last name getter / setters
  public String setLastName(String lastName) {
this.lastName = lastName;
  }
  public Sting getLastName() {
return lastName;
  }
  
  public void setSalary(double salary) {
this.salary = salary
  }  
  public double getSalary() {
return salary;
  }

}

Now, if you've hung here for this long, I appreciate it.  We're getting to
the heart of my question.  If I use DynaActionForms, I lose the ability to
use the copyProperties method in this situation because there is no getter
method in the Employee "Dyna" Form which returns a double primitive.
Hence, I have to write additional adapter code to stuff the value into my
Value Object.  Therefore, by using DynaActionForms, I reduce the 

RE: QUESTION: Automatic Data Transfer To/From DynaActionForms

2002-10-01 Thread Craig R. McClanahan



On Tue, 1 Oct 2002, Hohlen, John wrote:

> Date: Tue, 1 Oct 2002 11:53:46 -0500
> From: "Hohlen, John" <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Cc: "Molitor, Stephen" <[EMAIL PROTECTED]>
> Subject: RE: QUESTION: Automatic Data Transfer To/From DynaActionForms
>
> Follow-up to my earlier question:
>
> The "copyProperties()" approach wouldn't work anyhow since a
> "DynaActionForm" actually stores the properties in a hashmap keyed by name.
> A DynaActionForm is not a Java class automatically generated with
> getters/setters based on the information in the Struts config.  However,
> something like that might be possible using the Proxy API.
>

The PropertyUtils.copyProperties() method has special logic in it that
understands about DynaBeans, so it should still work OK.

> Nonetheless, I think my overall question is still valid.  How are others
> transfering data between a DynaActionForm and an object?  Are they writing
> custom adapters or using some type of re-usable, intelligent adapter that
> minimizes the amount of code required to transfer data.
>

While PropertyUtils.copyProperties() does not know how to do data
conversions, BeanUtils.copyProperties() *does* support this.  In fact, you
can register your own conversion functions (ConvertUtils.register()) for
data types that are not already covered.  And, like the PropertyUtils
version, there is special logic in this method that recognizes DynaBean
classes and works with them.

Given this, my typical pattern is to use BeanUtils.copyProperties() in an
Action to copy data out of the form bean.

> Thanks!
>
> JOHN

Craig

>
> -Original Message-
> From: Hohlen, John
> Sent: Tuesday, October 01, 2002 10:45 AM
> To: Struts-Help (E-mail)
> Cc: Molitor, Stephen
> Subject: QUESTION: Automatic Data Transfer To/From DynaActionForms
>
>
> Here's a question regarding the transfer of data from a DynaActionForm to a
> Value Object using the copyProperties() method in the
> org.apache.commons.beanutils.PropertyUtils class:
>
> My team just started experimenting with DynaActionForms.  Until now, we've
> been using standard action forms (i.e. manually coded).  Wherever possible,
> we're using Value Objects with matching property names.  This allows us to
> use the "copyProperties" method to transfer user input data between the two
> objects without writing special adapter code.
>
> Our basic approach was that all property fields in an ActionForm class would
> be declared as strings -- as recommended with DynaForms.  Therefore, a
> property always has a SETTER method that takes a string input.  However, a
> property name in an ActionForm class would always end with the suffix
> "String" (or "StringList" for an array list) if the string type is not its
> real-world data type (e.g. a property representing a salary amount where
> double would be the real-world type).  Otherwise, the property would not
> have the "String" suffix in it's name (e.g. a property representing a last
> name where String would be the real-world type).
>
> However, if the property name does end with "String (again, indicating
> String is not its real-world type), then there are two getters and two
> setters.  More specifically, there is a string pair, and a real-world data
> type pair.  As expected, the string pair deals exclusively with String data
> types.  These methods are used by Struts and the JSPs.  Conversely, the
> real-world data type pair deals exclusively with the real-world data types.
> The getter method throws some type of StringFormatException since it tries
> to convert a value from String to its real-world data type.  The real-world
> data type methods are used to automatically copy data to/from value objects
> via the "copyProperties" method.  Our Value Object always refer to the data
> as their real-world type and not Strings (unless String is the real-world
> type).
>
> The code example below should make what I tried to say about our ActionForm
> naming conventions, in the words above, easier to understand:
>
> public class employeeForm extends ActionForm {
>   private String lastName = null;
>   private String salaryString = null;
>
>   // Last name getter / setter
>   public String setLastName(String lastName) {
> this.lastName = lastName;
>   }
>   public Sting getLastName() {
> return lastName;
>   }
>
>   // Salary getters / setters
>   public void setSalaryString(String salaryString) {
> this.salaryString = salaryString;
>   }
>   public String getSalaryStri

Re: QUESTION: Automatic Data Transfer To/From DynaActionForms

2002-10-01 Thread Craig R. McClanahan



On Tue, 1 Oct 2002, Hohlen, John wrote:

>
> Now, if you've hung here for this long, I appreciate it.  We're getting to
> the heart of my question.  If I use DynaActionForms, I lose the ability to
> use the copyProperties method in this situation because there is no getter
> method in the Employee "Dyna" Form which returns a double primitive.
> Hence, I have to write additional adapter code to stuff the value into my
> Value Object.  Therefore, by using DynaActionForms, I reduce the ActionForm
> code that I have to write, but increase the adapter code that I have to
> write.  Right?

The logic in PropertyUtils and BeanUtils has special functionality that
treats DynaBeans (and therefore DynaActionForms) like regular JavaBeans.
For copyProperties(), a DynaBean can be the source, the destination, or
both, or neither.

You should also check out BeanUtils.copyProperties() that does conversions
as part of its processing.  Of course, this is only helpful when you use
the same property names in the form bean and in the value object -- for
example:


public class CustomerFormBean extends ActionForm {
...
public String getStartDate();
public void setStartDate(String startDate);
...
}


public class CustomerValueObject {
...
public Date getStartDate();
public void setStartDate(Date startDate);
...
}

Then, you can copy the properties (including the automatic date
conversion of the "startDate" property) like this:


CustomerFormBean cfb = ...;
CustomerValueObject cvo = ...;
BeanUtils.copyProperties(cvo, cfb);


Craig


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




RE: QUESTION: Automatic Data Transfer To/From DynaActionForms

2002-10-01 Thread Taylor, Jason

OK, so would the solution to John's problem then be the following:

1) Define dyna form beans in struts-config.xml that duplicate value objects
in the model, or at least that possess properties that duplicate the model
VO properties that need to be exposed.

2) Define dyna form beans in struts-config.xml that may contain the "VO form
beans" defined in step #1 for each "composite" form bean, i.e., a dyna form
bean that is composed of multiple VO form beans.

3) Associate actions with composite form beans via action-mappings in the
struts-config.xml

4) Make HTML form that uses properties of the VO form beans as editable form
elements within a form associated with a composite form bean

5) Define composite form bean reset/validation methods in Action (or a class
invoked by the Action class) to keep specify the right defaults and keep bad
data out of model

6) use BeanUtils.copyProperties(formBean, vo) to transfer changes to the
model wherever they are detected/required

Sound right, or am I missing/munging something?

 
-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 01, 2002 10:48 AM
To: Struts Users Mailing List
Cc: Molitor, Stephen
Subject: Re: QUESTION: Automatic Data Transfer To/From DynaActionForms




On Tue, 1 Oct 2002, Hohlen, John wrote:

>
> Now, if you've hung here for this long, I appreciate it.  We're getting to
> the heart of my question.  If I use DynaActionForms, I lose the ability to
> use the copyProperties method in this situation because there is no getter
> method in the Employee "Dyna" Form which returns a double primitive.
> Hence, I have to write additional adapter code to stuff the value into my
> Value Object.  Therefore, by using DynaActionForms, I reduce the
ActionForm
> code that I have to write, but increase the adapter code that I have to
> write.  Right?

The logic in PropertyUtils and BeanUtils has special functionality that
treats DynaBeans (and therefore DynaActionForms) like regular JavaBeans.
For copyProperties(), a DynaBean can be the source, the destination, or
both, or neither.

You should also check out BeanUtils.copyProperties() that does conversions
as part of its processing.  Of course, this is only helpful when you use
the same property names in the form bean and in the value object -- for
example:


public class CustomerFormBean extends ActionForm {
...
public String getStartDate();
public void setStartDate(String startDate);
...
}


public class CustomerValueObject {
...
public Date getStartDate();
public void setStartDate(Date startDate);
...
}

Then, you can copy the properties (including the automatic date
conversion of the "startDate" property) like this:


CustomerFormBean cfb = ...;
CustomerValueObject cvo = ...;
BeanUtils.copyProperties(cvo, cfb);


Craig


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



Why add form-property to struts-config.xml for DynaActionForms

2002-10-10 Thread Praful . Kapadia

Is it possible to avoid adding  tags to struts-config.xml for 
DynaActionForms? Struts complains if these aren't provided.

For example, if I have a form with fields called username, password, currencyList and 
activityStatus, I have to add the following to struts-config.xml



  
  
  
  


Why is this necessary since there are no corresponding get/set methods for each field 
in a DynaActionForm? For example, there are no methods called getUsername() or 
setUsername(). Instead the DynaActionForm's generic getter method is called: public 
Object get(String parm1).

Is there a way of avoiding this?

TIA

Praful
 

Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.


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




Re: Why add form-property to struts-config.xml for DynaActionForms

2002-10-10 Thread David Graham

Probably because struts needs to know which variables are properties and 
which are just implementation details that shouldn't be exposed.

David


>From: [EMAIL PROTECTED]
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Subject: Why add form-property to struts-config.xml for DynaActionForms
>Date: Thu, 10 Oct 2002 19:21:43 +0100
>
>Is it possible to avoid adding  tags to struts-config.xml 
>for DynaActionForms? Struts complains if these aren't provided.
>
>For example, if I have a form with fields called username, password, 
>currencyList and activityStatus, I have to add the following to 
>struts-config.xml
>
>
> type="org.apache.struts.webapp.example.Test1Form" dynamic="true">
>   
>   
>   
>   
> 
>
>Why is this necessary since there are no corresponding get/set methods for 
>each field in a DynaActionForm? For example, there are no methods called 
>getUsername() or setUsername(). Instead the DynaActionForm's generic getter 
>method is called: public Object get(String parm1).
>
>Is there a way of avoiding this?
>
>TIA
>
>Praful
>
>
>Visit our website at http://www.ubswarburg.com
>
>This message contains confidential information and is intended only
>for the individual named.  If you are not the named addressee you
>should not disseminate, distribute or copy this e-mail.  Please
>notify the sender immediately by e-mail if you have received this
>e-mail by mistake and delete this e-mail from your system.
>
>E-mail transmission cannot be guaranteed to be secure or error-free
>as information could be intercepted, corrupted, lost, destroyed,
>arrive late or incomplete, or contain viruses.  The sender therefore
>does not accept liability for any errors or omissions in the contents
>of this message which arise as a result of e-mail transmission.  If
>verification is required please request a hard-copy version.  This
>message is provided for informational purposes and should not be
>construed as a solicitation or offer to buy or sell any securities or
>related financial instruments.
>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>




_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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