org.web_auth.utils
Class ActionUtils

java.lang.Object
  extended byorg.web_auth.utils.ActionUtils

public class ActionUtils
extends java.lang.Object

This class provides utility functions for struts actions.

Version:
1.0
Author:
Zhengrong Tang

Field Summary
static java.lang.String ACTION_FAILURE
           
static java.lang.String ACTION_SUCCESS
           
static java.lang.String UserClass
           
static java.lang.String UserSessionClass
           
 
Constructor Summary
ActionUtils()
           
 
Method Summary
static java.lang.Object getObject(org.apache.struts.action.ActionMapping actionMapping, java.lang.String paramName)
          This method finds the value of a parameter defined in a struts action mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UserClass

public static final java.lang.String UserClass
See Also:
Constant Field Values

UserSessionClass

public static final java.lang.String UserSessionClass
See Also:
Constant Field Values

ACTION_SUCCESS

public static final java.lang.String ACTION_SUCCESS
See Also:
Constant Field Values

ACTION_FAILURE

public static final java.lang.String ACTION_FAILURE
See Also:
Constant Field Values
Constructor Detail

ActionUtils

public ActionUtils()
Method Detail

getObject

public static java.lang.Object getObject(org.apache.struts.action.ActionMapping actionMapping,
                                         java.lang.String paramName)
                                  throws ActionMappingException
This method finds the value of a parameter defined in a struts action mapping. The value is expected to be a class name. This method then returns an instance of the class.

 For example, an struts action mapping might be
  <action path="/members/login"
          type="org.web_auth.ui.action.LoginAction"
          name="loginForm"
          input="/members/login.jsp"
          parameter="UserClass=application.Member;UserSessionClass=application.MemberSession"
          scope="request">
  </action>
 

A call of ActionUtils.getObject(actionMapping, "UserClass") would return an instance of application.Member.
A call of ActionUtils.getObject(actionMapping, "UserSessionClass") would return an instance of application.MemberSession.

For efficiency, a read-only cache is used.

Parameters:
actionMapping - a struts action mapping
paramName - a parameter name defined in "parameter" of this action mapping
Returns:
an instance of a class, whose name is the value of the parameter name
Throws:
ActionMappingException - if the expected parameter name cannot be found in the action mapping or if class cannot be found or any other expected exception happens


Copyright © 2003 Zhengrong Tang. All Rights Reserved.