struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff_Mycha...@nlgroup.ca
Subject Re: scope
Date Wed, 30 Oct 2002 14:42:05 GMT
Here is what we had to do.   I would love opinions to know if I am on the
right track.

In our BaseAction we have a helper method that looks for ActionErrors in
request scope (with the Struts Key):

protected boolean isValErrorsPresent(HttpServletRequest request){
        ActionErrors errors = (ActionErrors)request.getAttribute(Action.ERROR_KEY);
        return (errors == null)? false:true;
    }

Then in the load action for the page we decide if we populate the form bean from the  back
end or leave the form bean as it is:

 in LoadAction:

if(! isValErrorsPresent){
...Get form bean and populate with data from the back end...

}else{

.. Do nothing because form is already populated with bad data and the form will re display
the origianl data but with validation method.
}

my 2 cents..






"Knoernschild, Kirk W" <KKNOERNS@amfam.com> on 10/30/2002 08:27:21 AM

Please respond to "Struts Users Mailing List"
       <struts-user@jakarta.apache.org>

To:    <struts-user@jakarta.apache.org>
cc:

Subject:    scope


I'm using a databean to populate my JSP page. I put the bean on the
request. The page populates fine. When submitting however, Struts builds my
formbean and calls the validate method. If the validate method fails, I try
to return to the submitting page. However, that page uses the databean,
which is no longer in scope, and I error out. Others must have this same
challenge. What have y'all done to accommodate this? thanx.

--kirk

--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>











--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message