Name

<x:set>

Synopsis

The <x:set> action sets a scoped variable to the value of an XPath expression evaluation result.

Syntax

<x:set select="XPathExpression" 
  var="var" [scope="page|request|session|application"] />

Attributes

Attribute name

Java type

Dynamic value accepted

Description

select
String

No

The XPath expression to evaluate.

var
String

No

The variable name. The type is the type of the expression evaluation, converted to the corresponding Java type.

scope
String

No

The variable scope.

Example

<x:set var="nodes" 
  select="$doc//story/category[. = $param:selCat]/.." />

Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.