<: Conjunto X> etiqueta
<X: Conjunto> para ajustar el valor de una variable expresiones XPath.
Si el valor de la expresión XPath es de tipo booleano, entonces <x: conjunto> java.lang.Boolean se estableció un objetivo, si la cadena, establecer un objeto java.lang.String, y si las cifras, establecer un java.lang .Number objeto.
sintaxis
<x:set var="<string>" select="<string>" scope="<string>"/>
propiedad
<X: Conjunto> tiene los siguientes atributos:
propiedad | descripción | Si es necesario | defecto |
---|---|---|---|
var | En nombre de la variable expresión XPath digna | es | cuerpo |
seleccionar | expresión XPath que se calcula | no | no |
alcance | atributo var alcance | no | página |
Los ejemplos de demostración
El siguiente ejemplo muestra cómo utilizar la etiqueta <x juego>:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %> <html> <head> <title>JSTL x:set 标签</title> </head> <body> <h3>Books Info:</h3> <c:set var="xmltext"> <books> <book> <name>Padam History</name> <author>ZARA</author> <price>100</price> </book> <book> <name>Great Mistry</name> <author>NUHA</author> <price>2000</price> </book> </books> </c:set> <x:parse xml="${xmltext}" var="output"/> <x:set var="fragment" select="$output//book"/> <b>The price of the second book</b>: <c:out value="${fragment}" /> </body> </html>
Los resultados son como sigue:
BOOKS INFO: The price of the second book:[[book: null], [book: null]]