Name

<jsp:invoke>

Synopsis

The <jsp:invoke> action must only be used in a tag file. It evaluates the named fragment, adding the output to the calling page’s output stream or capturing it in a variable.

Syntax

<jsp:invoke fragment="fragmentName" [var="var" | varReader="varReader"] 
  [scope="page|request|session|application"] />

Attributes

Attribute name

Java type

Dynamic value accepted

Description

fragment
String

No

The name of an attribute that defines a fragment.

scope
String

No

The scope for the variable.

var
String

No

The name of the variable to hold the evaluation result as a String.

varReader
String

No

The name of the variable to capture and expose the evaluation result as a java.io.Reader.

Example

<%@ attribute name="pattern" fragment="true" %>

<%-- Adding the evaluation result to the response --%>
<jsp:invoke fragment="pattern"/>

<%-- Capturing the evaluation result for further processing --%>
<jsp:invoke fragment="pattern" var="result" />

Get JavaServer Pages, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.