Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@jakarta.apache.org Received: (qmail 62848 invoked by uid 500); 1 Aug 2001 15:10:58 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: struts-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 62841 invoked from network); 1 Aug 2001 15:10:58 -0000 Received: from web5504.mail.yahoo.com (216.115.106.187) by h31.sny.collab.net with SMTP; 1 Aug 2001 15:10:58 -0000 Message-ID: <20010801151059.9765.qmail@web5504.mail.yahoo.com> Received: from [63.240.4.5] by web5504.mail.yahoo.com via HTTP; Wed, 01 Aug 2001 08:10:59 PDT Date: Wed, 1 Aug 2001 08:10:59 -0700 (PDT) From: David Winterfeldt Subject: RE: Automatic Form Validation - A further question To: struts-user@jakarta.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N --- "Emaho, Ghoot" wrote: > Thanks again David. > > I have explored extending ActionForm to check for > and ignore first time > validation. However, it seems from my debug, that > the form bean is > created a new each time. Can someone else confirm > this ? If you have the scope of the action set to 'request', then the bean is only around for the request. So it would be created each time. > > My further question is this: > > If I choose NOT to use automatic validation, and my > request goes to the > Action first [not the JSP], then what isthe best way > to determine in the > action that this is the 'first time' for this form > bean i.e. it has been > created only as a result of the ActionServlet, not > because it's coming > from the form on a JSP ? > > I know you can check the values of the form bean, > but this seems a > little messy. Any suggestions ? I think checking for values is the best way. How else can you tell one instance from another? The only other way I can think of is to have the a class and a subclass(es) that doesn't do anything, but represents what state the bean is in. > > Any help is appreciated, as this is an important > issue for us. > > Cheers > > Ghoot > > > > -----Original Message----- > > From: David Winterfeldt > [mailto:dwinterfeldt@yahoo.com] > > Sent: 31 July 2001 18:43 > > To: struts-user@jakarta.apache.org > > Subject: RE: Automatic Form Validation > > > > > > > > --- "Emaho, Ghoot" > wrote: > > > 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 think it is good to go through the controller if > you > > really want to keep the view separate. > > > > > > > > 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] > > You could always have one Action class that > handles > > all things that are auto-validatded and another > for > > things that shouldn't be validated. I'm not sure > how > > you could have the framework handle something that > is > > specific for your application unless there was a > > parameter that could turn off the auto-validation > for > > the current request > > (org.apache.struts.action.Action.VALIDATE=false). > > > > > > > > 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 ?! > > You can of course have as many actions to go with > a > > form as you want. I just prefer keeping it to a > > minimum. > > > > > > > > Thanks anyway David. > > > > > > Any other comments ? > > > > > > G > > > > > > > -----Original Message----- > > > > From: David Winterfeldt > > > [mailto:dwinterfeldt@yahoo.com] > > > > Sent: 31 July 2001 16:46 > > > > To: struts-user@jakarta.apache.org > > > > 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" > > > 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 ? > === message truncated === __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/