RE: dynaform populate

2004-01-04 Thread Matthias Wessendorf
Hi again,

i have this for one property:



on submit, the "normal" validation-flow runs...

you have an html!!!-formular (the generated one which you can see via
browser, and its source),
named like your formbean-name in struts-config.xml
you only got the "filled" textfield via a "normal" javaBean

after submitting, in your corresponding actionClass you

get an ActionForm-object, (base of DynaValidatorForm)
with these values...(came from html-form)



please look also here,
there you see, that formBeans are not! model-components of
MVC-(web).apps.
http://jakarta.apache.org/struts/userGuide/building_model.html
section (2.3)

greetings
Matthias


-Original Message-
From: Pedro Salgado [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 03, 2004 6:37 PM
To: Struts Users Mailing List
Subject: Re: dynaform populate


On 04/01/2004 17:16, "Matthias Wessendorf"
<[EMAIL PROTECTED]>
wrote:

> Hi Pedro,
> 
> the properties are!!! important!!!
> 
> 
> 
> i do the following in an action:
> 
> request.setAttribute("helperBean",myValueObject);
> 
> return mapping.findForward("updateFormularPage");
> 
> 
> 
> and have something like that in
> the forwarded jsp
> 
> 
> 
> 

  I didn't knew html:text had a name attribute :)
  I usually use

 (I
supposed, in this case, the name attribute is the form-bean name defined
on the struts config file)...

  One more question, if you have validation errors (after submitting the
form), you still have to pass the form properties to your helperBean or
the JSP page automatically presents the previous sent values (just like
doing a back on the browser)?

Thank you again,

Pedro Salgado


> ...
> 
> 
> 
> 
> it works fine!
> 
> 
> Regards, Matthias
> 
> 
> 
> -----Original Message-
> From: Pedro Salgado [mailto:[EMAIL PROTECTED]
> Sent: Saturday, January 03, 2004 6:08 PM
> To: Struts Users Mailing List
> Subject: Re: dynaform populate
> 
> 
> On 04/01/2004 16:55, "Matthias Wessendorf" 
> <[EMAIL PROTECTED]>
> wrote:
> 
>> Hi Pedro,
>> 
>> with:
>> 
>> FormBeanConfig fbc = new FormBeanConfig();
>> fbc.setName("myForm");
>> DynaActionFormClass dafc =
>> DynaActionFormClass.createDynaActionFormClass(fbc);
>> DynaActionForm formBean = (DynaActionForm) dafc.newInstance(); 
>> formBean.set("property", businessObject.getProperty());
>> request.setAttribute("userPrefsForm",formBean);
>> //End
>> 
>> you can create a dynaBean.
>> i had the problem long time ago two.
>> 
>> why are willing to use dynaBeans for populating a JSP-Form-Page?
>> 
>> i use "ValueObjects" or "HelperBeans" instead, which i store in 
>> request and with there properties the formfilds get filled to!
> 
> What you are telling me is that if I store a bean with the same name 
> as the form, the html tag lib will interpret it as being the form, 
> right?
> 
> Thank you very much!
> 
> Pedro Salgado
> 
>> 
>> look
>> http://rollerjm.free.fr/images/ClassStruts1_1.gif
>> an nice diagramm :-)
>> 
>> greetings
>> Matthias
>> 
>> 
>> 
>> -Original Message-
>> From: Pedro Salgado [mailto:[EMAIL PROTECTED]
>> Sent: Saturday, January 03, 2004 5:29 PM
>> To: Struts Users Mailing List
>> Subject: dynaform populate
>> 
>> 
>> 
>> Can anyone help me on this?
>> I am trying to pass a populated DynaActionForm to a JSP file and I 
>> can't figure out how can I populate the form...
>> 
>> I have the following sequence:
>> 
>> - form A (name : gotoUserPrefsForm, id : String - user id)
>> - action ViewUserPreferences (uses form A)
>> - form B (name : userPrefsForm, severall attributes)
>> 
>> 
>> ViewUserPreferences {
>> 
>>   /** @param form this is form A. */
>>   ... execute(..., form, ...) {
>> 
>>   int id = FormUtils.getIntValue(form, "id");
>> 
>>   UserPreferences prefs = service.getUserPreferences("id");
>> 
>>   // here starts the problem!!!
>>   // gets the form bean configuration
>>   FormBeanConfig fc =
>> config.findFormBeanConfig(mapping.getName());
>> 
>>   // this is supposed to be form B
>>   DynaValidatorForm dynaForm = // how do I create a new instance 
>> with the FormBeanConfig?...
>> 
>> 
>>   dynaForm.set("background", prefs.getBackground());
>> 
>>   request.setAttribute("userPrefsForm", dynaForm);
>>

Re: dynaform populate

2004-01-04 Thread Pedro Salgado
On 04/01/2004 17:16, "Matthias Wessendorf" <[EMAIL PROTECTED]>
wrote:

> Hi Pedro,
> 
> the properties are!!! important!!!
> 
> 
> 
> i do the following in an action:
> 
> request.setAttribute("helperBean",myValueObject);
> 
> return mapping.findForward("updateFormularPage");
> 
> 
> 
> and have something like that in
> the forwarded jsp
> 
> 
> 
> 

  I didn't knew html:text had a name attribute :)
  I usually use

 (I supposed,
in this case, the name attribute is the form-bean name defined on the struts
config file)...

  One more question, if you have validation errors (after submitting the
form), you still have to pass the form properties to your helperBean or the
JSP page automatically presents the previous sent values (just like doing a
back on the browser)?

Thank you again,

Pedro Salgado


> ...
> 
> 
> 
> 
> it works fine!
> 
> 
> Regards, Matthias
> 
> 
> 
> -Original Message-
> From: Pedro Salgado [mailto:[EMAIL PROTECTED]
> Sent: Saturday, January 03, 2004 6:08 PM
> To: Struts Users Mailing List
> Subject: Re: dynaform populate
> 
> 
> On 04/01/2004 16:55, "Matthias Wessendorf"
> <[EMAIL PROTECTED]>
> wrote:
> 
>> Hi Pedro,
>> 
>> with:
>> 
>> FormBeanConfig fbc = new FormBeanConfig();
>> fbc.setName("myForm");
>> DynaActionFormClass dafc =
>> DynaActionFormClass.createDynaActionFormClass(fbc);
>> DynaActionForm formBean = (DynaActionForm) dafc.newInstance();
>> formBean.set("property", businessObject.getProperty());
>> request.setAttribute("userPrefsForm",formBean);
>> //End
>> 
>> you can create a dynaBean.
>> i had the problem long time ago two.
>> 
>> why are willing to use dynaBeans for populating a JSP-Form-Page?
>> 
>> i use "ValueObjects" or "HelperBeans" instead, which i store in
>> request and with there properties the formfilds get filled to!
> 
> What you are telling me is that if I store a bean with the same name as
> the form, the html tag lib will interpret it as being the form, right?
> 
> Thank you very much!
> 
> Pedro Salgado
> 
>> 
>> look
>> http://rollerjm.free.fr/images/ClassStruts1_1.gif
>> an nice diagramm :-)
>> 
>> greetings
>> Matthias
>> 
>> 
>> 
>> -Original Message-
>> From: Pedro Salgado [mailto:[EMAIL PROTECTED]
>> Sent: Saturday, January 03, 2004 5:29 PM
>> To: Struts Users Mailing List
>> Subject: dynaform populate
>> 
>> 
>> 
>> Can anyone help me on this?
>> I am trying to pass a populated DynaActionForm to a JSP file and I
>> can't figure out how can I populate the form...
>> 
>> I have the following sequence:
>> 
>> - form A (name : gotoUserPrefsForm, id : String - user id)
>> - action ViewUserPreferences (uses form A)
>> - form B (name : userPrefsForm, severall attributes)
>> 
>> 
>> ViewUserPreferences {
>> 
>>   /** @param form this is form A. */
>>   ... execute(..., form, ...) {
>> 
>>   int id = FormUtils.getIntValue(form, "id");
>> 
>>   UserPreferences prefs = service.getUserPreferences("id");
>> 
>>   // here starts the problem!!!
>>   // gets the form bean configuration
>>   FormBeanConfig fc =
>> config.findFormBeanConfig(mapping.getName());
>> 
>>   // this is supposed to be form B
>>   DynaValidatorForm dynaForm = // how do I create a new instance
>> with the FormBeanConfig?...
>> 
>> 
>>   dynaForm.set("background", prefs.getBackground());
>> 
>>   request.setAttribute("userPrefsForm", dynaForm);
>> 
>>   }
>> 
>> }
>> 
>> 
>> Any ideas?
>> 
>> Pedro Salgado
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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



RE: dynaform populate

2004-01-04 Thread Matthias Wessendorf
Hi Pedro,

the properties are!!! important!!!



i do the following in an action:

request.setAttribute("helperBean",myValueObject);

return mapping.findForward("updateFormularPage");



and have something like that in
the forwarded jsp 




...




it works fine!


Regards, Matthias



-Original Message-
From: Pedro Salgado [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 03, 2004 6:08 PM
To: Struts Users Mailing List
Subject: Re: dynaform populate


On 04/01/2004 16:55, "Matthias Wessendorf"
<[EMAIL PROTECTED]>
wrote:

> Hi Pedro,
> 
> with:
> 
> FormBeanConfig fbc = new FormBeanConfig();
> fbc.setName("myForm");
> DynaActionFormClass dafc =
> DynaActionFormClass.createDynaActionFormClass(fbc);
> DynaActionForm formBean = (DynaActionForm) dafc.newInstance(); 
> formBean.set("property", businessObject.getProperty());
> request.setAttribute("userPrefsForm",formBean);
> //End
> 
> you can create a dynaBean.
> i had the problem long time ago two.
> 
> why are willing to use dynaBeans for populating a JSP-Form-Page?
> 
> i use "ValueObjects" or "HelperBeans" instead, which i store in 
> request and with there properties the formfilds get filled to!

What you are telling me is that if I store a bean with the same name as
the form, the html tag lib will interpret it as being the form, right?

Thank you very much!

Pedro Salgado

> 
> look
> http://rollerjm.free.fr/images/ClassStruts1_1.gif
> an nice diagramm :-)
> 
> greetings
> Matthias
> 
> 
> 
> -Original Message-
> From: Pedro Salgado [mailto:[EMAIL PROTECTED]
> Sent: Saturday, January 03, 2004 5:29 PM
> To: Struts Users Mailing List
> Subject: dynaform populate
> 
> 
> 
> Can anyone help me on this?
> I am trying to pass a populated DynaActionForm to a JSP file and I 
> can't figure out how can I populate the form...
> 
> I have the following sequence:
> 
> - form A (name : gotoUserPrefsForm, id : String - user id)
> - action ViewUserPreferences (uses form A)
> - form B (name : userPrefsForm, severall attributes)
> 
> 
> ViewUserPreferences {
> 
>   /** @param form this is form A. */
>   ... execute(..., form, ...) {
> 
>   int id = FormUtils.getIntValue(form, "id");
> 
>   UserPreferences prefs = service.getUserPreferences("id");
> 
>   // here starts the problem!!!
>   // gets the form bean configuration
>   FormBeanConfig fc =
> config.findFormBeanConfig(mapping.getName());
> 
>   // this is supposed to be form B
>   DynaValidatorForm dynaForm = // how do I create a new instance 
> with the FormBeanConfig?...
> 
> 
>   dynaForm.set("background", prefs.getBackground());
> 
>   request.setAttribute("userPrefsForm", dynaForm);
> 
>   }
> 
> }
> 
> 
> Any ideas?
> 
> Pedro Salgado
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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


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



Re: dynaform populate

2004-01-04 Thread Pedro Salgado
On 04/01/2004 16:55, "Matthias Wessendorf" <[EMAIL PROTECTED]>
wrote:

> Hi Pedro,
> 
> with:
> 
> FormBeanConfig fbc = new FormBeanConfig();
> fbc.setName("myForm");
> DynaActionFormClass dafc =
> DynaActionFormClass.createDynaActionFormClass(fbc);
> DynaActionForm formBean = (DynaActionForm) dafc.newInstance();
> formBean.set("property", businessObject.getProperty());
> request.setAttribute("userPrefsForm",formBean);
> //End
> 
> you can create a dynaBean.
> i had the problem long time ago two.
> 
> why are willing to use dynaBeans for populating a JSP-Form-Page?
> 
> i use "ValueObjects" or "HelperBeans" instead, which i store in
> request and with there properties the formfilds get filled to!

What you are telling me is that if I store a bean with the same name as the
form, the html tag lib will interpret it as being the form, right?

Thank you very much!

Pedro Salgado

> 
> look
> http://rollerjm.free.fr/images/ClassStruts1_1.gif
> an nice diagramm :-)
> 
> greetings 
> Matthias
> 
> 
> 
> -----Original Message-
> From: Pedro Salgado [mailto:[EMAIL PROTECTED]
> Sent: Saturday, January 03, 2004 5:29 PM
> To: Struts Users Mailing List
> Subject: dynaform populate
> 
> 
> 
> Can anyone help me on this?
> I am trying to pass a populated DynaActionForm to a JSP file and I
> can't figure out how can I populate the form...
> 
> I have the following sequence:
> 
> - form A (name : gotoUserPrefsForm, id : String - user id)
> - action ViewUserPreferences (uses form A)
> - form B (name : userPrefsForm, severall attributes)
> 
> 
> ViewUserPreferences {
> 
>   /** @param form this is form A. */
>   ... execute(..., form, ...) {
> 
>   int id = FormUtils.getIntValue(form, "id");
> 
>   UserPreferences prefs = service.getUserPreferences("id");
> 
>   // here starts the problem!!!
>   // gets the form bean configuration
>   FormBeanConfig fc =
> config.findFormBeanConfig(mapping.getName());
> 
>   // this is supposed to be form B
>   DynaValidatorForm dynaForm = // how do I create a new instance
> with the FormBeanConfig?...
> 
> 
>   dynaForm.set("background", prefs.getBackground());
> 
>   request.setAttribute("userPrefsForm", dynaForm);
> 
>   }
> 
> } 
> 
> 
> Any ideas?
> 
> Pedro Salgado
> 
> 
> -
> 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: dynaform populate

2004-01-04 Thread Matthias Wessendorf
Hi Pedro,

with:

FormBeanConfig fbc = new FormBeanConfig();
fbc.setName("myForm");
DynaActionFormClass dafc =
DynaActionFormClass.createDynaActionFormClass(fbc);
DynaActionForm formBean = (DynaActionForm) dafc.newInstance();
formBean.set("property", businessObject.getProperty());
request.setAttribute("userPrefsForm",formBean);
//End

you can create a dynaBean.
i had the problem long time ago two.

why are willing to use dynaBeans for populating a JSP-Form-Page?

i use "ValueObjects" or "HelperBeans" instead, which i store in
request and with there properties the formfilds get filled to! 

look
http://rollerjm.free.fr/images/ClassStruts1_1.gif
an nice diagramm :-)

greetings 
Matthias



-Original Message-
From: Pedro Salgado [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 03, 2004 5:29 PM
To: Struts Users Mailing List
Subject: dynaform populate



  Can anyone help me on this?
  I am trying to pass a populated DynaActionForm to a JSP file and I
can't figure out how can I populate the form...

  I have the following sequence:

  - form A (name : gotoUserPrefsForm, id : String - user id)
  - action ViewUserPreferences (uses form A)
  - form B (name : userPrefsForm, severall attributes)


  ViewUserPreferences {

/** @param form this is form A. */
... execute(..., form, ...) {

int id = FormUtils.getIntValue(form, "id");

UserPreferences prefs = service.getUserPreferences("id");

// here starts the problem!!!
// gets the form bean configuration
FormBeanConfig fc =
config.findFormBeanConfig(mapping.getName());

// this is supposed to be form B
DynaValidatorForm dynaForm = // how do I create a new instance
with the FormBeanConfig?...


dynaForm.set("background", prefs.getBackground());

request.setAttribute("userPrefsForm", dynaForm);

}

  } 


  Any ideas?

Pedro Salgado


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



dynaform populate

2004-01-04 Thread Pedro Salgado

  Can anyone help me on this?
  I am trying to pass a populated DynaActionForm to a JSP file and I can't
figure out how can I populate the form...

  I have the following sequence:

  - form A (name : gotoUserPrefsForm, id : String - user id)
  - action ViewUserPreferences (uses form A)
  - form B (name : userPrefsForm, severall attributes)


  ViewUserPreferences {

/** @param form this is form A. */
... execute(..., form, ...) {

int id = FormUtils.getIntValue(form, "id");

UserPreferences prefs = service.getUserPreferences("id");

// here starts the problem!!!
// gets the form bean configuration
FormBeanConfig fc = config.findFormBeanConfig(mapping.getName());

// this is supposed to be form B
DynaValidatorForm dynaForm = // how do I create a new instance with
the FormBeanConfig?...


dynaForm.set("background", prefs.getBackground());

request.setAttribute("userPrefsForm", dynaForm);

}

  } 


  Any ideas?

Pedro Salgado


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