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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:22:41+00:00 2026-05-27T09:22:41+00:00

How can we resolve JSF EL expressions programmatically on Seam managed beans? I have

  • 0

How can we resolve JSF EL expressions programmatically on Seam managed beans? I have tried the following, but it does not work:

private String resolveExpression(String expression){

        if(expression == null)
        {
            return null;
        }

        javax.faces.context.FacesContext facesCtx = FacesContext.getCurrentInstance();
        Application app = facesCtx.getApplication();

        try 
        {
            // Here we bind a value expression into the item, 
            // so it can dynamically change its language
            ELContext elCtx = facesCtx.getELContext();
            ExpressionFactory ef = app.getExpressionFactory();
            ValueExpression ve = ef.createValueExpression(elCtx, expression, String.class);

            return (String) ve.getValue(elCtx);
        } 
        catch (ELException ex) {
        }

        return expression;
    }

In my application I have a bean named User that in session scope of Seam sits and this bean has a property name. The EL expression is #{usr.name}, but this expression returns empty while it works fine in a Facelet file.

  • 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-05-27T09:22:42+00:00Added an answer on May 27, 2026 at 9:22 am

    Seam provides two utility components for dealing with EL expressions: Expressions and Interpolator.

    For your particular use case, I believe Interpolator is the correct choice, since you don’t really need a valid ValueExpression. Interpolator parses the whole string for EL expressions and converts all of them to their evaluated values.

    Beware that Interpolator#interpolate() also accepts arguments (see the documentation).

    Example:

    @Name("bean")
    @Scope(ScopeType.SESSION)
    class MyBean {
         ...
    
         public String getValue() {
              return value;
         }
    
         ...
    }
    
    @Name("otherBean")
    @Scope(ScopeType.EVENT)
    class MyBean {
         ...
    
         public String getInterpolatedValue() {
              return Interpolator.instance().interpolate("#{bean.value}");
         }
    
         ...
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From my understanding, prism's unity container can resolve types event if they have not
I can't resolve this issue, I found a similar question here but: setting the
I'm trying to consume a webmethod but it seems that my application can't resolve
am using the following css code for the style, but it is not working
I have the following exception at the time of running JSF program. org.apache.jasper.JasperException: An
I have a situation which I can resolve by adding a column which would
For my current project I'm working with JSF, Seam and Hibernate and I have
With javascript, how I can preload images that dont have a path source but
I have MEF/Prism 4 project for which I can resolve imports via the ImportingConstructor,
I'm creating 'generic' wrapper above SQL procedures, and I can resolve all required parameters'

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.