Skip Headers
Oracle® Application Development Framework Developer's Guide
10g Release 3 (10.1.3)
B25386-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

16.6 Tracing EL Expressions

EL is not well supported with exceptions to inform you of specific failures. However, Example 16-8 shows one common exception you are likely to see when the resolver is unable to completely evaluate the expression.

Example 16-8 Expression Evaluation PropertyNotFound Exception

javax.faces.el.PropertyNotFoundException:
   Error setting property 'resultsTable' in bean of type null
at com.sun.faces.el.PropertyResolverImpl.setValue
   (PropertyResolverImpl.java:153)

You can check your web page's source code for problems in the expression, such as mistyped property names. When no obvious error is found, you will want to configure the logging.properties file in the <JDeveloper_Install>/jre/lib directory to display messages from the EL resolver.

To trace EL expression variables:

  1. Open <JDeveloper_Install>/jre/lib/logging.properties in your text editor.

  2. Set java.util.logging.ConsoleHandler.level=FINE.

  3. Add the line:

    com.sun.faces.level=FINE

  4. Run your application and view the variable resolution in the JDeveloper Log window.

For example, the SRDemo application defines a backing bean backing_SRSearch.java. Example 16-9 shows the SRSearch.jspx page, which relies on the ADF table binding resultsTable to create a databound table component.

Example 16-9 Reference to Backing Bean in Table Binding

<af:table rows="#{bindings.findAllServiceRequests1.rangeSize}"
                      ...
                      binding="#{backing_SRSearch.resultsTable}"
                      id="resultsTable"
                      width="100%"
                      rendered="#{(bindings.hideResultsParam!='true') and
                        (bindings.findAllServiceRequests1.estimatedRowCount >0)}">

Example 16-10 shows the messages that appear in the JDeveloper Log window when you run the application with EL trace messages enabled. In this case, the resolver is not able to resolve the value binding resultsTable from the backing bean and the PropertyNotFound exception will appear in the browser.

Example 16-10 JDeveloper Log with EL Trace Enabled

02-Dec-2005 09:41:28 com.sun.faces.el.ValueBindingImpl getValue
FINE: getValue(ref=backing_SRSearch.resultsTable)
02-Dec-2005 09:41:28 com.sun.faces.application.ApplicationAssociate
   createAndMaybeStoreManagedBeans
FINE: Couldn't find a factory for backing_SRSearch
02-Dec-2005 09:41:28 com.sun.faces.el.VariableResolverImpl resolveVariable
FINE: resolveVariable: Resolved variable:null
02-Dec-2005 09:41:28 com.sun.faces.el.ValueBindingImpl getValue
FINE: getValue Result:null
02-Dec-2005 09:41:28 com.sun.faces.application.ApplicationAssociate
   createAndMaybeStoreManagedBeans
FINE: Couldn't find a factory for backing_SRSearch
02-Dec-2005 09:41:28 com.sun.faces.el.VariableResolverImpl resolveVariable
FINE: resolveVariable: Resolved variable:null
02-Dec-2005 09:41:28 com.sun.faces.el.ValueBindingImpl setValue
FINE: setValue Evaluation threw exception:
javax.faces.el.PropertyNotFoundException

The message FINE: Couldn't find a factory for backing_SRSearch indicates that the backing bean was never created. To fix the error, check the faces-config.xml file and make sure that the backing bean is listed. Example 16-11 shows the correct listing for the file.

Example 16-11 faces-config.xml Managed Bean Description

 <!-- Page backing beans -->
  <managed-bean>
    <managed-bean-name>backing_SRSearch</managed-bean-name>
    <managed-bean-class>oracle.srdemo.view.backing.SRSearch</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1SRSearch.jspx-->
  </managed-bean>

In summary, when you encounter a PropertyNotFound exception and the property is one that appears in an EL expression, you may check the syntax of your web page for simple errors. Then, rerun the application with the JSF trace messages enabled and examine the variable resolution messages for clues.