org.davesag.generica.servlet.action
Class HandleUpdateAction

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended byorg.davesag.generica.servlet.action.AbstractAction
          extended byorg.davesag.generica.servlet.action.HandleUpdateAction

public class HandleUpdateAction
extends AbstractAction

Uses a FormController to populate the updated object and a Saver to save it, then closes the Pipe. This action then generates a Summary using the Summariser provided and places that summary into the request under the key Constants.TARGET_KEY. This Action expects the form supplied to be an instance of GenericForm, although if you pass it an instance of an UploadForm, it will also save the attached file to disk at a path that can be specified in the web.xml file, and overridden by a parameter in the struts-config action defn.

An example of the Action config you would place in your struts-config.xml is as follows:
        <action
                path="/admin/handleeditsitecopy"
                type="org.davesag.generica.servlet.action.HandleUpdateAction"
                parameter="pipe=editsitecopy;
                                        form-controller=com.myapp.controller.SiteCopyController;
                                        saver=com.myapp.controller.SiteCopyController;
                                        summariser=com.myapp.controller.SiteCopyController"
                name="sitecopy"
                scope="request"
                validate="true"
                input="/admin/editsitecopy.do">
                <forward name="success" path="thanks.editsitecopy.page"/>
        </action>
 
Note: in the above example the controllers used are collapsed into a single class. This is quite normal, but the system is sufficiently flexible to allow you to put this logic in different classes if you wish.

Since:
Generica 1.0
Version:
CVS Revision $Id: HandleUpdateAction.java,v 1.22 2004/04/06 15:40:41 davesag Exp $
Author:
Dave Sag http://www.davesag.com

Field Summary
 
Fields inherited from class org.apache.struts.action.Action
ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY
 
Constructor Summary
HandleUpdateAction()
           
 
Method Summary
 ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
          handles work for updating of the object in the current pipe.
 
Methods inherited from class org.davesag.generica.servlet.action.AbstractAction
abortTransaction, commitTransaction, furtherActions, genericActions, getApplication, getController, getController, getHibernateSession, getLocale, getMessages, getNextForward, openTransaction, presentation, saveActionErrors, setNextForward
 
Methods inherited from class org.apache.struts.action.Action
execute, generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandleUpdateAction

public HandleUpdateAction()
Method Detail

execute

public ActionForward execute(ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
                      throws Exception
handles work for updating of the object in the current pipe.

Parameters:
mapping - the struts actioin mapping
form - the form bean
request - the http request
response - the http response.
Returns:
the right action foreward
Throws:
Exception - if anything went wrong.
IllegalArgumentException - if the action controller specified was not valid.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.