net.smartlab.web
Class DynaAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by net.smartlab.web.Action
          extended by net.smartlab.web.DynaAction
Direct Known Subclasses:
AbstractArchiveAction

public abstract class DynaAction
extends Action

This class represent the dynamic version of the basic Action class allowing a single class to define multiple actions. Each declared method respecting the PARAMETERS signature and returning a String or an ActionMapping will be available as an action mapping in Struts. As an example both the following methods can be used in the struts configuration file as valid mappings.

In addition this class supports the same features providen by the org.apache.struts.actions.LookupDispatchAction but to distinguish between direct method naming and reverse lookup naming you have to prefix the reverse lookup mapping parameter with @ (at) character.

Author:
rlogiacco

Field Summary
static java.lang.Class[] PARAMETERS
          Standard dynamic method parameters.
 
Fields inherited from class net.smartlab.web.Action
DEFAULT_FORWARD, logger
 
Fields inherited from class org.apache.struts.action.Action
servlet
 
Constructor Summary
DynaAction()
          Default constructor.
 
Method Summary
protected  org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
          Implement this method to provide a custom response to a user input.
 java.lang.String forward(org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.struts.action.ActionMapping mapping)
          Default method action used to simply forward requests to the resource mapped as success.
 
Methods inherited from class net.smartlab.web.Action
addError, addError, cancel, execute, getProperties, getRealPath, getServletContext, hasErrors, isChecked, populate, reset, valorize
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETERS

public static final java.lang.Class[] PARAMETERS
Standard dynamic method parameters.

Constructor Detail

DynaAction

public DynaAction()
Default constructor.

Method Detail

execute

protected org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionForm form,
                                                         javax.servlet.http.HttpServletRequest request,
                                                         javax.servlet.http.HttpServletResponse response,
                                                         org.apache.struts.action.ActionMapping mapping)
                                                  throws java.lang.Exception
Description copied from class: Action
Implement this method to provide a custom response to a user input.

Specified by:
execute in class Action
Parameters:
form - the html form submitted with this request.
request - the user request.
response - the representation of the response channel.
mapping - the system control mapping.
Returns:
the name of a defined global or local forward.
Throws:
java.lang.Exception - if something unexpected happend during the request execution.
See Also:
Action.execute(org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, ActionMapping)

forward

public final java.lang.String forward(org.apache.struts.action.ActionForm form,
                                      javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response,
                                      org.apache.struts.action.ActionMapping mapping)
Default method action used to simply forward requests to the resource mapped as success.

Returns:
success


Copyright © 2004-2009 The SmartWeb Team. All Rights Reserved.