[Q] Revisiting: Repopulating Lists after validation returns false

2003-02-27 Thread Rick Reumann
A while back there was a good discussion going about the best practice
for repopulating lists that a JSP form needs after validation returns
false and you need to be returned to the initial JSP form.

The problem of course is if you have an options collection that is not
in session or application scope, you some how need to have this
collection repopulated.

Popular belief seems to be to not do this in the reset method of an
ActionForm (or any of it's sub classes). 

I really liked Robert Taylor's solution of setting the input attribute
in your config file to be that of the action that sets up your form, so
that if validation fails you form collections are reset.

The problem, though, I'm running into with that approach is that what if
your setUp action also is used to set fields in the ActionForm? You will
end up reseting anything the user submitted for those fields.

Is there a good work around to this problem? or other suggestions of
where/when to repopulate lists after validation?


-- 
Rick Reumann

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



RE: [Q] Revisiting: Repopulating Lists after validation returns false

2003-02-27 Thread James Mitchell
In most cases I've used, putting them in application scope works great.
I know that won't work for a list setup by what role someone might have
or other such case, in those cases I would use session scope (but I
don't see that much with what I do).


--
James Mitchell
Web Developer/Struts Evangelist
http://www.apache.org/struts/



 -Original Message-
 From: Rick Reumann [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, February 27, 2003 3:07 PM
 To: Struts Users Mailing List
 Cc: Robert Taylor
 Subject: [Q] Revisiting: Repopulating Lists after validation 
 returns false
 
 
 A while back there was a good discussion going about the best practice
 for repopulating lists that a JSP form needs after validation returns
 false and you need to be returned to the initial JSP form.
 
 The problem of course is if you have an options collection that is not
 in session or application scope, you some how need to have this
 collection repopulated.
 
 Popular belief seems to be to not do this in the reset method of an
 ActionForm (or any of it's sub classes). 
 
 I really liked Robert Taylor's solution of setting the input attribute
 in your config file to be that of the action that sets up 
 your form, so
 that if validation fails you form collections are reset.
 
 The problem, though, I'm running into with that approach is 
 that what if
 your setUp action also is used to set fields in the 
 ActionForm? You will
 end up reseting anything the user submitted for those fields.
 
 Is there a good work around to this problem? or other suggestions of
 where/when to repopulate lists after validation?
 
 
 -- 
 Rick Reumann
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



Re: [Q] Revisiting: Repopulating Lists after validation returns false

2003-02-27 Thread Jeff_Mychasiw

I handle this with mulitple mappings to the same loadAction.
The parameter is used to suppress parts of the load action.

/crApplicationLoad.do
and
/crApplicationLoadOnError.do

ie:
Two possible load mappings:

action path=/crApplicationLoad
 scope=request
 type=com.nlg.ar.web.accounting.action.AcctCRApplicationLoadAction
 name=acctCrApplicationForm
 validate=false
 forward name=success path=view.accounting.cashreceipt.application.main /
  /action

   action path=/crApplicationLoadOnError
 scope=request
 type=com.nlg.ar.web.accounting.action.AcctCRApplicationLoadAction
 name=acctCrApplicationForm
 validate=false
 parameter=loadOnError 
 forward name=success path=view.accounting.cashreceipt.application.main /
  /action

Perform validation on a save
 action path=/crApplicationSave
  type=com.nlg.ar.web.accounting.action.AcctCRApplicationSaveAction
  name=acctCrApplicationForm
  scope=request
  validate=true
  input=/crApplicationLoadOnError.do
 forward name=success path=/crEntryLoad.do /
  /action


From the load action:
 //** Get Invoice List **
//Do not use the list if returned on error
if(!(param.equals(PARAM_ON_ERROR))){
 // get back end data for the page.
appForm.setInvoiceWebList();
}else{
   if(log.isDebugEnabled()) log.debug(Did not load list because of validation 
error: );
}
//**


I have not tried it but it seems as thought this type of thing might be easier with a 
DynaAction..

hope this helps.




Rick Reumann [EMAIL PROTECTED] on 02/27/2003 02:06:35 PM

Please respond to Struts Users Mailing List
   [EMAIL PROTECTED]

To:Struts Users Mailing List [EMAIL PROTECTED]
cc:Robert Taylor [EMAIL PROTECTED]

Subject:[Q] Revisiting: Repopulating Lists after validation returns
   false


A while back there was a good discussion going about the best practice
for repopulating lists that a JSP form needs after validation returns
false and you need to be returned to the initial JSP form.

The problem of course is if you have an options collection that is not
in session or application scope, you some how need to have this
collection repopulated.

Popular belief seems to be to not do this in the reset method of an
ActionForm (or any of it's sub classes).

I really liked Robert Taylor's solution of setting the input attribute
in your config file to be that of the action that sets up your form, so
that if validation fails you form collections are reset.

The problem, though, I'm running into with that approach is that what if
your setUp action also is used to set fields in the ActionForm? You will
end up reseting anything the user submitted for those fields.

Is there a good work around to this problem? or other suggestions of
where/when to repopulate lists after validation?


--
Rick Reumann

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








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



RE: [Q] Revisiting: Repopulating Lists after validation returns false

2003-02-27 Thread Kris Schneider
I suppose you could keep the collection as a property of the form bean and
serialize it as a set of hidden inputs.

Quoting James Mitchell [EMAIL PROTECTED]:

 In most cases I've used, putting them in application scope works great.
 I know that won't work for a list setup by what role someone might have
 or other such case, in those cases I would use session scope (but I
 don't see that much with what I do).
 
 
 --
 James Mitchell
 Web Developer/Struts Evangelist
 http://www.apache.org/struts/
 
 
 
  -Original Message-
  From: Rick Reumann [mailto:[EMAIL PROTECTED] 
  Sent: Thursday, February 27, 2003 3:07 PM
  To: Struts Users Mailing List
  Cc: Robert Taylor
  Subject: [Q] Revisiting: Repopulating Lists after validation 
  returns false
  
  
  A while back there was a good discussion going about the best practice
  for repopulating lists that a JSP form needs after validation returns
  false and you need to be returned to the initial JSP form.
  
  The problem of course is if you have an options collection that is not
  in session or application scope, you some how need to have this
  collection repopulated.
  
  Popular belief seems to be to not do this in the reset method of an
  ActionForm (or any of it's sub classes). 
  
  I really liked Robert Taylor's solution of setting the input attribute
  in your config file to be that of the action that sets up 
  your form, so
  that if validation fails you form collections are reset.
  
  The problem, though, I'm running into with that approach is 
  that what if
  your setUp action also is used to set fields in the 
  ActionForm? You will
  end up reseting anything the user submitted for those fields.
  
  Is there a good work around to this problem? or other suggestions of
  where/when to repopulate lists after validation?
  
  
  -- 
  Rick Reumann
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

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



Re: [Q] Revisiting: Repopulating Lists after validation returns false

2003-02-27 Thread Jeff_Mychasiw

We still keep static lists  in various scopes, but all of our pages are pre
populated with back end data so I needed a way to turn that off.

I found that this also helped me when I needed
to add stuff like  a clear link that would reload previously saved data.






Rick Reumann [EMAIL PROTECTED] on 02/27/2003 02:40:27 PM

Please respond to Struts Users Mailing List
   [EMAIL PROTECTED]

To:Struts Users Mailing List [EMAIL PROTECTED]
cc:

Subject:Re: [Q] Revisiting: Repopulating Lists after validation returns
   false


On Thu, 27 Feb 2003 14:25:51 -0600
[EMAIL PROTECTED] wrote:


 I handle this with mulitple mappings to the same loadAction.
 The parameter is used to suppress parts of the load action.

Cool idea Jeff! Thanks. I actually thought about just even using one
mapping and then just checking for any ActionErrors (which there
shouldn't be if you are just coming from a normal set up of the form).
That might even be easier, although I haven't tried it.


--
Rick Reumann

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








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