jp.terasoluna.fw.web.struts.actions
Class ForwardAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by jp.terasoluna.fw.web.struts.actions.ActionEx
          extended by jp.terasoluna.fw.web.struts.actions.ForwardAction

public class ForwardAction
extends ActionEx

Simple forward action.

It inherits ActionEx functions (transition log output / transaction token check) and forwards to JSP. Like the ForwardAction provided by Struts, this action forwards to the destination specified in the "parameter" attribute of struts-config.xml. when the "parameter" attribute is not set, it fetches the action forward with the logical forward name as "success". When the forward destination is not set, it returns the error SC_NOT_FOUND(404). When the direct access to the *.jsp file is prohibited, it is necessary to make the entry in struts-config.xml by using this action in order to display the JSP without performing any business/application processing. Process which is performed by ActionEx#execute(), is also inherited here.


Description example of Bean definition file and struts-config.xml, is shown below.

Example:

Configuration of Bean definition file
  <bean name="/foo" scope="prototype"
      class="jp.terasoluna.fw.web.struts.actions.ForwardAction">
  </bean>
  

Configuration of struts-config.xml
  <action path="/foo"
          parameter="/foo.jsp">
  </action>
    
or
  <action path="/foo"
          parameter="/foo.jsp">
    <forward name="success" path="/foo.jsp" module="/sub1" redirect="true">
  </action>
    


contextRelative field Changing the method of specifying the path in parameter attribute.
Difference in the method of specifying the path depending on the value set in contextRelative
In case of true Specify the absolute path from the context root in "parameter" attribute.
It is used to make the transition within the same module.
  <action path="/pagelinkForward"
          parameter="/pagelink/sc2401.jsp"/>
    
In case of false In the "parameter" attribute, only the module relative path can be specified.
<forward> element should be used to make the transition across the modules or to redirect.
  <action path="/pagelinkForward"
          parameter="/sc2401.jsp"/>
    
Method of setting contextRelative Provide the settings in system.properties.
Treated as false when the settings are omitted.
system.properties
 forwardAction.contextRelative=true
    


Field Summary
private static java.lang.String FORWARD_ACTION_CONTEXT_RELATIVE_KEY
          Property key of the value set in the contextRelative
private static java.lang.String FORWARD_ERRORPAGE_ERROR
          Error page (404) Error code indicating the transition failure.
private static java.lang.String FORWARD_SUCCESS
          Logical forward name.
private static org.apache.commons.logging.Log log
          Log class.
 
Fields inherited from class jp.terasoluna.fw.web.struts.actions.ActionEx
FORWARD_TXTOKEN_ERROR
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
ForwardAction()
           
 
Method Summary
 org.apache.struts.action.ActionForward doExecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Sets the value (destination page) of "parameter" attribute to the action forward and returns action forward. When "parameter" attribute is not set, returns the action forward with the logical forward name as "success". When neither of the above is set, returns the error(404).
 
Methods inherited from class jp.terasoluna.fw.web.struts.actions.ActionEx
addErrors, addMessages, execute, isSaveToken, isTokenCheck, processTokenCheck, setSaveToken, setTokenCheck
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, 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

log

private static org.apache.commons.logging.Log log
Log class.


FORWARD_ERRORPAGE_ERROR

private static final java.lang.String FORWARD_ERRORPAGE_ERROR
Error page (404) Error code indicating the transition failure.

See Also:
Constant Field Values

FORWARD_SUCCESS

private static final java.lang.String FORWARD_SUCCESS
Logical forward name.

See Also:
Constant Field Values

FORWARD_ACTION_CONTEXT_RELATIVE_KEY

private static final java.lang.String FORWARD_ACTION_CONTEXT_RELATIVE_KEY
Property key of the value set in contextRelative

See Also:
Constant Field Values
Constructor Detail

ForwardAction

public ForwardAction()
Method Detail

doExecute

public org.apache.struts.action.ActionForward doExecute(org.apache.struts.action.ActionMapping mapping,
                                                        org.apache.struts.action.ActionForm form,
                                                        javax.servlet.http.HttpServletRequest req,
                                                        javax.servlet.http.HttpServletResponse res)
Sets the value (destination page) of "parameter" attribute to the action forward and returns the action forward. When the " parameter" attribute is not set, returns action forward with logical forward name as "success". When neither of the above is set, returns the error(404).

Specified by:
doExecute in class ActionEx
Parameters:
mapping - Action mapping
form - Action form
req - HTTP request
res - HTTP response
Returns:
Action forward