0

I defined a custom tag like:

<?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>

When I use it within a rich:popupPanel

    <my:terminalForm prefix="c" terminal="#{newTerminal}"/>

everything works fine.

At another place in the same file (also rich:popupPanel)

    <my:terminalForm prefix="e" terminal="#{terminalController.editTerminal}"/>

all values in my form don't get the initialized. I suspected the expression #terminalController.editTerminal} to not get expanded correctly. But when I write the tags from the custom tag explicit

 <h:inputText id="#{prefix}maxcon"
                value="#{terminalController.editTerminal.maxConnections}">
                <rich:validator />
 </h:inputText>

everything would work also, but using the custom tag for only one expansion would be pointless.

What could be wrong?

Does anyone more experienced have an idea how I could debug this issue?

4

1 に答える 1

2

プレフィックスの前に cc.attrs がありませんか?!

于 2013-01-21T15:21:00.873 に答える