DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=22357>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=22357


[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Additional Comments From [EMAIL PROTECTED]  2006-03-08 08:38 -------
Struts allows to submit a form with no corresponding ActionForm. This works
great, especially for dispatch-type actions. All events assigned to form's
buttons are properly delivered to handler methods. All but Cancel event,
cancelled method is not invoked.

RequestProcessor.processPopulate method looks like this:


    protected void processPopulate(...) {

        if (form == null) {
            return;
        }

        form.setServlet(this.servlet);
        form.reset(mapping, request);
        
        if (mapping.getMultipartClass() != null) {
            request.setAttribute(Globals.MULTIPART_KEY,
                                 mapping.getMultipartClass());
        }
        
        RequestUtils.populate(form, mapping.getPrefix(), mapping.getSuffix(),
                              request);

        if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) ||
            (request.getParameter(Constants.CANCEL_PROPERTY_X) != null)) {
                
            request.setAttribute(Globals.CANCEL_KEY, Boolean.TRUE);
        }
    }


I suggest checking for cancel button first and return immediately if Cancel was
activated without populating a form:


    protected void processPopulate(...) {

        if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) ||
            (request.getParameter(Constants.CANCEL_PROPERTY_X) != null)) {
                
            request.setAttribute(Globals.CANCEL_KEY, Boolean.TRUE);
            return;
        }

        if (form == null) {
            return;
        }

        form.setServlet(this.servlet);
        form.reset(mapping, request);
        
        if (mapping.getMultipartClass() != null) {
            request.setAttribute(Globals.MULTIPART_KEY,
                                 mapping.getMultipartClass());
        }
        
        RequestUtils.populate(form, mapping.getPrefix(), mapping.getSuffix(),
                              request);

    }

1. I have several forms with no ActionForm attached. Currently I have to define
a dummy form bean in the struts_config.xml file to make Cancel button work.
2. I can also send a Cancel event via link and I want to handle it in the
uniform manner, that is, in "cancelled" method.
3. Another improvement from this change is that form is not populated if user
activated Cancel button.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to