【发布时间】:2013-01-04 16:04:11
【问题描述】:
我定义了一个自定义标签,例如:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:composite="http://java.sun.com/jsf/composite">
<!-- INTERFACE -->
<composite:interface>
<composite:attribute name="terminal" />
<composite:attribute name="prefix" />
</composite:interface>
<!-- IMPLEMENTATION -->
<composite:implementation>
<h:panelGrid columns="3" columnClasses="titleCell">
<h:outputLabel for="#{prefix}nodeId" value="Node Id" />
<h:selectOneMenu id="#{prefix}nodeId"
value="#{cc.attrs.terminal.nodeId}"
converter="javax.faces.Integer">
<f:selectItems
value="#{terminalController.availableNodeIds}" />
<rich:validator />
</h:selectOneMenu>
<rich:message for="#{prefix}nodeId" id="cnodeIdMsg" />
<h:outputLabel for="#{prefix}maxcon" value="Max Connections" />
<h:inputText id="#{prefix}maxcon"
value="#{cc.attrs.terminal.maxConnections}">
<rich:validator />
</h:inputText>
<rich:message for="#{prefix}maxcon" />
</h:panelGrid>
</composite:implementation>
</html>
当我在 Rich:popupPanel 中使用它时
<my:terminalForm prefix="c" terminal="#{newTerminal}"/>
一切正常。
在同一个文件的另一个地方(也丰富:popupPanel)
<my:terminalForm prefix="e" terminal="#{terminalController.editTerminal}"/>
我的表单中的所有值都没有初始化。我怀疑表达式 #terminalController.editTerminal} 没有正确展开。但是当我从自定义标签显式编写标签时
<h:inputText id="#{prefix}maxcon"
value="#{terminalController.editTerminal.maxConnections}">
<rich:validator />
</h:inputText>
一切都可以,但只使用自定义标签进行一次扩展是没有意义的。
可能出了什么问题?
有没有经验丰富的人知道如何调试这个问题?
【问题讨论】: