org.apache.struts.action
Class ActionRedirect
- Serializable
public class ActionRedirect
A subclass of
ActionForward
which is designed for use
in redirecting requests, with support for adding parameters
at runtime.
An
ForwardConfig
(or subclass) can be passed to the constructor
to copy its configuration:
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
ActionRedirect redirect =
new ActionRedirect(mapping.findForward("doRedirect"));
redirect.addParameter("param1","value1");
redirect.addParameter("param2","2");
redirect.addParameter("param3","3.0");
return redirect;
}
$Rev: 164747 $ $Date: 2005-04-26 06:47:48 +0100 (Tue, 26 Apr 2005) $protected static Log | log - Commons logging instance.
|
protected Map | parameterValues - Holds the redirect parameters.
|
ActionRedirect() - Construct a new instance with redirect set to true
and initialize parameter lists.
|
ActionRedirect(String path) - Construct a new instance with the specified path
and initialize parameter lists.
|
ActionRedirect(String name, String path, String module) - Construct a new instance with the specified values
and initialize parameter lists.
|
ActionRedirect(ForwardConfig baseConfig) - Construct a new instance with a
ForwardConfig object
to copy name, path, and contextRelative values from.
|
void | addParameter(String fieldName, Object valueObj) - Adds the object's toString() to the list of parameters if it's
not null, or an empty string with the given fieldName if it is.
|
String | getOriginalPath() - Get the original path without the parameters added at runtime.
|
String | getParameterString() - Forms the string containing the parameters
passed onto this object thru calls to addParameter().
|
String | getPath() - Get the path for this object, including any parameters
that may have been added at runtime.
|
private void | initializeParameters() - Initializes the internal objects
used to hold parameter values.
|
String | toString() - Return a string description of this object.
|
freeze , getContextRelative , getModule , getName , getPath , getRedirect , setContextRelative , setModule , setName , setPath , setRedirect , toString |
log
protected static final Log log
Commons logging instance.
parameterValues
protected Map parameterValues
Holds the redirect parameters.
Each entry is either a String or a String[] depending on whether
it has one or more entries.
ActionRedirect
public ActionRedirect()
Construct a new instance with redirect set to true
and initialize parameter lists.
ActionRedirect
public ActionRedirect(String path)
Construct a new instance with the specified path
and initialize parameter lists.
path
- Path for this instance
ActionRedirect
public ActionRedirect(String name,
String path,
String module)
Construct a new instance with the specified values
and initialize parameter lists.
name
- Name of this instancepath
- Path for this instancemodule
- Module prefix, if any
ActionRedirect
public ActionRedirect(ForwardConfig baseConfig)
Construct a new instance with a
ForwardConfig
object
to copy name, path, and contextRelative values from.
addParameter
public void addParameter(String fieldName,
Object valueObj)
Adds the object's toString() to the list of parameters if it's
not null, or an empty string with the given fieldName if it is.
fieldName
- the name to use for the parametervalueObj
- the value for this parameter
getOriginalPath
public String getOriginalPath()
Get the original path without the parameters added at runtime.
- the original path as configured.
getParameterString
public String getParameterString()
Forms the string containing the parameters
passed onto this object thru calls to addParameter().
- a string which can be appended to the URLs. The
return string does not include a leading question
mark (?).
getPath
public String getPath()
Get the path for this object, including any parameters
that may have been added at runtime.
- getPath in interface ForwardConfig
initializeParameters
private void initializeParameters()
Initializes the internal objects
used to hold parameter values.
toString
public String toString()
Return a string description of this object.
- toString in interface ForwardConfig
- a string containing the original path for this object
and the parameters it currently holds
Copyright B) 2000-2007 - The Apache Software Foundation