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(XXXX);
        }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]

Reply via email to