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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:45:49+00:00 2026-06-05T02:45:49+00:00

How do I invoke/access a property of a managed bean when the bean name

  • 0

How do I invoke/access a property of a managed bean when the bean name is known, but is not yet constructed?

For example:

<p:selectOneMenu value="#{eval.evaluateAsBean(bean).text}" >
    <f:selectItems value="#{eval.evaluateAsBean(bean).values}" var="val"
        itemLabel="#{val}" itemValue="#{val}" />
</p:selectOneMenu> 

If there is a managed bean called testBean and in my view bean has the "testBean"value, I want the text or values property of testBean to be called.

EDIT1

The context

An object consists of a list of properties(values). One property is modified with a custom JSF editor, depending on its type.

The list of editors is determined from the object’s type, and displayed in a form using custom:include tags. This custom tag is used to dynamically include the editors <custom:include src="#{editor.component}">. The component property points to the location of the JSF editor.

In my example some editors(rendered as select boxes) will use the same facelet(dynamicDropdown.xhtml). Every editor has a session scoped managed bean. I want to reuse the same facelet with multiple beans and to pass the name of the bean to dynamicDropdown.xhtml using the bean param.

genericAccount.xhtml

<p:dataTable value="#{group.editors}" var="editor">
    <p:column headerText="Key">
        <h:outputText value="#{editor.name}" />
    </p:column>
    <p:column headerText="Value">
        <h:panelGroup rendered="#{not editor.href}">
            <h:outputText value="#{editor.component}" escape="false" />
        </h:panelGroup>
        <h:panelGroup rendered="#{editor.href}">
            <custom:include src="#{editor.component}">
                <ui:param name="bean" value="#{editor.bean}"/>  
            <custom:include>
       </h:panelGroup>
    </p:column>
</p:dataTable>

#{editor.component} refers to a dynamicDropdown.xhtml file.

dynamicDropdown.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.prime.com.tr/ui">
    <p:selectOneMenu value="#{eval.evaluateAsBean(bean).text}" >
    <f:selectItems value="#{eval.evaluateAsBean(bean).values}" var="val"
        itemLabel="#{val}" itemValue="#{val}" />
    </p:selectOneMenu>  
</ui:composition>   

eval is a managed bean:

@ManagedBean(name = "eval")
@ApplicationScoped
public class ELEvaluator {
    ...

    public Object evaluateAsBean(String el) {
        FacesContext context = FacesContext.getCurrentInstance();
        Object bean = context.getELContext()
            .getELResolver().getValue(context.getELContext(), null, el);
        return bean;
    }

    ...

}
  • 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-05T02:45:49+00:00Added an answer on June 5, 2026 at 2:45 am

    I am using servlet-api 2.5

    Servlet 2.5 implies EL 2.1. Invoking methods with arguments is not supported in EL 2.1. It’s introduced in EL 2.2 which implies Servlet 3.0.

    If you can’t upgrade to a Servlet 3.0 compatible container (Tomcat 7, Glassfish 3, JBoss AS 6, etc), then you need to upgrade the EL 2.1 implementation instead. JBoss EL is an EL 2.1 compatible implementation which supports the same new features as in EL 2.2. To install it, just drop jboss-el.jar in webapp’s /WEB-INF/lib and add the following context parameter to web.xml, assuming that you’re using Mojarra:

    <context-param>     
        <param-name>com.sun.faces.expressionFactory</param-name>
        <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>   
    </context-param>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For invoke search android example, every time query search result is received by onCreate().
Often I invoke alien methods which might return a null value. In order to
I'm using C# with P/Invoke to access to a DLL method. The definition of
I have a class with a property Value like this: public class MyClass {
I'm using KSOAP2 to invoke a web service. I am getting a response, but
Is this the appropriate way to access bean properties of an Object without knowing/caring
I have a winforms app, and I need to access the Handle property of
So, the documentation that I've found online so far regarding the Invoke property doesn't
I have a bean whose properties I want to access via reflection. I receive
I know that model should not be aware of session data but I have

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.