Typo: I wrote "DispatchAction and its subclasses accepts input as form
submission
only (POST)". Must read as "DialogAction and its subclasses accepts
input as form submission only (POST)"

Also, two other methods for completeness. This one is called when a
user submits new/updated item to persist it. This is "input" phase.

    public ActionForward onSave (ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) 
        throws Exception {

        HttpSession session = request.getSession();
        ICRUDForm crudForm = (ICRUDForm) form;

        // Validate input data
        ActionMessages messages = form.validate(mapping, request);

        // Input data is not valid
        if (messages != null && messages.size() > 0) {
            session.setAttribute(Globals.ERROR_KEY, messages);
            return mapping.findForward(CRUDConstants.MAPPING_ON_INVALID_DATA);

        // Input data is valid
        } else {

            // Try to persist form data
            ActionMessages storeMessages = crudForm.crudStore();

            // Could not persist form data
            if (storeMessages != null && storeMessages.size() > 0) {
                session.setAttribute(Globals.ERROR_KEY, storeMessages);
                return
mapping.findForward(CRUDConstants.MAPPING_ON_STORE_FAILURE);

            // Successfully persisted
            } else {
                return
mapping.findForward(CRUDConstants.MAPPING_ON_STORE_SUCCESS);
            }
        }
    }

Another forwards to a proper page, this is "render" phase. This
particular implementation uses CRUD mode for page mapping.

    public ActionForward getDialogView(ActionMapping mapping,
                                       ActionForm form,
                                       HttpServletRequest request,
                                       HttpServletResponse response) 
        throws Exception {

        ICRUDForm crudForm = (ICRUDForm) form;
        String uiMode = crudForm.getCrudUIMode();
        return mapping.findForward(uiMode);
    }

Michael.

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

Reply via email to