Title: session formbeans with validate errors BUG?

I have a session-scoped action which uses a form bean to collect and validate properties.  This page is within a set of frames, which explains the session scoping.

When the page is submitted, it is submitted to the controller but to the parent frame target.  Thus, if there is an error, the page that is reloaded is a frameset that loads the actual form page in another request.

My problem is that the form values are getting reloaded, as they should because of the session scoping, but the error messages are not getting displayed.

Here's the code in ActionServlet.  It seems to just stick the errors on the request rather than on the same scope as the action.  Is this a bug or a feature?

        // Call the validate() method of our ActionForm bean
        ActionErrors errors = formInstance.validate(mapping, request);
       
        ...

        // Save our error messages and return to the input form if possible
        if (debug >= 1)
            log("  Validation error(s), redirecting to: " + uri);
        request.setAttribute(Action.ERROR_KEY, errors);
        RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
        rd.forward(request, response);
        return (false);

Mike

Reply via email to