org.davesag.generica.servlet.action
Class LoadTargetAction

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

public class LoadTargetAction
extends AbstractAction

This action loads the appropriate object into the request for use by forms and following actions. It loads the target object into the request under the key Constants.TARGET_KEY, and loads a summary of the target object into the request under the key Constants.TARGET_SUMMARY_KEY. What these objects are, and how they are loaded, is entirely up to the Loader you specify in the struts-config.xml file.

Since:
Generica 1.0
Version:
CVS Revision $Id: LoadTargetAction.java,v 1.21 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
LoadTargetAction()
           
 
Method Summary
 ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
          Tries to get the id from the param called "target" in the request and loads the associated object into a Pipe using the Controller specified in the ActionMapping, under key Constants.TARGET_KEY.
 
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

LoadTargetAction

public LoadTargetAction()
Method Detail

execute

public ActionForward execute(ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
                      throws Exception
Tries to get the id from the param called "target" in the request and loads the associated object into a Pipe using the Controller specified in the ActionMapping, under key Constants.TARGET_KEY.

If there is no target param then it looks in the Pipe for the object.
If there is no existing Pipe one is created using the pipe-name supplied in the ActionMapping, ie from struts-config.xml
If successful this action hands control on to the ActionForward named "success" and loads the request with a Summary object that summarises the loaded object according to the supplied summary-controller, if not then it hands control on to a forward named "fail".

Parameters:
mapping - The ActionMapping which must have a name param that matches the names provided to any following forms and actions.
form - The Struts ActionForm
request - The servlet request.
response - The servlet response.
Returns:
the right forward
Throws:
Exception - if something broke.


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