The request attribute plug-in
Use the RequestAttribute rendering plug-in to retrieve, set, or remove attributes on the underlying request.
The syntax for this plug-in is as follows:
[Plugin:RequestAttribute key="" value="" defaultValue="" escape=""]
This plug-in uses the following attributes:
-
key
This attribute is mandatory. Use this attribute to specify the name used to retrieve or set an attribute for the request.
-
mode
Use this attribute to specify the operation that you want to perform:
-
get
Use this attribute to retrieve the specified attribute from the request and return the attribute value.
-
set
Use this attribute to set the specified attribute to the request.
-
delete
Use this attribute to delete the specified attribute from the request.
-
remove
Use this attribute to remove the specified attribute from the request and return the attribute value that was previously set.
-
-
value
Use this attribute to specify the value of the attribute that you want to be set. If an attribute with the same name exists on the request, that attribute is overwritten with the new value. If you want to set an attribute on the request, this attribute is mandatory.
-
defaultValue
This attribute is optional. Use this attribute for specific value such as an attribute from the request is not defined or has a value of
null. -
escape
Use this attribute to define the escaping that you want to be used for writing the URL. Specify one of the values
xml,json,javascript, ornone. The default value isnone. This value is only evaluated if themodeattribute is set togetorremove.
Examples
-
To override a request attribute list with the name
key1, use the following plug-in tag:[Plugin:RequestAttribute key="key1"] -
You can use
value1only when thekey1attribute does not exist on the request or the attribute value isnull. Use the following plug-in tag. Otherwise, the actual value of thekey1attribute can be used.[Plugin:RequestAttribute key="key1" defaultValue="value1"] -
To set the request attribute
key1to the valuevalue1, use the following plug-in tag:[Plugin:RequestAttribute key="key1" value="value1"] [Plugin:RequestAttribute mode="set" key="key1" value="value1"] -
To remove the request attribute
key1by passing an empty value attribute, use the following plug-in tag:[Plugin:RequestAttribute key="key1" mode="delete"] [Plugin:RequestAttribute key="key1" value=""] -
To remove the attribute with the key
key1from the portlet request and return the previously set value, use the following plug-in tag:[Plugin:RequestAttribute key="key1" mode="remove"]