PortletParameters interface defines the API
for accessing the parameters that are set for the portlet or on a portlet URL.
Portlet parameters store state information that the portlet needs to render itself, generate content by serving resources, or make decisions when executing portlet actions. Conceptually the portlet parameters correspond to query string parameters that are stored in the URL used to access the portlet, although they are not required to actually be present on the URL as visible parameters.
Private parameters parameters are available exclusively to a single portlet. Public parameters can be shared between portlets.
The portlet parameters governing the request can be read during all portlet
execution phases through the PortletParameters object available
from the portlet request. Portlet parameters
can be set for subsequent or future portlet execution phases through
the MutablePortletParameters object available from the
portlet response object or from the portlet URL.
Different types of portlet parameters are distinguished according to their use.
Refer to PortletRequest#getRenderParameters(),
StateAwareResponse#getRenderParameters(), and
PortletURL#getRenderParameters().
Example: Render URLs with differing render parameters can be used to implement tabbed navigation within a portlet.
Refer to ResourceRequest#getResourceParameters() and
ResourceURL#getResourceParameters().
Example: Portlets may require several different pieces of content to be served for the governing render state. Resource URLs with differing resource parameters can be used to determine which content is to be served for a specific request.
Refer to ActionRequest#getActionParameters() and
ActionURL#getActionParameters().
Example: Portlets may render a number of buttons or links
for the governing render state.
Action URLs with differing action parameters can be used to
determine which action is to be executed for a specific request.
Example: Portlets may render forms that, when submitted, may cause
parameters to be added to the portlet action request.
During action request processing, these form parameters will be available as
action parameters.
MutablePortletParameters
| Modifier and Type | Method and Description |
|---|---|
| public MutablePortletParameters | Returns: Mutable clone of PortletParameters object
Returns a
MutablePortletParameters object encapsulating a copy of the same
parameters as the original object. |
| public Set | Returns: aSet of String
objects, each String containing
the name of a parameter; or an
empty Set if the
PortletParameters object has no parameters.
Returns a
Set of String
objects containing the names of the parameters contained
in this object. |
| public String | |
| public String[] | Returns: an array ofString objects
containing the parameter values, or null
if the parameter does not exist.a name)String containing the name of
the parameter the value of which is requested
Returns an array of
String objects containing
all of the values the given parameter, or
null if the parameter does not exist. |
| public boolean | Returns: true if the object contains no parameters.
false otherwise
Returns a
true if no parameters have been set. |
| public int | Returns: the number of parameters in this object
Returns the number of parameters in this object.
|
| clone | back to summary |
|---|---|
| public MutablePortletParameters clone()
Returns a
MutablePortletParameters object encapsulating a copy of the same
parameters as the original object.
Changing a mutable copy will not influence the source object.
| |
| getNames | back to summary |
|---|---|
| public Set
Returns a
Set of String
objects containing the names of the parameters contained
in this object.
Changing the Set has no effect on the originating
PortletParameters object.
Only parameter names targeted to the current portlet are returned. | |
| getValue | back to summary |
|---|---|
| public String getValue(String name)
Returns the value of a parameter as a
String.
Note that Only parameters targeted to the current portlet are accessible.
This method should only be used if the
parameter has only one value. If the parameter might have
more than one value, use
If this method is used with a multivalued
parameter, the value returned is equal to the first value
in the array returned by
| |
| getValues | back to summary |
|---|---|
| public String[] getValues(String name)
Returns an array of
String objects containing
all of the values the given parameter, or
null if the parameter does not exist.
If the parameter has a single value, the array has a length of 1.
Note that individual parameter values in the returned array
may be
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty()
Returns a
true if no parameters have been set.
| |
| size | back to summary |
|---|---|
| public int size()
Returns the number of parameters in this object.
| |