0 Replies Latest reply on Nov 24, 2009 2:12 PM by idyoshin

    Facelet view params problem

    idyoshin

      Good day.


      Haven't found the similar problem, so the new post:


      I have a common template for objects:


      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:s="http://jboss.com/products/seam/taglib"
           xmlns:rich="http://richfaces.org/rich"
           xmlns:a4j="http://richfaces.org/a4j">
           
           <s:decorate template="/layout/edit.xhtml">
                <ui:define name="label"><h:outputText value="код"/></ui:define>
                <h:inputText value="#{instance.id}" required="true" rendered="#{not entityManager.contains(instance)}"/>
                <h:outputText value="#{instance.id}" rendered="#{entityManager.contains(instance)}"/>
           </s:decorate>
           
           <s:decorate template="/layout/edit.xhtml">
                <ui:define name="label"><h:outputText value="Опис"/></ui:define>
                <h:inputText value="#{instance.description}" required="true"/>
           </s:decorate>
           
           <s:decorate template="/layout/edit.xhtml">
                <ui:define name="label"><h:outputText value="Коментарі"/></ui:define>
                <rich:editor value="#{instance.comments}"></rich:editor>
           </s:decorate>
           
           <s:decorate template="/layout/edit.xhtml">
                <ui:define name="label"><h:outputText value="Дані перевірено"/></ui:define>
                <h:selectOneRadio value="#{instance.valid}" >
                     <f:selectItem itemLabel="Так" itemValue="#{true}"/>
                     <f:selectItem itemLabel="Ні" itemValue="#{false}"/>
                </h:selectOneRadio>
           </s:decorate>
           
      </ui:composition>



      and I'm creating some form for objects, that are subclasses of the common object (additional field is created):



      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://jboss.com/products/seam/taglib"
          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:rich="http://richfaces.org/rich"
           xmlns:a4j="http://richfaces.org/a4j">
           
           <h3>Довідник реєстрації</h3>
           <s:decorate template="../common_edit.xhtml">
                <ui:param name="instance" value="#{sprRegistrationEntityHome.instance}"/>
           </s:decorate>
           
           <s:decorate template="/layout/edit.xhtml">
                <ui:define name="label"><h:outputText value="Є резидентом країни страхувальника" /></ui:define>
                <h:selectOneRadio value="#{sprRegistrationEntityHome.instance.resident}">
                     <f:selectItem itemValue="#{true}" itemLabel="Так"/>
                     <f:selectItem itemValue="#{false}" itemLabel="Ні"/>
                </h:selectOneRadio>
           </s:decorate>
                          
      </ui:composition>




      And I'd like to include that in common grid and modalPanel editor:



      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://jboss.com/products/seam/taglib"
          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:rich="http://richfaces.org/rich"
          template="/layout/template.xhtml"
          xmlns:a4j="http://richfaces.org/a4j">
      
           <ui:define name="body">     
           
                <h3>Типи адрес</h3>
                     <a4j:form>
                          <rich:dataTable value="#{sprRegistrationEntityHome.resultList}" var="vv" id="tableForm">
                               <rich:column>
                                    <f:facet name="header"> <h:outputText value="код"/></f:facet>
                                    <h:outputText value="#{vv.id}" />
                               </rich:column>
                               
                               <rich:column>
                                    <f:facet name="header"> <h:outputText value="Значення"/></f:facet>
                                    <h:outputText value="#{vv.description}" />
                               </rich:column>
                               
                               <rich:column>
                                    <f:facet name="header"> <h:outputText value="Коментарі"/></f:facet>
                                    <h:outputText value="#{vv.comments}" escape="false"/>
                               </rich:column>
                               
                               <rich:column>
                                    <f:facet name="header"> <h:outputText value="Коментарі"/></f:facet>
                                    
                               </rich:column>
                               
                               <rich:column>
                                    <f:facet name="header"> <h:outputText value=""/></f:facet>
                                    
                                    <a4j:commandButton  value="Редагувати" id="editorLink"  >
                                         <rich:componentControl for="editorPanel" attachTo="editorLink" operation="show" event="onclick"/>
                                         <a4j:support reRender="editorForm" event="onclick">
                                              <f:setPropertyActionListener value="#{vv.id}" target="#{sprRegistrationEntityHome.id}" />
                                         </a4j:support>
                                    </a4j:commandButton>
                                    
                               </rich:column>
                          </rich:dataTable>
                     </a4j:form>
                     
                          <rich:modalPanel id="editorPanel" autosized="true" width="500" keepVisualState="true">
                               <a4j:outputPanel id="editorForm">
                                    <a4j:form>
                                         <h:panelGrid>
                                         
                                              <ui:decorate template="edit.xhtml"/>
                                              
                                              <h:panelGrid columns="2">
                                                   <a4j:commandButton action="#{sprRegistrationEntityHome.save()}" value="Зберегти" reRender="tableForm">
                                                   </a4j:commandButton>
                                                   <a4j:commandButton  value="Закрити" id="hideLink" >
                                                        <rich:componentControl for="editorPanel" attachTo="hideLink" operation="hide" event="onclick"/>
                                                   </a4j:commandButton>
                                              </h:panelGrid>
                                         </h:panelGrid>
                                    </a4j:form>
                               </a4j:outputPanel>
                          </rich:modalPanel>
                
           </ui:define>    
      </ui:composition>




      First of all nothing is loaded into the form-fields - they are empty. And when I click save button I'm receiving exception :


      javax.el.PropertyNotFoundException: /crud/spr/common/common_edit.xhtml @11,107 value="#{instance.id}": Target Unreachable, identifier 'instance' resolved to null




      Any idea??