<;f:ajax>;父项不是复合组件,也不是选择一菜单上的ClientBehaviorHolder类型

<;f:ajax>;父项不是复合组件,也不是选择一菜单上的ClientBehaviorHolder类型,ajax,jsf,jsf-2,Ajax,Jsf,Jsf 2,我正在尝试根据为第一个值选择的内容显示第二个选择方法。现在我需要为我正在制作的表格做38次以上,但我想看看我是否能让它先为一个问题工作。以下是我在jsf页面上截取的代码。其他38个问题的值都相同。我刚刚重新创建了这个项目,到目前为止,bean是空的,但我知道我至少应该能够首先看到表单,这就是我现在希望在添加值和代码之前要做的 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww

我正在尝试根据为第一个值选择的内容显示第二个选择方法。现在我需要为我正在制作的表格做38次以上,但我想看看我是否能让它先为一个问题工作。以下是我在jsf页面上截取的代码。其他38个问题的值都相同。我刚刚重新创建了这个项目,到目前为止,bean是空的,但我知道我至少应该能够首先看到表单,这就是我现在希望在添加值和代码之前要做的

    <!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:h="http://xmlns.jcp.org/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core" >

    <h:head>
    <title>QC-Form</title>

    </h:head>
    <h:body>
    <h1 class="title">QC Form</h1>
    <br/> <br/>

      <font face="comic sans MS" size="2" color="#33CCFF">
      <p><b>Enter the information below: </b> </p>
      </font>

    <h:form>

     <font face="comic sans MS" size="2"> 

     <b>Your initials: </b>  
        <h:inputText value="#{qcFormBean.techNameValue}"/><br/>
    <br/>

     <b>Model #: </b>  
    <h:selectOneMenu value="#{qcFormBean.modelValue}">
      <f:selectItem itemValue="3600" itemLabel="3600" />
      <f:selectItem itemValue="7200" itemLabel="7200" />
      <f:selectItem itemValue="8300" itemLabel="8300" />
      <f:selectItem itemValue="8400" itemLabel="8400" />
      <f:selectItem itemValue="8500p" itemLabel="8500p" />
      <f:selectItem itemValue="8800" itemLabel="8800" />
      <f:selectItem itemValue="9000" itemLabel="9000" />
      <f:selectItem itemValue="9008" itemLabel="9008" />
      <f:selectItem itemValue="9200" itemLabel="9200" />
      <f:selectItem itemValue="9300" itemLabel="9300" />
    </h:selectOneMenu><br/>
     <br/>

    <b>Date : </b>
     <h:outputText  value="#{currentDate}"/>
    <br/> <br/>


    <b>Serial #: </b>  
        <h:inputText value="#{qcFormBean.serialValue}"/><br/>
    <br/>

    <b>Customer Name: </b>  
        <h:inputText value="#{qcFormBean.customerNameValue}"/><br/>
    <br/>

    <b>Special Instructions: </b>  
        <h:inputText value="#{qcFormBean.specialInstructionsValue}"/><br/>    

    </font>

      <font face="comic sans MS" size="2" color="#33CCFF">
      <p><b>QC Process</b> </p>
      </font>

     <font face="comic sans MS" size="2"> 


     <b>1.Unit Serial number has been applied: </b>
     <h:selectOneMenu value="#{qcFormBean.unitSerialValue}">
      <f:selectItem itemValue="P" itemLabel="Pass or Not Applicable" />
      <f:selectItem itemValue="A" itemLabel="FAIL-Nonfunctional" />
      <f:selectItem itemValue="B" itemLabel="FAIL-Intermittent" />
      <f:selectItem itemValue="C" itemLabel="FAIL-Incorrect" />
      <f:selectItem itemValue="D" itemLabel="FAIL-DLI Standard" />
      <f:selectItem itemValue="F" itemLabel="FAIL-Special Standard" />
      <f:selectItem itemValue="G" itemLabel="FAIL-Physical" />
    </h:selectOneMenu>
    <br/>

    <br/>
    <b>2.Screen Protector has been applied: </b>
    <h:panelGroup id="dliSticker">
        <h:selectOneMenu value="#{qcFormBean.dlitcStickerValue}">
          <f:selectItem itemValue="P" itemLabel="Pass or Not applicable" />
          <f:selectItem itemValue="M" itemLabel="FAIL-Mechanical" />
          <f:selectItem itemValue="E" itemLabel="FAIL-Electrical" />
          <f:selectItem itemValue="C" itemLabel="FAIL-Cosmetic" />
          <f:selectItem itemValue="S" itemLabel="FAIL-Software" />
          <f:ajax event="change" execute="@this" render="perfbyDlitcSticker" />
        </h:selectOneMenu>
    </h:panelGroup>

    <h:panelGroup id="perfbyDlitcSticker">
        <h:selectOneMenu value="#{qcFormBean.stickerFreq}"
        rendered="#{!qcFormBean.dliStickerValue eq  'P'}">
            <f:selectItem itemValue="A" itemLabel="Always" />                
            <f:selectItem itemValue="O" itemLabel="Often" />
            <f:selectItem itemValue="S" itemLabel="Seldom" />                
        </h:selectOneMenu>
    </h:panelGroup>


    <br/>
    </font>

    </h:form>

    </h:body>
    </html>

质量控制表
质量控制表


输入以下信息:

您的姓名首字母:

模型#:

日期:

序列号#:

客户名称:

特别说明:
质量控制过程

1.已应用装置序列号:

2.已使用屏幕保护器:
以下是使用此代码得到的错误代码:

/第88行和第76列父项处的indexv2.xhtml不是复合组件或ClientBehaviorHolder类型,类型为:javax.faces.component。UIViewRoot@13fcf10

原因:
第88行和第76列的javax.faces.view.facelets.TagException-/indexv2.xhtml父项不是复合组件或ClientBehaviorHolder类型,类型是:javax.faces.component。UIViewRoot@13fcf10

删除
h:selectOneMenu
之外的
f:ajax
s
h:form
不是
clientbehaviorHolder
,因此不能在那里放置
f:ajax
。您只需将它们放入
h:selectOneMenu

编辑:只需删除不带参数的
f:ajax
,即包装
panelGroup
s并保留
selectOneMenu
es:

<h:selectOneMenu value="#{qcFormBean.dlitcStickerValue}">
    <f:selectItem itemValue="P" itemLabel="Pass or Not applicable" />
    <f:selectItem itemValue="M" itemLabel="FAIL-Mechanical" />
    <f:selectItem itemValue="E" itemLabel="FAIL-Electrical" />
    <f:selectItem itemValue="C" itemLabel="FAIL-Cosmetic" />
    <f:selectItem itemValue="S" itemLabel="FAIL-Software" />
    <f:ajax event="change" execute="@this" render="perfbyDlitcSticker" />
</h:selectOneMenu>

我没有使用“f:ajax”,而是在xhtml中使用了richfaces“a4j:ajax”参数,而现在我遇到了一个不同的问题“带有标记的网页不会只显示文本”。因此,我无法确定我是否正确地转换为richfaces,但下面是我所做的更改,让我知道我是否正确,谢谢

    <!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:h="http://xmlns.jcp.org/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core" 
          xmlns:a4j="http://richfaces.org/a4j"   >

    <h:head>
    <title>QC-Form</title>
    <link href="./css/styles.css" 
          rel="stylesheet" type="text/css"/>
    </h:head>

    <f:view>

    <h:body>
    <h1 class="title">QC Form</h1>
    <br/> <br/>

      <font face="comic sans MS" size="2" color="#33CCFF">
      <p><b>Enter the information below: </b> </p>
      </font>

    <h:form>

     <font face="comic sans MS" size="2"> 

     <h:panelGroup id="initialInfo">

        <b>Your initials: </b>  
            <h:inputText value="#{qcFormBean.techNameValue}"/><br/>
        <br/>

        <b>Model #: </b>  
        <h:selectOneMenu value="#{qcFormBean.modelValue}">
          <f:selectItem itemValue="3600" itemLabel="3600" />
          <f:selectItem itemValue="7200" itemLabel="7200" />
          <f:selectItem itemValue="8300" itemLabel="8300" />
          <f:selectItem itemValue="8400" itemLabel="8400" />
          <f:selectItem itemValue="8500p" itemLabel="8500p" />
          <f:selectItem itemValue="8800" itemLabel="8800" />
          <f:selectItem itemValue="9000" itemLabel="9000" />
          <f:selectItem itemValue="9008" itemLabel="9008" />
          <f:selectItem itemValue="9200" itemLabel="9200" />
          <f:selectItem itemValue="9300" itemLabel="9300" />
        </h:selectOneMenu><br/>
         <br/>

        <b>Date : </b>
         <h:outputText  value="#{currentDate}"/>
        <br/> <br/>


        <b>Serial #: </b>  
            <h:inputText value="#{qcFormBean.serialValue}"/><br/>
        <br/>

        <b>Customer Name: </b>  
            <h:inputText value="#{qcFormBean.customerNameValue}"/><br/>
        <br/>

        <b>Special Instructions: </b>  
            <h:inputText value="#{qcFormBean.specialInstructionsValue}"/><br/>    

     </h:panelGroup>
    </font>

      <font face="comic sans MS" size="2" color="#33CCFF">
      <p><b>QC Process</b> </p>
      </font>

     <font face="comic sans MS" size="2"> 

    <h:panelGroup id="dliSerial">
     <b>1.Unit Serial number has been applied: </b>
     <h:selectOneMenu value="#{qcFormBean.unitSerialValue}">
    <f:selectItems value="#{qcFormBean.valueQcValue}"/>
    </h:selectOneMenu>
    <br/>

    </h:panelGroup>

    <br/>
    <b>2.Screen Protector has been applied: </b>
    <h:panelGroup id="dliSticker">
        <h:selectOneMenu value="#{qcFormBean.dliStickerValue}">
          <f:selectItem itemValue="P" itemLabel="Pass or Not applicable" />
          <f:selectItem itemValue="M" itemLabel="FAIL-Mechanical" />
          <f:selectItem itemValue="E" itemLabel="FAIL-Electrical" />
          <f:selectItem itemValue="C" itemLabel="FAIL-Cosmetic" />
          <f:selectItem itemValue="S" itemLabel="FAIL-Software" />
          <a4j:ajax event="change" execute="@this" render="perfbyDliSticker"  limitRender="true" />
        </h:selectOneMenu>
    </h:panelGroup>

    <h:panelGroup id="perfbyDlitcSticker">
        <h:selectOneMenu value="#{qcFormBean.stickerFreq}"
        rendered="#{!qcFormBean.dliStickerValue eq  'P'}">
            <f:selectItem itemValue="A" itemLabel="Always" />                
            <f:selectItem itemValue="O" itemLabel="Often" />
            <f:selectItem itemValue="S" itemLabel="Seldom" />                
        </h:selectOneMenu>
    </h:panelGroup>


    <br/>
    </font>



    </h:form>

    </h:body>
    </f:view>
    </html>

质量控制表
质量控制表


输入以下信息:

您的姓名首字母:

模型#:

日期:

序列号#:

客户名称:

特别说明:
质量控制过程

1.已应用装置序列号:

2.已使用屏幕保护器:

这实际上相当混乱,因为您可以使用
f:ajax
包装组件(请参阅)。但我同意在这种情况下它们是不必要的。所以Ajax事件不是必要的,你是这么说的?我更新了我的代码,以表示你的建议我不再收到错误,我只是没有在我的IE中显示任何东西,你能提供一个如何键入的示例吗?@GilbertV你需要将
f:ajax
标记保留在
内,但它之外的标记可以删除。因此,只需去掉“f:ajax”并像这样保留它?我试试看
    <!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:h="http://xmlns.jcp.org/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core" 
          xmlns:a4j="http://richfaces.org/a4j"   >

    <h:head>
    <title>QC-Form</title>
    <link href="./css/styles.css" 
          rel="stylesheet" type="text/css"/>
    </h:head>

    <f:view>

    <h:body>
    <h1 class="title">QC Form</h1>
    <br/> <br/>

      <font face="comic sans MS" size="2" color="#33CCFF">
      <p><b>Enter the information below: </b> </p>
      </font>

    <h:form>

     <font face="comic sans MS" size="2"> 

     <h:panelGroup id="initialInfo">

        <b>Your initials: </b>  
            <h:inputText value="#{qcFormBean.techNameValue}"/><br/>
        <br/>

        <b>Model #: </b>  
        <h:selectOneMenu value="#{qcFormBean.modelValue}">
          <f:selectItem itemValue="3600" itemLabel="3600" />
          <f:selectItem itemValue="7200" itemLabel="7200" />
          <f:selectItem itemValue="8300" itemLabel="8300" />
          <f:selectItem itemValue="8400" itemLabel="8400" />
          <f:selectItem itemValue="8500p" itemLabel="8500p" />
          <f:selectItem itemValue="8800" itemLabel="8800" />
          <f:selectItem itemValue="9000" itemLabel="9000" />
          <f:selectItem itemValue="9008" itemLabel="9008" />
          <f:selectItem itemValue="9200" itemLabel="9200" />
          <f:selectItem itemValue="9300" itemLabel="9300" />
        </h:selectOneMenu><br/>
         <br/>

        <b>Date : </b>
         <h:outputText  value="#{currentDate}"/>
        <br/> <br/>


        <b>Serial #: </b>  
            <h:inputText value="#{qcFormBean.serialValue}"/><br/>
        <br/>

        <b>Customer Name: </b>  
            <h:inputText value="#{qcFormBean.customerNameValue}"/><br/>
        <br/>

        <b>Special Instructions: </b>  
            <h:inputText value="#{qcFormBean.specialInstructionsValue}"/><br/>    

     </h:panelGroup>
    </font>

      <font face="comic sans MS" size="2" color="#33CCFF">
      <p><b>QC Process</b> </p>
      </font>

     <font face="comic sans MS" size="2"> 

    <h:panelGroup id="dliSerial">
     <b>1.Unit Serial number has been applied: </b>
     <h:selectOneMenu value="#{qcFormBean.unitSerialValue}">
    <f:selectItems value="#{qcFormBean.valueQcValue}"/>
    </h:selectOneMenu>
    <br/>

    </h:panelGroup>

    <br/>
    <b>2.Screen Protector has been applied: </b>
    <h:panelGroup id="dliSticker">
        <h:selectOneMenu value="#{qcFormBean.dliStickerValue}">
          <f:selectItem itemValue="P" itemLabel="Pass or Not applicable" />
          <f:selectItem itemValue="M" itemLabel="FAIL-Mechanical" />
          <f:selectItem itemValue="E" itemLabel="FAIL-Electrical" />
          <f:selectItem itemValue="C" itemLabel="FAIL-Cosmetic" />
          <f:selectItem itemValue="S" itemLabel="FAIL-Software" />
          <a4j:ajax event="change" execute="@this" render="perfbyDliSticker"  limitRender="true" />
        </h:selectOneMenu>
    </h:panelGroup>

    <h:panelGroup id="perfbyDlitcSticker">
        <h:selectOneMenu value="#{qcFormBean.stickerFreq}"
        rendered="#{!qcFormBean.dliStickerValue eq  'P'}">
            <f:selectItem itemValue="A" itemLabel="Always" />                
            <f:selectItem itemValue="O" itemLabel="Often" />
            <f:selectItem itemValue="S" itemLabel="Seldom" />                
        </h:selectOneMenu>
    </h:panelGroup>


    <br/>
    </font>



    </h:form>

    </h:body>
    </f:view>
    </html>