You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

get()

Usage

get(entity, propertyKey)

Description
Returns the value for the given property key from the given entity. This method will print an error message if the first parameter is null / not accessible. See get_or_null() for a more tolerant get method.

Please note that the result value of the get() method can differ from the result value of property access using the dot notation (get(this, 'name') vs this.name) for certain property types (e.g. date properties), because get() converts the property value to its output representation. That means that a Date object will be formatted into a string when fetched via get(this, 'date'), whereas this.date will return an actual date object.

Example

${get(page, 'name')}

results in

my-page-name

Search results for "get()"

GET()

This method makes a server-side HTTP GET request to the given url and returns the literal HTTP response (without the headers - If you are interested in the response headers, use the HEAD() function).

The contentType only serves as way to handle certain formats differently:
- The value text/html parses the returned text as HTML using JSOUP and allows for an optional third parameter selector to select a subset of the HTML response, as documented in the JSOUP Cookbook.
- From version 3.5 onwards, GET() supports binary content by setting the contentType parameter to application/octet-stream. (This is helpful when creating files - see below example)
- Any other value for contentType simply returns the literal HTTP response

GET(url [, contentType [, username, password]])

GET(url, 'text/html', selector)
GET(url, 'application/octet-stream' [, username, password]])

get()

Returns the value for the given property key from the given entity. This method will print an error message if the first parameter is null / not accessible. See get_or_null() for a more tolerant get method.

get(entity, propertyKey)

request_store_get()

Retrieves a stored value from the request level store.

request_store_get(key)

application_store_get()

Retrieves a stored value from the application level store.

application_store_get(key)

JavaScript

In any other than the JavaScript context, you are required to use get() and call() to access built-in functions and constants. This results in code like the following example.