0 Replies Latest reply on Jan 27, 2011 12:13 PM by Romildo Jozue Paiter

    Error on change tab of tabPanel

    Romildo Jozue Paiter Newbie

      Hello Guy, very nice.

       

      I have form using de component  <rich:tabPanel> and yours <rich:tab>. What What happens when I fill out a form and part of the step to the next. comes the following error. 've searched the net, and I found if anyone knows.

      any tips

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
      1. <ui:composition xmlns="http://www.w3.org/1999/xhtml
      2.       xmlns:h="http://java.sun.com/jsf/html
      3.       xmlns:a4j="http://richfaces.org/a4j
      4.       xmlns:rich="http://richfaces.org/rich
      5.       xmlns:f="http://java.sun.com/jsf/core
      6.       xmlns:ui="http://java.sun.com/jsf/facelets
      7.       xmlns:s="http://jboss.com/products/seam/taglib
      8.       template="/admsc/template.xhtml"> 
      9.        
      10.         
      11.     <ui:define name="cabecalho">Cadastro Revenda</ui:define> 
      12.      
      13.     <ui:define name="conteudo"> 
      14.         <h:form id="formRevenda"> 
      15.           <rich:tabPanel> 
      16.              <rich:tab label="Dados Revenda" switchType="revenda">         
      17.                      
      18.                         <s:decorate id="codigoDecorate" template="display.xhtml"  
      19.                             rendered="#{revenda.id != 0}">              
      20.                             <ui:define name="label">Código:</ui:define> 
      21.                             #{revenda.id} 
      22.                         </s:decorate> 
      23.                          
      24.                         <s:decorate id="nomeFantasiaDecorate" template="edit.xhtml"
      25.                             <ui:define name="label">Nome Fantasia:</ui:define> 
      26.                             <h:inputText id="nomefantasia" value="#{revendaAction.revenda.nomeFantasia}" required="true"
      27.                                 <a4j:support id="onblur" event="onblur" reRender="nomeFantasiaDecorate"/> 
      28.                             </h:inputText> 
      29.                         </s:decorate> 
      30.                          
      31.                         <s:decorate id="razaoSocialDecorate" template="edit.xhtml"
      32.                             <ui:define name="label">Razão Social:</ui:define> 
      33.                             <h:inputText id="razaosocial" value="#{revendaAction.revenda.razaoSocial}" required="true"
      34.                                 <a4j:support id="onblur" event="onblur" reRender="razaoSocialDecorate"/> 
      35.                             </h:inputText> 
      36.                         </s:decorate> 
      37.                                          
      38.                         <s:decorate id="proprietarioDecorate" template="edit.xhtml"
      39.                             <ui:define name="label">Proprietário:</ui:define> 
      40.                             <h:inputText id="proprietario" value="#{revendaAction.revenda.proprietario}" required="true"
      41.                                 <a4j:support id="onblur" event="onblur" reRender="proprietarioDecorate"/> 
      42.                             </h:inputText> 
      43.                         </s:decorate> 
      44.                          
      45.                         <s:decorate id="telefoneDecorate" template="edit.xhtml"
      46.                             <ui:define name="label">Telefone:</ui:define> 
      47.                             <h:inputText id="telefone" value="#{revendaAction.revenda.telefone}" required="true"
      48.                                 <a4j:support id="onblur" event="onblur" reRender="telefoneDecorate"/> 
      49.                             </h:inputText> 
      50.                         </s:decorate> 
      51.          
      52.                         <s:decorate id="telefone2Decorate" template="edit.xhtml"
      53.                             <ui:define name="label">Telefone 2:</ui:define> 
      54.                             <h:inputText id="telefone2" value="#{revendaAction.revenda.telefone2}"
      55.                                 <a4j:support id="onblur" event="onblur" reRender="telefone2Decorate"/> 
      56.                             </h:inputText> 
      57.                         </s:decorate> 
      58.                          
      59.                         <s:decorate id="celularDecorate" template="edit.xhtml"
      60.                             <ui:define name="label">Celular:</ui:define> 
      61.                             <h:inputText id="celular" value="#{revendaAction.revenda.celular}" required="true"
      62.                                 <a4j:support id="onblur" event="onblur" reRender="celularDecorate"/> 
      63.                             </h:inputText> 
      64.                         </s:decorate> 
      65.                          
      66.                         <s:decorate id="cnpjDecorate" template="edit.xhtml"
      67.                             <ui:define name="label">CNPJ:</ui:define> 
      68.                             <h:inputText id="cnpj" value="#{revendaAction.revenda.celular}" required="true"
      69.                                 <a4j:support id="onblur" event="onblur" reRender="celularDecorate"/> 
      70.                             </h:inputText> 
      71.                         </s:decorate> 
      72.                          
      73.                         <s:decorate id="dataCadastroDecorate" template="edit.xhtml"
      74.                             <ui:define name="label">Data Cadastro:</ui:define> 
      75.                             <h:inputText id="cnpj" value="#{revendaAction.revenda.dataCadastro}" required="true"
      76.                                 <a4j:support id="onblur" event="onblur" reRender="dataCadastroDecorate"/> 
      77.                             </h:inputText> 
      78.                         </s:decorate> 
      79.                          
      80.                         <s:decorate id="statusDecorate" template="edit.xhtml"
      81.                             <ui:define name="label">Status:</ui:define> 
      82.                             <h:selectOneMenu id="status" value="#{revendaAction.revenda.status}" required="true">                              
      83.                                 <f:selectItems value="#{enumerados.statusContaRevenda}" var="status" 
      84.                                     label="#{status.descricao}" 
      85.                                     noSelectionLabel="--Selecione--" />  
      86.                                 <s:convertEnum/> 
      87.                             </h:selectOneMenu> 
      88.                         </s:decorate>                                                                              
      89.                      
      90.                 </rich:tab> 
      91.                  
      92.                 <rich:tab label="Endereço" switchType="revenda"
      93.                         <s:decorate id="logradouroDecorate" template="edit.xhtml"
      94.                             <ui:define name="label">Logradouro:</ui:define> 
      95.                             <h:inputText id="logradouro" value="#{revendaAction.revenda.endereco.logradouro}" required="true"
      96.                                 <a4j:support id="onblur" event="onblur" rendered="logradouroDecorate"/>                                
      97.                             </h:inputText> 
      98.                         </s:decorate> 
      99.  
      100.                         <s:decorate id="numeroDecorate" template="edit.xhtml"
      101.                             <ui:define name="label">Número:</ui:define> 
      102.                             <h:inputText id="numero" value="#{revendaAction.revenda.endereco.numero}" required="true"
      103.                                 <a4j:support id="onblur" event="onblur" rendered="numeroDecorate"/>                                
      104.                             </h:inputText> 
      105.                         </s:decorate> 
      106.                          
      107.                         <s:decorate id="complementoDecorate" template="edit.xhtml"
      108.                             <ui:define name="label">Complemento:</ui:define> 
      109.                             <h:inputText id="complemento" value="#{revendaAction.revenda.endereco.complemento}" required="true"
      110.                                 <a4j:support id="onblur" event="onblur" rendered="logradouroDecorate"/>                                
      111.                             </h:inputText> 
      112.                         </s:decorate> 
      113.  
      114.                         <s:decorate id="bairroDecorate" template="edit.xhtml"
      115.                             <ui:define name="label">Bairro:</ui:define> 
      116.                             <h:inputText id="bairro" value="#{revendaAction.revenda.endereco.bairro}" required="true"
      117.                                 <a4j:support id="onblur" event="onblur" rendered="bairroDecorate"/>                                
      118.                             </h:inputText> 
      119.                         </s:decorate> 
      120.                          
      121.                         <s:decorate id="cidadeDecorate" template="edit.xhtml"
      122.                             <ui:define name="label">Cidade:</ui:define> 
      123.                             <h:inputText id="cidade" value="#{revendaAction.revenda.endereco.cidade}" required="true"
      124.                                 <a4j:support id="onblur" event="onblur" rendered="cidadeDecorate"/>                                
      125.                             </h:inputText> 
      126.                         </s:decorate> 
      127.                          
      128.                         <s:decorate id="cepDecorate" template="edit.xhtml"
      129.                             <ui:define name="label">CEP:</ui:define> 
      130.                             <h:inputText id="cep" value="#{revendaAction.revenda.endereco.cep}" required="true"
      131.                                 <a4j:support id="onblur" event="onblur" rendered="cepDecorate"/>                               
      132.                             </h:inputText> 
      133.                         </s:decorate>                      
      134.                      
      135.                         <s:decorate id="estadosDecorate" template="edit.xhtml"
      136.                             <ui:define name="label">Estado:</ui:define> 
      137.                             <h:selectOneMenu id="estado" value="#{revendaAction.revenda.endereco.estado}" required="true">                                 
      138.                                 <f:selectItems value="#{enumerados.listaEstadosBrasileiro}" var="status" 
      139.                                     label="#{status.descricao}" 
      140.                                     noSelectionLabel="--Selecione--" />  
      141.                                 <s:convertEnum/> 
      142.                             </h:selectOneMenu> 
      143.                         </s:decorate>                                                                  
      144.                 </rich:tab> 
      145.                  
      146.                 <rich:tab label="Logomarca" switchType="revenda"
      147.                  
      148.                 </rich:tab> 
      149.                  
      150.                 <rich:tab label="Observações" switchType="revenda">                            
      151.                         <s:decorate id="observacoesDecorate" template="edit.xhtml"
      152.                             <ui:define name="label">Observações:</ui:define> 
      153.                             <h:inputText id="observacoes" value="#{revenda.observacoes}"
      154.                                 <a4j:support id="onblur" event="onblur" reRender="observacoesDecorate"/> 
      155.                             </h:inputText> 
      156.                         </s:decorate>                              
      157.                 </rich:tab>                
      158.             </rich:tabPanel>                       
      159.         </h:form> 
      160.      
      161.     </ui:define>  
      162. </ui:composition> 


      revendaAction

       

      1. package br.com.sofistcar.actions; 
      2.  
      3.  
      4. import java.util.List; 
      5.  
      6. import javax.persistence.EntityManager; 
      7.  
      8. import org.jboss.seam.ScopeType; 
      9. import org.jboss.seam.annotations.Factory; 
      10. import org.jboss.seam.annotations.In; 
      11. import org.jboss.seam.annotations.Name; 
      12.  
      13. import org.jboss.seam.annotations.Scope; 
      14. import org.jboss.seam.annotations.datamodel.DataModel; 
      15. import org.jboss.seam.faces.FacesMessages; 
      16.  
      17. import br.com.sofistcar.dominio.Revenda; 
      18.  
      19. @Name("revendaAction"
      20. @Scope(ScopeType.SESSION) 
      21.  
      22. public class RevendaActions implements RevendaSC { 
      23.      
      24.     @In("#{entityManager}"
      25.     private EntityManager em; 
      26.          
      27.     @In 
      28.     private FacesMessages facesMessages; 
      29.          
      30.     @DataModel 
      31.     private List<Revenda> revendas;    
      32.      
      33.     @In(create=true
      34.     private Revenda revenda; 
      35.      
      36.     public Revenda getRevenda() { 
      37.         if (revenda == null) revenda = new Revenda(); 
      38.         return revenda; 
      39.     } 
      40.  
      41.     public void setRevenda(Revenda revenda) { 
      42.         this.revenda = revenda; 
      43.     } 
      44.  
      45.     public List<Revenda> getRevendas() {   
      46.         return revendas; 
      47.     } 
      48.      
      49.      
      50.     /**
      51.      * Função responsavel em salvar uma revenda no 
      52.      * Banco de Dados
      53.      * 
      54.      * @author Romildo Jozue Paiter
      55.      * @data 25/01/2011
      56.      */ 
      57.     public String salvaRevenda(){ 
      58.         try { 
      59.             // em.merge(revenda); 
      60.             em.persist(revenda); 
      61.             facesMessages.addFromResourceBundle("inserirRevendaSucesso"); 
      62.         }catch (Exception e) { 
      63.             facesMessages.addFromResourceBundle("inserirRevendaFalha"); 
      64.             e.printStackTrace(); 
      65.             return null
      66.         } 
      67.         return "listaRevenda"
      68.     } 
      69.  
      70.     @SuppressWarnings("unchecked"
      71.     @Factory("revendas"
      72.     public void listaRevenda() { 
      73.         revendas = em.createQuery("select r from Revenda r").getResultList();        
      74.     } 


       

      1. package br.com.sofistcar.actions; 
      2.  
      3. import java.util.List; 
      4. import java.util.Map; 
      5. import javax.faces.model.SelectItem; 
      6. import br.com.sofistcar.dominio.Revenda; 
      7.  
      8. public interface RevendaSC { 
      9.      
      10.     public Revenda getRevenda(); 
      11.     public void setRevenda(Revenda revenda); 
      12.  
      13.     public List<Revenda> getRevendas(); 
      14.      
      15.     public String salvaRevenda(); 
      16.  
      17.     public void listaRevenda(); 
      18.  


      Agora aqui esta o benedito erro.

       

      1. 3:38:43,513 WARNING [lifecycle] /admsc/revendaCadastro.xhtml @96,106 value="#{revendaAction.revenda.endereco.logradouro}": Target Unreachable, 'endereco' returned null on 'br.com.sofistcar.dominio.Revenda' 
      2. javax.el.PropertyNotFoundException: /admsc/revendaCadastro.xhtml @96,106 value="#{revendaAction.revenda.endereco.logradouro}": Target Unreachable, 'endereco' returned null on 'br.com.sofistcar.dominio.Revenda' 
      3.     at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62) 
      4.     at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:92) 
      5.     at javax.faces.component.UIInput.getConvertedValue(UIInput.java:942) 
      6.     at javax.faces.component.UIInput.validate(UIInput.java:868) 
      7.     at javax.faces.component.UIInput.executeValidate(UIInput.java:1072) 
      8.     at javax.faces.component.UIInput.processValidators(UIInput.java:672) 
      9.     at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058) 
      10.     at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058) 
      11.     at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058) 
      12.     at org.richfaces.component.UISwitchablePanel.processValidators(UISwitchablePanel.java:225) 
      13.     at javax.faces.component.UIForm.processValidators(UIForm.java:234) 
      14.     at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:439
      15.     at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238) 
      16.     at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:455) 
      17.     at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76) 
      18.     at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) 
      19.     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) 
      20.     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) 
      21.     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
      22.     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
      23.     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) 
      24.     at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) 
      25.     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 
      26.     at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) 
      27.     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 
      28.     at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) 
      29.     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 
      30.     at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) 
      31.     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 
      32.     at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) 
      33.     at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:295) 
      34.     at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:373) 
      35.     at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:500) 
      36.     at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) 
      37.     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 
      38.     at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) 
      39.     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 
      40.     at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) 
      41.     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 
      42.     at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) 
      43.     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
      44.     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
      45.     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 
      46.     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
      47.     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
      48.     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) 
      49.     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
      50.     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183) 
      51.     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433) 
      52.     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95) 
      53.     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) 
      54.     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) 
      55.     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
      56.     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
      57.     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) 
      58.     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
      59.     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) 
      60.     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) 
      61.     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598) 
      62.     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451) 
      63.     at java.lang.Thread.run(Thread.java:636) 
      64. 13:38:43,537 SEVERE [lifecycle] JSF1054: (Phase ID: PROCESS_VALIDATIONS 3, View ID: /admsc/revendaCadastro.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@110d2a0


      Thks