Set Request Attribute Action

Last Updated: Nov 9, 2021
documentation for the dotCMS Content Management System

Rule Action values can be retrieved dynamically using Velocity code in a Widget, Form, Container, Template, etc., using Velocity code.

Retrieving Actionlet Atributes in the Request Object using Velocity

The Action will add to the request a key/value map. With this Action you will only need to send as parameters the key and the value. For example you can add this the request object: “language”→“es” where “language” is the key and “es” is the value.

You could later access this information from the request object, for example, with Velocity you can pass the key to retrieve the value as in the example below:

$request.getAttribute("key")  

The following example retrieves the value of a key called “language” which had previously set in the Rule:

$request.getAttribute("language")
Example return: "es"  

Note: Values set in the request object are not, by definition, session-based. Therefore, the Rule must be setting the value on each page where the call is being made to the request object. To set or retrieve a value from the session object, please see the documentation on Session Based Actionlet Attributes

The Parameters of the Action (for REST purposes): “requestKey” and “requestValue“. Read the Actions REST API documentation for more information on how to set Actions on Rules via the Actions REST API.

On this page

×

We Dig Feedback

Selected excerpt:

×