2013-12-12 2 views
6

मैं की तरह घटक आईडी घटक एक त्रुटि हो रही है में पाया पहले से ही पेड़ तालिका के अंदर दृश्य में पाया गया है आईडी = col1 साथ स्तंभ टैग। मेरे पास इस एकल 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"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://xmlns.jcp.org/jsf/html" 
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets" 
    xmlns:p="http://primefaces.org/ui" 
    xmlns:f="http://xmlns.jcp.org/jsf/core"> 
<h:head> 
    <title>Category and Brand Manage Page</title> 
</h:head> 
<h:body> 
    <ui:composition template="/templates/layout.xhtml"> 
     <ui:define name="content">    
      <h:form id="productform" enctype="multipart/form-data" rendered="#{loginManagedBean.isLoggedIn}"> 
       <p:growl id="messages" autoUpdate="true" redisplay="false" showDetail="true"/> 

       <p:panel header="Brand Management" id="brandpanel"> 
        <h:panelGrid columns="2" cellspacing="20"> 

         <p:outputLabel value="Branch Name"/> 
         <p:selectOneMenu id="branchname" value="#{brandManagedBean.branchId}" style="width: 200px;"> 
          <f:selectItem itemLabel="Select Branch" itemValue=""/> 
          <f:selectItems value="#{brandManagedBean.branchNamesMap}"/> 
           <p:ajax listener="#{brandManagedBean.selectBrands()}" update="brandpanel"/> 
         </p:selectOneMenu> 

         <p:outputLabel value="Brand Name"/> 
         <p:selectOneMenu id="brandname" value="#{brandManagedBean.id}" style="width: 200px;"> 
          <f:selectItem itemLabel="Select Brands" itemValue=""/> 
          <f:selectItems value="#{brandManagedBean.brandNamesMap}"/> 
          <p:ajax event="change"/> 
         </p:selectOneMenu> 

         <p:outputLabel value="New or update brand name"/> 
         <p:inputText value="#{brandManagedBean.name}"> 
          <p:ajax event="change"/> 
         </p:inputText> 
        </h:panelGrid> 
        <h:panelGrid columns="3"> 
         <p:commandButton update="brandpanel" actionListener="#{brandManagedBean.insertBrand()}" value="Add"/> 
         <p:commandButton update="brandpanel" actionListener="#{brandManagedBean.updateBrand()}" value="Update"/> 
         <p:commandButton update="brandpanel" actionListener="#{brandManagedBean.deleteBrand()}" value="Delete"/> 
        </h:panelGrid> 
       </p:panel> 

       <p:panel header="Category Management" id="categorypanel"> 
        <h:panelGrid columns="2" cellspacing="20"> 

         <p:outputLabel value="Branch Name"/> 
         <p:selectOneMenu id="categorybranchname" value="#{categoryManagedBean.branchId}" style="width: 200px;"> 
          <f:selectItem itemLabel="Select Branch" itemValue=""/> 
          <f:selectItems value="#{categoryManagedBean.branchNamesMap}"/> 
          <p:ajax listener="#{categoryManagedBean.selectFloors()}" update="categorypanel"/> 
         </p:selectOneMenu> 

         <p:outputLabel value="Floor Name"/> 
         <p:selectOneMenu id="categoryfloorname" value="#{categoryManagedBean.floorId}" style="width: 200px;"> 
          <f:selectItem itemLabel="Select Floor" itemValue=""/> 
          <f:selectItems value="#{categoryManagedBean.floorsMap}"/> 
          <p:ajax listener="#{categoryManagedBean.selectCategories()}" update="categorypanel"/> 
          <p:ajax listener="#{categoryManagedBean.loadTreeTable()}" update="categorytree"/> 
         </p:selectOneMenu> 
        </h:panelGrid> 

        <h:panelGrid columns="4"> 
         <p:outputLabel value="Category Name"/> 
         <p:selectOneMenu id="categoryname" value="#{categoryManagedBean.catId}" style="width: 200px;"> 
          <f:selectItem itemLabel="Select Category" itemValue=""/> 
          <f:selectItems value="#{categoryManagedBean.categoryMap}"/> 
          <p:ajax listener="#{categoryManagedBean.selectSubCategory1()}" update="categorypanel"/> 
         </p:selectOneMenu>        

         <p:outputLabel value="New Category Name"/> 
         <p:inputText value="#{categoryManagedBean.catName}"> 
          <p:ajax event="change"/> 
         </p:inputText> 
        </h:panelGrid> 

        <h:panelGrid columns="4"> 
         <p:outputLabel value="Item Name"/> 
         <p:selectOneMenu id="subcategoryname" value="#{categoryManagedBean.subcat1Id}" style="width: 200px;"> 
          <f:selectItem itemLabel="Select Item" itemValue=""/> 
          <f:selectItems value="#{categoryManagedBean.subCategory1Map}"/> 
          <p:ajax event="change"/> 
         </p:selectOneMenu> 

         <p:outputLabel value="New Item Name"/> 
         <p:inputText value="#{categoryManagedBean.subcat1Name}"> 
          <p:ajax event="change"/> 
         </p:inputText> 
        </h:panelGrid> 

        <h:panelGrid columns="3"> 
         <p:commandButton update="categorypanel" actionListener="#{categoryManagedBean.insertCategory()}" value="Add"/>  
        </h:panelGrid>      

        <p:treeTable id="categorytree" value="#{categoryManagedBean.root}" var="catdto" 
           selectionMode="single" selection="#{categoryManagedBean.selectNode}"> 

         <f:facet id="face1" name="header"> 
          Categories 
         </f:facet> 

         <p:column id="col1"> 
          <f:facet name="header" id="face2"> 
           Category Name 
          </f:facet> 
          <h:outputLabel id="out1" value="#{catdto.name}"/> 
         </p:column> 

         <p:column id="col2"> 
          <f:facet name="header" id="face3"> 
           Edit 
          </f:facet> 
          <p:commandLink id="com1" update=":productform:documentPanel" oncomplete="PF('documentDialog').show()" title="Update Form" styleClass="ui-icon ui-icon-pencil" > 
           <f:setPropertyActionListener value="#{catdto}" target="#{categoryManagedBean.selectedCategoryDto}" /> 
          </p:commandLink> 
         </p:column> 

         <p:column id="col3"> 
          <f:facet name="header" id="face4"> 
           Delete 
          </f:facet> 
          <p:commandLink id="com2" action="#{categoryManagedBean.deleteCategory(category)}" type="button"       
           style="float: right; background-image: url('../resources/images/delete.jpg'); background-repeat: no-repeat; 
           background-size: 100% 100%; background-origin : border-box; width: 30px; height: 20px;">   
          </p:commandLink>        
         </p:column> 
        </p:treeTable> 

       </p:panel> 
        <p:dialog id="dialog" header="Update Form" showEffect="fade" widgetVar="documentDialog" modal="false" maximizable="true" minimizable="true"> 
         <p:outputPanel id="documentPanel"> 
          <h:panelGrid columns="2" cellpadding="5"> 
           <h:outputLabel for="name" value="Category: " /> 
           <p:inplace id="basic"> 
            <h:inputText id="name" value="#{categoryManagedBean.selectedCategoryDto.name}" style="font-weight:bold" /> 
           </p:inplace>        

           <h:panelGrid columns="2" style="margin-left: 100px"> 
            <p:commandButton action="#{categoryManagedBean.updateCategory()}" value="Update" ajax="false" update=":categorypanel"/>      
            <p:commandButton action="#{categoryManagedBean.clear}" value="Clear" id="btnclear" ajax="false" /> 
           </h:panelGrid> 
          </h:panelGrid> 
         </p:outputPanel> 
        </p:dialog>       

      </h:form> 
     </ui:define> 
    </ui:composition> 
</h:body> 
</html> 

स्टैक ट्रेस

SEVERE: JSF1007: Duplicate component ID productform:categorytree:col1 found in view. 
Dec 12, 2013 5:27:01 PM com.sun.faces.util.Util checkIdUniqueness 
SEVERE: +id: j_id1 
type: [email protected] 
+id: javax_faces_location_HEAD 
type: [email protected] 
+id: j_id2 
type: [email protected] 
+id: j_id3 
type: [email protected] 
+id: j_id4 
type: [email protected] 
+id: j_id5 
type: [email protected] 
+id: j_id6 
type: [email protected] 
+id: j_id7 
type: [email protected] 
+id: j_id8 
type: [email protected] 
+id: j_id9 
type: [email protected] 
+id: j_idt1 
type: <html xmlns="http://www.w3.org/1999/xhtml"> 


+id: j_idt2 
type: [email protected] 
+id: j_idt3 
type: 
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> 
      <title>Madharsha Control Panel Page</title> 

    +id: j_idt4 
    type: [email protected] 
    +id: j_idt5 
    type: [email protected] 
    +id: header 
    type: [email protected] 
    +id: j_idt6 
    type: [email protected] 
    +id: j_idt7 
     type: [email protected] 
     +id: layoutform 
     type: [email protected] 
     +id: rootmenu 
     type: [email protected] 
     +id: homemenu 
     type: [email protected] 
     +id: mastermenu 
     type: [email protected] 
      +id: j_idt8 
      type: [email protected] 
      +id: j_idt9 
      type: [email protected] 
     +id: tabletmenu 
     type: [email protected] 
     +id: logoutmenu 
     type: [email protected] 
     +id: loginmenu 
     type: [email protected] 
     +id: productform 
     type: [email protected] 
     +id: messages 
     type: [email protected] 
     +id: brandpanel 
     type: [email protected] 
     +id: j_idt10 
     type: [email protected] 
      +id: j_idt11 
      type: [email protected] 
      +id: branchname 
      type: [email protected] 
      +id: j_idt12 
      type: [email protected] 
      +id: j_idt13 
      type: [email protected] 
      +id: j_idt14 
      type: [email protected] 
      +id: brandname 
      type: [email protected] 
      +id: j_idt15 
      type: [email protected] 
      +id: j_idt16 
      type: [email protected] 
      +id: j_idt17 
      type: [email protected] 
      +id: j_idt18 
      type: [email protected] 
     +id: j_idt19 
     type: [email protected] 
      +id: j_idt20 
      type: [email protected] 
      +id: j_idt21 
      type: [email protected] 
      +id: j_idt22 
      type: [email protected] 
     +id: categorypanel 
     type: [email protected] 
     +id: j_idt23 
     type: [email protected] 
      +id: j_idt24 
      type: [email protected] 
      +id: categorybranchname 
      type: [email protected] 
      +id: j_idt25 
      type: [email protected] 
      +id: j_idt26 
      type: [email protected] 
      +id: j_idt27 
      type: [email protected] 
      +id: categoryfloorname 
      type: [email protected] 
      +id: j_idt28 
      type: [email protected] 
      +id: j_idt29 
      type: [email protected] 
     +id: j_idt30 
     type: [email protected] 
      +id: j_idt31 
      type: [email protected] 
      +id: categoryname 
      type: [email protected] 
      +id: j_idt32 
      type: [email protected] 
      +id: j_idt33 
      type: [email protected] 
      +id: j_idt34 
      type: [email protected]8 
      +id: j_idt35 
      type: [email protected] 
     +id: j_idt36 
     type: [email protected] 
      +id: j_idt37 
      type: [email protected] 
      +id: subcategoryname 
      type: [email protected] 
      +id: j_idt38 
      type: [email protected] 
      +id: j_idt39 
      type: [email protected] 
      +id: j_idt40 
      type: [email protected] 
      +id: j_idt41 
      type: [email protected] 
     +id: j_idt42 
     type: [email protected] 
      +id: j_idt43 
      type: [email protected] 
     +id: categorytree 
     type: [email protected] 
      +id: j_idt44 
      type: 
          Categories 

      +id: col1 <=============== 
      type: [email protected] 
      +id: out1 
      type: [email protected] 
      +id: col2 
      type: [email protected] 
      +id: com1 
      type: [email protected] 
      +id: col3 
      type: [email protected] 
      +id: com2 
      type: [email protected] 
      +id: col1 <=============== 
      type: [email protected] 
      +id: j_idt45 
      type: 
           Category Name 

      +id: out1 
      type: [email protected] 
      +id: col2 
      type: [email protected] 
      +id: j_idt46 
      type: 
           Edit 

      +id: com1 
      type: [email protected] 
      +id: col3 
      type: [email protected] 
      +id: j_idt47 
      type: 
           Delete 

      +id: com2 
      type: [email protected] 
     +id: dialog 
     type: [email protected] 
     +id: documentPanel 
     type: [email protected] 
      +id: j_idt48 
      type: [email protected] 
      +id: j_idt49 
      type: [email protected] 
      +id: basic 
      type: [email protected] 
       +id: name 
       type: [email protected] 
      +id: j_idt50 
      type: [email protected] 
       +id: j_idt51 
       type: [email protected] 
       +id: btnclear 
       type: [email protected] 
     +id: footer 
     type: [email protected] 
     +id: j_idt52 
    type: [email protected] 
    +id: j_idt53 
    type: 
    </html> 

    Dec 12, 2013 5:27:01 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException 
     SEVERE: Error Rendering View[/product/productmanage.xhtml] 
     java.lang.IllegalStateException: Component ID productform:categorytree:col1 has already been found in the view. 
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:974) 
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:958) 
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:958) 
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:958) 
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:958) 
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:958) 
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:958) 
at com.sun.faces.application.view.FaceletFullStateManagementStrategy.saveView(FaceletFullStateManagementStrategy.java:706) 
at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:89) 
at javax.faces.application.StateManager.getViewState(StateManager.java:593) 
at com.sun.faces.context.PartialViewContextImpl.renderState(PartialViewContextImpl.java:454) 
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:322) 
at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:57) 
at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1004) 
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1896) 
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:425) 
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) 
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) 
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) 
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) 
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) 
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) 
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) 
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) 
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430) 
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
at java.lang.Thread.run(Thread.java:722) 
+0

आप निश्चित रूप से आवश्यक स्कॉप्स को मिश्रित कर रहे हैं। उस दृश्य को '@ व्यूस्पेड' बीन में झूठ बोलना चाहिए। यदि आपको अन्य दृश्यों में मूल्यों की आवश्यकता है, तो बस इसे पैरामीटर के रूप में पास करें या केवल ** @ सत्र सत्र में ** ** की आवश्यकता है। समस्या से संबंधित, यदि आप मुझे कोड के साथ एक [एसएससीसीई] (http://sscce.org/) प्रदान करते हैं तो मैं कॉपी-पेस्ट-रन कर सकता हूं, मैं कुछ परीक्षण करने के लिए आभारी रहूंगा। क्या जेएसएफ प्राइमफेस कार्यान्वयन-संस्करण आप उपयोग कर रहे हैं? –

+0

प्राइमफ़ेस 4.0 और जेएसएफ 2.2, मैं आपको कोड कैसे दे सकता हूं? – Ajeesh

+0

@XtremeBiker मुझे त्रुटि मिल रही है जब मैं ** ** AJAX टैग लेकिन अगले पैनलग्रिड को लोड करना आवश्यक है। – Ajeesh

उत्तर

5

मैं त्रुटि को हल किया। मुझे नहीं पता कि जेएसएफ को बीन के कन्स्ट्रक्टर के अंदर शुरू होने वाले सभी ट्रीनोडों की आवश्यकता क्यों है। मैंने खाली स्ट्रिंग मान वाले सभी ट्रीनोड्स शुरू किए और फिर सब कुछ ठीक काम करता है। यह सत्र/दृश्य स्कॉप्ड बीन्स दोनों में काम करता है।

अद्यतन: 1 यह त्रुटि गलत AJAX अद्यतनों के कारण भी हो सकती है। मैं प्रत्येक घटक से AJAX अनुरोध करने और पूरे पैनल को अद्यतन करने की कोशिश कर रहा था (घटक जहां एक पैनल के अंदर)। फिर मैंने केवल विशिष्ट दृश्य को अद्यतन करने के लिए अद्यतनों को बदल दिया। SelectOneMenu। यहां समाधान पूरे फॉर्म या दृश्य को अद्यतन किए बिना केवल विशिष्ट घटकों को अपडेट किया गया है।

UPDDATE: 2 मैं को असत्य से सत्य web.xml फ़ाइल परम-मूल्य में बदल गया है, तो इस समस्या का समाधान है,

<context-param> 
    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name> 
    <param-value>true</param-value> 
</context-param> 
+0

इसे देखने के लिए खुशी हुई। यह शायद घटकों के जीवन चक्र से संबंधित है। हालांकि यह संबंधित प्रबंधित बीन के बिना इसे नहीं देख सकता है। –

+0

@ एक्सट्रीम बाइकर ठीक है, दोस्त की मदद के लिए धन्यवाद। – Ajeesh

+0

जेएसएफ 2.2 में जाने पर मुझे एक ही समस्या थी, जिसे मैंने PARTIAL_STATE_SAVING संदर्भ-param को पूरी तरह से हटाकर भी तय किया था। मैंने पहले यहां चर्चा की गई कार्यवाही को सक्षम करने के लिए झूठी सेट की थी: http://balusc.blogspot.com/2010/06/benefits-and-pitfalls-of-viewscoped.html –

0

मैं राज्य विधि बचत की स्थापना करके यह तय करने के लिए "सर्वर" "क्लाइंट" के बजाय:

<context-param> 
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description> 
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name> 
    <param-value>server</param-value> 
</context-param> 
संबंधित मुद्दे