Thanks for the reply David.
Yeah, 'action' checking is another way of determining wether or not to
do the validation.
I guess I was wondering if it was possible to configure the Form to
prevent first time checking ? Would anyone else find this useful ?
Given the recent discussions about preventing direct acces to JSP's, it
seems that the Form validation is designed [in default operation] in
such a way as to expect that you have gone directly to the JSP first.
This is one thing I wouldnt really ever want to do, as I prefer all
requests to go through an action - even if it is just to redirect to the
JSP [call me a control freak! but there area lot of others that feel the
same :) ]
I wonder if the Auto Validation should accomodate the more common
scenario [certainly in larger applications] where you do want to force
requests thru actions and avoid direct JSP access, but avoid first time
validation. I guess Action Form could be extended to provide this, but I
was hoping it would already be there - as it seems quite obvious and
important. I dont think we should be encouraging people to go directly
to the JSP as part of the Struts framework [just my 2p]
Picking up on what you mentioned David, about handling all 'actions'
todo with a form in the one Action class. We have some sceanrios where
this is just not practical. What about those scenarios ?!
Thanks anyway David.
Any other comments ?
G
> -----Original Message-----
> From: David Winterfeldt [mailto:[EMAIL PROTECTED]]
> Sent: 31 July 2001 16:46
> To: [EMAIL PROTECTED]
> Subject: RE: Automatic Form Validation
>
>
> If you have a variable called action that keeps track
> of what type of action you are performing (create,
> update, delete), you could check for this in the
> validate method and only validate on create or update.
> The Struts example webapp has an action field to keep
> track of this. I wouldn't do that personally. I've
> always done my validation from the Action so I could
> use the same action for everything associated with a
> form/table. For example, delete doesn't need
> validation or sending someone through the action to
> the view for the first time (as you mentionded). So I
> don't think there is anything wrong with not using the
> automatic validation. I think it just depends on your
> design preference.
>
> David
>
> --- "Emaho, Ghoot" <[EMAIL PROTECTED]> wrote:
> > Some further details on my question:
> >
> > I understand that you can have the request go
> > straight to the JSP and
> > avoid the first time validation.
> >
> > This is acceptable in some circumstance, but in
> > other circumstances you
> > may wish to have your action do some work before
> > presenting the page (a
> > common requirement in more complex applications),
> > and you may wish to
> > avoid access to any JSP's directly.
> >
> > How then (with this extra clarification) can you
> > prevent the behaviour
> > described in the original posting ?
> >
> > Many thanks for any help
> >
> > Ghoot
> >
> > PS Please someone respond ! So i dont get too
> > disillusioned :)
> >
> > > -----Original Message-----
> > > From: Emaho, Ghoot
> > > Sent: 31 July 2001 15:49
> > > To: [EMAIL PROTECTED]
> > > Subject: Automatic Form Validation
> > >
> > >
> > > Quick question on Form validation, using the
> > Automatic Validation
> > > offerred by Struts.
> > >
> > > If i have a form bean which performs some
> > validation on the validate
> > > method, and an action has it's definition of
> > validate set to
> > > true, then
> > > the Form Bean's validate method gets called before
> > the
> > > action's perform
> > > method. However, this then displays my error
> > messages on the form page
> > > the first time i go to the page ! Am I missing
> > something ?
> > >
> > > Now i can get round this with some checking in the
> > validate method to
> > > ignore it the first time round - as there will be
> > no data yet. As i
> > > understand, the bean is created if it isnt found.
> > So if it's just been
> > > created, and then the validate method is called of
> > course
> > > there will be
> > > nothing there ?
> > >
> > > Any suggestions ? Or does someone want to point
> > out the obvious ?!
> > >
> > > In our Struts implementations to date, we have
> > avoided using this
> > > feature and done our validation from within the
> > Action. But I am
> > > investigating this feature and would like to know
> > why this is
> > > so / what
> > > i am doing wrong !
> > >
> > > Many thanks
> > >
> > > G
> > >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with
> Yahoo! Messenger
> http://phonecard.yahoo.com/
>