struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
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...


.. 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" <> on 10/30/2002 08:27:21 AM

Please respond to "Struts Users Mailing List"

To:    <>

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.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message