myfaces-2.1.7、Tomcat-7.0.27
似乎 jstl 并没有很随意地传播到复合元素中。谁能解释我的示例页面的输出:
直接的:
String:f0,f1,f2,f3,f4,f5
Array: f0 f1 f2 f3 f4 f5
Array2: f0 f1 f2 f3 f4 f5
内部复合(相同的 JSTL):
String:f0,f1,f2,f3,f4,f5
Array: f0
Array2: f0 f1 f2 f3 f4 f5
内部复合(相同的 JSTL,myfaces-2.1.6):
String:f0,f1,f2,f3,f4,f5
Array:
Array2:
这是一个错误吗?
复合材料:'testje2.xhtml':
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:composite="http://java.sun.com/jsf/composite"
>
<composite:interface>
</composite:interface>
<composite:implementation>
<composite:insertChildren/>
</composite:implementation>
</html>
页面“test.xhtml”:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
[
<!ENTITY euro "€">
<!ENTITY nbsp " " >
<!ENTITY hearts "♥" >
]>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:vm="http://java.sun.com/jsf/composite/vm"
>
<body>
<c:set var="combined1" value="f0"/>
<c:set var="extra1" value="#{fn:split('f1,f2,f3,f4,f5', ',')}"/>
<c:forEach begin="0" end="4" var="index">
<c:set var="combined1" value="#{combined1},#{extra1[index]}"/>
</c:forEach>
<c:set var="combined1Array" value="#{fn:split(combined1, ',')}"/>
String:#{combined1}<br/>
Array:
<c:forEach items="#{combined1Array}" var="value">
#{value}
</c:forEach>
<br/>
Array2:
<c:forEach items="#{fn:split(combined1, ',')}" var="value">
#{value}
</c:forEach>
<br/>
<br/>
<vm:testje2>
<c:set var="combined" value="f0"/>
<c:set var="extra" value="#{fn:split('f1,f2,f3,f4,f5', ',')}"/>
<c:forEach begin="0" end="4" var="index">
<c:set var="combined" value="#{combined},#{extra[index]}"/>
</c:forEach>
<c:set var="combinedArray" value="#{fn:split(combined, ',')}"/>
String:#{combined}<br/>
Array:
<c:forEach items="#{combinedArray}" var="value">
#{value}
</c:forEach>
<br/>
Array2:
<c:forEach items="#{fn:split(combined, ',')}" var="value">
#{value}
</c:forEach>
</vm:testje2>
</body>
</html>