Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8120785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:15:48+00:00 2026-06-06T05:15:48+00:00

I am developing a JSF application with JPA(EclipseLink 2.0) and Primefaces. I want to

  • 0

I am developing a JSF application with JPA(EclipseLink 2.0) and Primefaces.
I want to know is there any way to avoid null point exception when el calls a property of a null object. I have described the situation.
I have Bill class. There may be no or more BillItem objects with a Bill objects. Each BillItem object have Objects like Make, Country, Manufacturer, etc objects. I am displaying several properties of a bill within a single JSF file like this.

"#{billControlled.bill.billItem.modal.name}"

But if a bill is not selected, or when there are no bill items for a selected bill, the properties accessing in the el are null. I can avoid this by creating new objects for every bill, for example, new make for a new bill item, etc or by creating new properties in the controller itself for all the properties. But that is a very long way and feel like rudimentory.

Is there any good practice to avoid this null point exception in el in JSF?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:15:50+00:00Added an answer on June 6, 2026 at 5:15 am

    I got the solution. Before every el, I can check null.

    JSF: h:outputText; how to show a dash when the value is empty string?

    <h:outputText value="#{userHandler.user.phoneNumber != null 
    ? userHandler.user.phoneNumber : '-'}" />
    

    Or

    <h:outputText rendered="#{userHandler.user.phoneNumber ne null}"  value="#{userHandler.user.phoneNumber}" /> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a web application using Spring, JSF 2 and Primefaces 3. I want
We are developing a simple web application in JSF in which there is a
I am developing application with JSF 2.0 and Primefaces 3.2, I am running into
I am developing a Java web application using Hibernate and JSF/primefaces. am sometimes getting
I am developing a Java enterprise application and I am usign JSF, mostly Primefaces.
I am developing a web application using JSF and JPA(Eclipse link). I have two
we're developing an application using JSF 2.0 (primefaces) and Hibernate 3.6.1 We're following the
I am developing simple application using JSF with richfaces. I want to upload folder(select
I am developing a Java EE application with JSF, EclipseLink2 as JPA installation and
I am developing an application with JSF and PrimeFaces. I have a managed been,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.