RE: Struts2 Validation w/ModelDriven

2011-05-19 Thread Chris Pratt
e of a property member that has been initialized in > either prepare() or the execute() or entry point method calls > themselves. > > -Chris > > -Original Message- > From: Eric Lentz [mailto:eric.le...@sherwin.com] > Sent: Thursday, May 19, 2011 1:22 PM > To: Struts

Re: Struts2 Validation w/ModelDriven

2011-05-19 Thread Dave Newton
On Thu, May 19, 2011 at 3:55 PM, CRANFORD, CHRIS wrote: > The framework will call getModel() multiple times before your validate() > and execute() methods are invoked; and so by adding the create/lookup > logic to getModel(); you would then have to wrap that block of code > around a null check so t

Re: Struts2 Validation w/ModelDriven

2011-05-19 Thread Dave Newton
On Thu, May 19, 2011 at 2:22 PM, Eric Lentz wrote: > I'm curious. If you are using ModelDriven, then why do you load your model > in prepare()? Why not in getModel? That'd mean you'd need the "did I already load the model?" code in getModel(), wouldn't it? Seems cleaner to use prepare, since that

RE: Struts2 Validation w/ModelDriven

2011-05-19 Thread CRANFORD, CHRIS
ember that has been initialized in either prepare() or the execute() or entry point method calls themselves. -Chris -Original Message- From: Eric Lentz [mailto:eric.le...@sherwin.com] Sent: Thursday, May 19, 2011 1:22 PM To: Struts Users Mailing List Subject: RE: Struts2 Validat

RE: Struts2 Validation w/ModelDriven

2011-05-19 Thread Eric Lentz
prepare. - Eric From: "CRANFORD, CHRIS" To: "Struts Users Mailing List" Date: 05/19/2011 01:16 PM Subject: RE: Struts2 Validation w/ModelDriven Not that I am aware. The paramsPrepareParamsStack to my knowledge handles validation at the very end; so by the time validat

Re: Struts2 Validation w/ModelDriven

2011-05-19 Thread Aaron Brown
8 AM > To: Struts Users Mailing List > Subject: Re: Struts2 Validation w/ModelDriven > >> So when this error condition is met and the user redirected back to > the > INPUT form; the >> field where they had entered "xyz" is now the original default >> initial

RE: Struts2 Validation w/ModelDriven

2011-05-19 Thread CRANFORD, CHRIS
, May 19, 2011 11:58 AM To: Struts Users Mailing List Subject: Re: Struts2 Validation w/ModelDriven > So when this error condition is met and the user redirected back to the INPUT form; the > field where they had entered "xyz" is now the original default > initialized value.

Re: Struts2 Validation w/ModelDriven

2011-05-19 Thread Eric Lentz
> So when this error condition is met and the user redirected back to the INPUT form; the > field where they had entered "xyz" is now the original default > initialized value. Can't you check the action error and not refresh the model when there is an error?

Struts2 Validation w/ModelDriven

2011-05-19 Thread CRANFORD, CHRIS
When I implement the ModelDriven interface in my Struts2 actions; I follow your typical prepare() method as follows: public void prepare() throws Exception { if(id != null) { model = service.create(/* some parameters */); } else { model = service.lookupById(id); } } When a user fir