struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Burton Rhodes" <burtonrho...@gmail.com>
Subject Re: Cannot find bean in any scope when form contains errors
Date Sun, 09 Nov 2008 23:51:50 GMT
You need to have your action object implement Preparable (and perhaps
ModelDriven depending on your implementation) and set your action
member variables (or bean) in the Prepare method.  If there are
validation errors, this method will take care of your issue before
that error is recognized and since the 'execute' method won't be
called.

On 11/9/08, Amrinder Sandhu <amrsandhu@ucdavis.edu> wrote:
> Hi,
>
> I have an ExecuteTest action which returns a view. The action also sets up
> some beans that the view will use to display data to the user. The view also
> contains a form. Everything works when I go to the action, which shows me
> the view. The page contains the data from the beans and the textbox inside
> the form tag. If I enter valid data into the texbox and hit submit,
> everything works great. But if I leave the textbox empty or type in invalid
> data, I should get back error messages from the validate method of the form.
> But instead I get a HTTP 500 error message saying Cannot find bean in any
> scope. I see why I get this error message, but I can't seem to fix it.
>
> How can I have that bean be set again if the validation fails? This seems
> like a common issue, but did not find anything using google. Thanks in
> advance.
>
> Regards,
> Amrinder
>

-- 
Sent from my mobile device

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


Mime
View raw message