View Source Return to examples page

Bean tag examples


<bean:write>

1. Display bean properties

Boolean: false
Double: 45213.451
Float: -123.582
Integer: 256
Long integer: 1321546
Short integer: 257
String: Hello, world!
Date: Fri Aug 08 00:07:58 UTC 2025

2. Formatting output

Formatted number (using format): $45,213.45
Formatted number (using formatKey): $(123.58)
Formatted date (using format): Aug 8 2025 @ 00:07
Formatted date (using formatKey): 8/8/2025 12:07 AM UTC

3. Display values from collections, arrays and nested beans

List entry: List entry #3
Array entry: Black
Nested property: This is a string from NestedBean

4. Filtering HTML tags in output

Filtered text: <p>This is a <strong>simple</strong> example of <em>HTML</em> formatted text.</p>
Unfiltered text:

This is a simple example of HTML formatted text.

<bean:define>

String value: This is a test string
Bean: This is a string from NestedBean

<bean:header>

Accept-Encodings: gzip, br, zstd, deflate

<bean:message>

This is a simple message.

This is a slightly more complex message with 2 replaceable parameters.

This is the same template message with different parameters.

<bean:parameters>

Parameter 1:
Parameter 2:
Parameter 3: DEFAULT

<bean:size>

List size: 4

<bean:cookie>

Display the properties of our current session ID cookie (if there is one):

Property NameValue
comment
domain
maxAge -1
path
secure false
value E01B3637D5036AA8370E8C2731876724
version 0

Display the properties of an undefined cookie that was given the default value UNKNOWN_VALUE:

Property NameValue
comment
domain
maxAge -1
path
secure false
value UNKNOWN_VALUE
version 0