You have two basic choices:

(1) Display and submit ActionForm fields; you need to initialize these
fields with your bean data before display, and to copy ActionForm
fields' data back to bean after successful submission. If your
ActionForm has session scope, you will need to initialize its fields
only once.

(2) Make your bean nested within ActionForm and use session scope for
the latter. Throw out "value" attribute and use "property" only, like
this:

<html:text name="myActionForm" property="beanFromSessionScope.project" />

In this case your beanFromSessionScope should be able to accept
invalid values. It should have String setters to be able to store
whatever junk a user types in. beanFromSessionScope should be a
detached object, having no effect on your persistent data. This is the
approach I use.

Michael.

On 9/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I understand what you mean, but my example has been very simple
> and only a little part of my page. I have much more text fields
> on my page, and everything I need is stored in a Bean in session
> scope. So using a PreAction to copy my whole Bean to an ActionForm
> with a lot of properties would be a lot of work and code.
> DynaValidatorFroms and Beans are there to avoid this extra Action,
> and all this extra properties, or is it wrong?
> 
> As you can see, I still have to learn a lot...
> 
> Regards,
> 
> Peter
> 
> 
> 
> 
> >By overriding the value in each text field you will never get the user
> enter value after validation
> >fails.
> >
> >You should (at least how i understand), populate the action form with
> values in a "PreAction"
> >i.e.
> >
> >PreAction -> display to user -> PostAction
> >
> >The preaction takes in the action form and populates its default values.
> Then you can using the
> >struts "html" tag as they are intended
> >
> >Regards,
> >
> >Gareth

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

Reply via email to