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 7977541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:13:50+00:00 2026-06-04T09:13:50+00:00

I have following two simple POJOs: class Person { String name Address address; //and

  • 0

I have following two simple POJOs:

class Person {
   String name
   Address address;
   //and of course the getter/setter for the attributes
}

class Address {
   String city;
   //also getter/setter for this attribute
}

And a backing bean:

@ManagedBean
@RequestScoped
class PersonController {

    private List persons;
    private List<String> columns = Arrays.toList("name", "address.city");
   //of course getter/setter
}

Now I want to create a dataTable.

<p:dataTable var="person" value="#{personController.persons}" columnIndexVar="index">
    <p:columns var="column" value="#{personController.columns}">
        <h:outputText value="#{person[column]}"/>
    <p:columms>
</p:dataTable>

When I execute this I get a ServletException:

The class Person does not have the property ‘address.city’.

But if a try to access the property city like this within p:columns:

<h:outputText value="#{person.address.city}"/>

Everything is fine.

Why I can not access a nested property like that #{person['address.city']}? And how can I access it within p:columns?

  • 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-04T09:13:51+00:00Added an answer on June 4, 2026 at 9:13 am

    Nested bean properties in a brace notation string expression like #{person['address.city']} is by default not supported. You basically need a #{person['address']['city']}.

    You need a custom ELResolver here. Easiest is to extend the existing BeanELResolver.

    Here’s a kickoff example:

    public class ExtendedBeanELResolver extends BeanELResolver {
    
        @Override
        public Object getValue(ELContext context, Object base, Object property)
            throws NullPointerException, PropertyNotFoundException, ELException
        {
            if (property == null || base == null || base instanceof ResourceBundle || base instanceof Map || base instanceof Collection) {
                return null;
            }
    
            String propertyString = property.toString();
    
            if (propertyString.contains(".")) {
                Object value = base;
    
                for (String propertyPart : propertyString.split("\\.")) {
                    value = super.getValue(context, value, propertyPart);
                }
    
                return value;
            }
            else {
                return super.getValue(context, base, property);
            }
        }
    
    }
    

    To get it to run, register it as follows in faces-config.xml:

    <application>
        <el-resolver>com.example.ExtendedBeanELResolver</el-resolver>
    </application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following two simple models for users and user groups: class User
I have the following code that fills dataTable1 and dataTable2 with two simple SQL
How to wrap one div around another? I have following two div ids: #course
I have the following two tables: Customer { int Id int Name } Bills
I have the following two classes, one inherits from the other Class A{ void
I have the following two tables: Table1 ---------- ID Name 1 A 2 B
So imagine you have the following two tables: CREATE movies ( id int, name
In the Photo model I have following simple rule: searchable do string :note end
I have the following two models, User.. class User < ActiveRecord::Base has_and_belongs_to_many :sites end
1I have the following two tables (sample data) and need to be able to

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.