lunes, 2 de octubre de 2017

JEE & JSF16th Part: Creating an abstraction view layer to JSF components and Forms (5/5). Frequent problems

1. ERROR #1: Using a bean that does not exists

In the previos entry we used this facelet file:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:p="http://primefaces.org/ui">  
    <h:head>  
    </h:head>  
      
    <h:body>  
       <h:form>  
           <h3>
             This file is for testing Primafaces using a Bean (TestComponentBean)
           </h3>  
           <h2>
             In form/form-prova01.json a value property is set to a Bean-Property. and it is assigned programmatically in TestComponentBean
           </h2> 
           <h:panelGroup binding="#{testComponentBean.pg}" /> 
           <p:commandButton value="Submit"/>
       </h:form>
    </h:body>  
</html>

If we create a new facelets file called testpage03-Problems.xhtml and change the red expresion for this one (using a bean that does not exist)

<h:panelGroup binding="#{nonExistingBean.pg}" />



We get a Target Unreachable error:

SEVERE: Servlet.service() for servlet [FacesServlet] in context with path [/JSFv01] threw exception [/pages/testpage03-Problems.xhtml @16,60 binding="#{nonExistingBean.pg}": Target Unreachable, identifier 'nonExistingBean' resolved to null] with root cause
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'nonExistingBean' resolved to null




2. ERROR #2: Using a unexisting property from a bean

 Now we change to 

<h:panelGroup binding="#{testComponentBean.noExistingProperty}" />

We get a Property nor found error:
SEVERE: Servlet.service() for servlet [FacesServlet] in context with
path [/JSFv01] threw exception [/pages/testpage03-Problems.xhtml 
@16,78 binding="#{testComponentBean.noExistingProperty}": 
Property 'noExistingProperty' not found on type 
org.ximodante.jsf.component.test.TestComponentBean] with root cause
javax.el.PropertyNotFoundException: Property 'noExistingProperty' 
not found on type org.ximodante.jsf.component.test.TestComponentBean

No hay comentarios:

Publicar un comentario

JEE & JSF16th Part: Creating an abstraction view layer to JSF components and Forms (5/5). Frequent problems

1. ERROR #1: Using a bean that does not exists In the previos entry we used this facelet file: 1 2 3 4 5 6 7 8 9 10 11 1...