[EMAIL PROTECTED] wrote:

> >In Struts 1.1, we need to provide finer-grained control over this as
> >part of enhanced validation processing (i.e. things like per-property
> >default values and such).
>
> We're currently looking at ways of implementing user preferences, so that
> when ever we construct a given bean (for a specific form probably), the
> user's default values are set. Has any coding started on this / design been
> done as yet?
>
> My current thoughts are:
>
> a) Some sort of bean factory that could apply any suitable defaults, based
> on info in the session / our own classes -- maybe via some sort of
> framework hook.
>
> b) Same as (a) but maybe using a custom tag instead of <jsp:useBean />
>
> c) Always enter an app / screen via an action, so that it can initialise
> the required beans, so that useBean never constructs the beans.
>
> Ideas?
>

The example application illustrates my preferred approach, which is (c) on your
list.  The reasoning is that any non-trivial app is going to be initializing
this kind of stuff from a database (or EJBs) anyway, and it can be fairly
complex -- enough so that it feels like a piece of unique logic that glues the
model layer and presentation layer together (i.e. it belongs in the
controller).

For eans that are used in both "create" and "edit" transactions, I generally
make the beans themselves initialize to convenient default values for the
create case, and then just call all the right setters if it is really the edit
case.

>
> Ken.
>

Craig


>
> [EMAIL PROTECTED] on 07/02/2001 17:51:08
>
> Please respond to [EMAIL PROTECTED]
>
> To:   [EMAIL PROTECTED]
> cc:    (bcc: Ken X Horn)
> Subject:  Re: specifying default values for forms
>
> "Deadman, Hal" wrote:
>
> >  Is there a way to specify default values other than zero for when an
> > ActionForm setter method takes a number argument and the conversion of
> > the string input fails? I seem to recall discussion of this feature
> > but I can't dig up the thread. Thanks, Hal
>
> The ConvertUtils class was recently enhanced to include mechanisms to
> set the default value returned in such cases.  These settings are global
> to your webapp, so they will affect conversion failures on all
> properties of a given type.  This is in the current nightly builds.
>
> In Struts 1.1, we need to provide finer-grained control over this as
> part of enhanced validation processing (i.e. things like per-property
> default values and such).
>
> Craig
>
>   ------------------------------------------------------------------------
>                Name: att1.htm
>    att1.htm    Type: Hypertext Markup Language (text/html)
>            Encoding: base64

Reply via email to