Using Liferay Util Buffer

Using Liferay Util Buffer

The buffer tag is not a self-closing tag. The content placed between the opening and closing of this tag is saved to a buffer and its output is assigned to the Java variable declared with the tag’s var attribute. The output is returned as a String, letting you post-process it. For example, you can use this to override a JSP’s existing contents.

The example below saves the link’s generated markup to a buffer and then uses the returned string as the argument for a liferay-ui:message key:


		arguments="<%= linkContent %>"
		translateArguments="<%= false %>"

Now you know how to use the <liferay-util:buffer> tag to save content to a buffer.

You can use the Liferay Util Buffer tag to save pieces of markup to reuse in your JSP.