Forward Class

com.bea.wlw.netui.pageflow
Forward Class

public class Forward

    extends ActionForward

An object of this type is returned from an action methods in a PageFlowController to determine the next URI to be displayed. It is constructed on the name of a forward defined by the @jpf:forward tag, and resolves to the URI specified in that forward.


Hierarchy
Object
  ForwardConfig
    ActionForward
      Forward
All Implemented Interfaces

Serializable

Field Summary

public static final int
RETURN_TO_ACTION
int
public static final int
RETURN_TO_CURRENT_PAGE
int
public static final int
RETURN_TO_NONE
int
public static final int
RETURN_TO_PAGE
int
public static final int
RETURN_TO_PREVIOUS_ACTION
int
public static final int
RETURN_TO_PREVIOUS_PAGE
int
   
Fields from  org.apache.struts.config.ForwardConfig
configured, contextRelative, name, path, redirect
 

Constructor Summary

Forward(String forwardName, String pageInputName, Object pageInputValue)

Constructor which accepts the name of a forward defined by the @jpf:forward tag.
Forward(String forwardName, ActionForm outputForm)

Constructor which accepts the name of a forward defined by the @jpf:forward tag.
Forward(String forwardName)

Constructor which accepts the name of a forward defined by the @jpf:forward tag.
Forward(URI path, boolean redirect)

Constructs a Forward that returns the given URI for Forward.getPath().
Forward(URI path)

Constructs a Forward that returns the given URI for Forward.getPath().
Forward(URL path)

Constructs a Forward that returns the given URL for Forward.getPath().
 

Method Summary

public final void
addOutputForm(ActionForm form)
Add a form bean that will be made available in the request (or user session, as appropriate) if this Forward is returned by an action method in a PageFlowController.
public void
addPageInput(String name, Object value)
Adds a page input that will be made available in the request, through PageFlowUtils.getPageInput(String, ServletRequest)..
public void
addQueryParam(String name, String value)
Add a query parameter to the URI returned by Forward.getPath().
public final void
addQueryParam(String name)
Add a query parameter with no value to the URI returned by Forward.getPath().
public boolean
doesResolve()
Tell whether Forward.getPath() will be successful, i.e., whether one of the following two conditions is met:
  • the name around which this object was constructed resolves to a path defined by a @jpf:forward, or
  • this object was constructed around an explicit path, by Forward. or Forward..
protected ActionForward
findForward(String forwardName)
Resolves the forward with the given name, from the stored ActionMapping if possible, or from the stored alternate ModuleConfig as a last resort.
public boolean
forwardsToPageFlow()
Tell whether the URI returned by Forward.getPath() is for a page flow.
public final ActionForm[]
getOutputForms()
Get all form-beans attached to this forward through Forward.addOutputForm(ActionForm) or Forward..
public Map
getPageInputs()
Get all page inputs that have been set on this Forward.
public String
getPath()
Get the URI path associated with this object.
public String
getQueryString()
Get the query string that will be appended to the URI returned by Forward.getPath().
public int
getReturnToType()
Get the type of return, if this is a return-to type.
public String
getReturnToTypeAsString()
Get the type of return as a String, if this is a return-to type.
public void
initialize(ActionMapping mapping, FlowController flowController)
Set the current ActionMapping and associated FlowController.
public boolean
isNestedReturn()
Tell whether returning this forward from an action method will cause a return from a nested PageFlowController.
public boolean
isRedirect()
Tell whether the URI resolved by this Forward should be redirected to.
public boolean
isReturnToAction()
Tell whether returning this forward from an action method will cause the previous action to be re-run.
public boolean
isReturnToPage()
Tell whether returning this forward from an action method will cause a previous page to be displayed.
public void
setPath(String path)
Set the path to be returned by Forward.getPath().
public void
setQueryString(String queryString)
Set the query string that will be appended to the URI returned by Forward.getPath().
public void
setRedirect(boolean redirect)
Set whether the URI resolved by this Forward should be redirected to.
 
Methods from  org.apache.struts.config.ForwardConfig
freeze, getContextRelative, getName, getRedirect, setContextRelative, setName, toString
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   

Field Detail

RETURN_TO_ACTION

public static final int RETURN_TO_ACTION


RETURN_TO_CURRENT_PAGE

public static final int RETURN_TO_CURRENT_PAGE


RETURN_TO_NONE

public static final int RETURN_TO_NONE


RETURN_TO_PAGE

public static final int RETURN_TO_PAGE


RETURN_TO_PREVIOUS_ACTION

public static final int RETURN_TO_PREVIOUS_ACTION


RETURN_TO_PREVIOUS_PAGE

public static final int RETURN_TO_PREVIOUS_PAGE

 

Constructor Detail

Forward

public Forward(String forwardName, 
               String pageInputName, 
               Object pageInputValue)
Constructor which accepts the name of a forward defined by the @jpf:forward tag. The values returned from Forward.getPath(), Forward.getRedirect() and Forward.contextRelative are resolved from this forward. Also accepts a named page input to make available in the request, through PageFlowUtils.getPageInput(String, ServletRequest)..

Forward

public Forward(String forwardName, 
               ActionForm outputForm)
Constructor which accepts the name of a forward defined by the @jpf:forward tag. The values returned from Forward.getPath(), Forward.getRedirect() and Forward.contextRelative are resolved from this forward. Also accepts a form bean to make available in the request (or user session, as appropriate).

Forward

public Forward(String forwardName)
Constructor which accepts the name of a forward defined by the @jpf:forward tag. The values returned from Forward.getPath(), Forward.getRedirect() and Forward.contextRelative are resolved from this forward.

Forward

public Forward(URI path, 
               boolean redirect)
Constructs a Forward that returns the given URI for Forward.getPath().

Forward

public Forward(URI path)
Constructs a Forward that returns the given URI for Forward.getPath(). By default the Forward will cause server forward (not a browser redirect); to change this, use Forward.setRedirect(boolean).

Forward

public Forward(URL path)
Constructs a Forward that returns the given URL for Forward.getPath(). Because the URL path is absolute by nature, this Forward will cause a browser redirect.
 

Method Detail

addOutputForm(ActionForm) Method

public final void addOutputForm(ActionForm form)
Add a form bean that will be made available in the request (or user session, as appropriate) if this Forward is returned by an action method in a PageFlowController. Specifically, each form bean is stored as a request attribute with a name determined by PageFlowUtils.getFormBeanName(ActionForm, HttpServletRequest).

Parameters

form
the form bean instance to add.

addPageInput(String, Object) Method

public void addPageInput(String name, 
                         Object value)
Adds a page input that will be made available in the request, through PageFlowUtils.getPageInput(String, ServletRequest)..

Parameters

name
the name of the page input.
value
the page input value.

addQueryParam(String, String) Method

public void addQueryParam(String name, 
                          String value)
Add a query parameter to the URI returned by Forward.getPath().

Parameters

name
the name of the query parameter.
value
the value of the query parameter, or null if there is no value.

addQueryParam(String) Method

public final void addQueryParam(String name)
Add a query parameter with no value to the URI returned by Forward.getPath().

Parameters

name
the name of the query parameter.

doesResolve() Method

public boolean doesResolve()
Tell whether Forward.getPath() will be successful, i.e., whether one of the following two conditions is met:

Returns

true if this forward does resolve to a URI path.

findForward(String) Method

protected ActionForward findForward(String forwardName)
Resolves the forward with the given name, from the stored ActionMapping if possible, or from the stored alternate ModuleConfig as a last resort.

Parameters

forwardName
the name of the forward to resolve.

Returns

the resolved ActionForward, or null if none is found.

forwardsToPageFlow() Method

public boolean forwardsToPageFlow()
Tell whether the URI returned by Forward.getPath() is for a page flow.

Returns

true if the URI returned by Forward.getPath() is for a page flow, i.e., if it ends in ".jpf".

getOutputForms() Method

public final ActionForm[] getOutputForms()
Get all form-beans attached to this forward through Forward.addOutputForm(ActionForm) or Forward..

Returns

an array of ActionForm instances that are attached to this forward.

getPageInputs() Method

public Map getPageInputs()
Get all page inputs that have been set on this Forward.

Returns

a Map of name/value pairs representing all page inputs.

Related Topics

Forward.addPageInput(String, Object)


getPath() Method

public String getPath()
Get the URI path associated with this object. Resolve it from the name of a forward (@jpf:forward) if necessary.

Overrides
ForwardConfig.getPath()

Returns

a String that is the URI path.

Related Topics

Forward.
Forward.
Forward.
Forward.
Forward.setPath(String)


getQueryString() Method

public String getQueryString()
Get the query string that will be appended to the URI returned by Forward.getPath().

Returns

the query string that will be appended to the URI, or null if there is no query string.

getReturnToType() Method

public int getReturnToType()
Get the type of return, if this is a return-to type.

Returns

one of the following values: Forward.RETURN_TO_CURRENT_PAGE, Forward.RETURN_TO_PREVIOUS_PAGE, Forward.RETURN_TO_PAGE, Forward.RETURN_TO_PREVIOUS_ACTION, Forward.RETURN_TO_ACTION, or Forward.RETURN_TO_NONE if this Forward is not a return-to type.

Related Topics

Forward.isReturnToAction()
Forward.isReturnToPage()


getReturnToTypeAsString() Method

public String getReturnToTypeAsString()
Get the type of return as a String, if this is a return-to type.

Returns

one of the following values: currentPage, previousPage, page, (deprecated), previousAction, action (deprecated), or null if this is not a return-to type.

Related Topics

Forward.isReturnToAction()
Forward.isReturnToPage()


initialize(ActionMapping, FlowController) Method

public void initialize(ActionMapping mapping, 
                       FlowController flowController)
Set the current ActionMapping and associated FlowController. Normally, this method is called by the framework, but you can use it to initialize the Forward object in order to call Forward.getPath().

Parameters

mapping
the current ActionMapping; this can be obtained from FlowController.getMapping().
flowController
the object in which to look for referenced return-form members.

isNestedReturn() Method

public boolean isNestedReturn()
Tell whether returning this forward from an action method will cause a return from a nested PageFlowController.

Returns

true if this forward will cause a return from nesting.

isRedirect() Method

public boolean isRedirect()
Tell whether the URI resolved by this Forward should be redirected to.

Returns

true if the controller will send a browser redirect to the URI for this Forward; false if it will do a server forward to the URI.

isReturnToAction() Method

public boolean isReturnToAction()
Tell whether returning this forward from an action method will cause the previous action to be re-run.

Returns

true if returning this forward from an action method will cause the previous action to be re-run, i.e., whether the URI returned by Forward.getPath() will end in "previous-action-name.do".

isReturnToPage() Method

public boolean isReturnToPage()
Tell whether returning this forward from an action method will cause a previous page to be displayed.

Returns

true if returning this forward from an action method will cause a previous page to be displayed.

setPath(String) Method

public void setPath(String path)
Set the path to be returned by Forward.getPath(). This overrides any path or forward name set in a constructor.

Overrides
ForwardConfig.setPath(String)

Parameters

path
the URI to be returned by Forward.getPath().

setQueryString(String) Method

public void setQueryString(String queryString)
Set the query string that will be appended to the URI returned by Forward.getPath().

Parameters

queryString
the query string that will be appended to the URI. If this string does not start with '?', then this character will be prepended; if the string is null, the query string will be removed.

setRedirect(boolean) Method

public void setRedirect(boolean redirect)
Set whether the URI resolved by this Forward should be redirected to.

Overrides
ForwardConfig.setRedirect(boolean)

Parameters

redirect
if true, the controller will send a browser redirect to the URI for this Forward; otherwise, it will do a server forward to the URI.