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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:56:27+00:00 2026-05-30T01:56:27+00:00

In JSF you can use EL expression to set the styleClass as follow: <rich:column>

  • 0

In JSF you can use EL expression to set the styleClass as follow:

<rich:column>
 <h:outputText value="12" id="sumOfAllValues" styleClass="#{!t330RowItems.showSpecialField ? 'rich-table-green' : 'rich-table-cell'}"/>
</rich:column>

Now I am building the table in Java code using org.richfaces.component.html.HtmlColumn the only problem is when do this:

htmlColumn.setStyleClass("#{!t330RowItems.showSpecialField ? 'rich-table-green' : 'rich-table-cell'}");

The following HTML is generated:

<tbody id="j_id154:tb">
 <tr class="rich-table-row rich-table-firstrow ">
  <td class="rich-table-cell #{!t330RowItems.showSpecialField ? 'rich-table-green' : 'rich-table-cell'}" id="j_id154:0:j_id155">55</td>
 </tr>

The problem is it is not evaluating the EL expression. Any ideas on how I can get it to either have rich-table-cell or rich-table-green as styleClass?

  • 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-30T01:56:28+00:00Added an answer on May 30, 2026 at 1:56 am

    You need to set it as a fullworthy ValueExpression instead of as a plain vanilla String. You can create one by ExpressionFactory#createValueExpression(). You can obtain the expression factory in JSF context by Application#getExpressionFactory().

    So, this should do:

    ValueExpression styleClassVE = context.getApplication().getExpressionFactory()
        .createValueExpression(context.getELContext(), "#{!t330RowItems.showSpecialField ? 'rich-table-green' : 'rich-table-cell'}", String.class);
    
    htmlColumn.setStyleClass(styleClassVE);
    // or htmlColumn.setValueExpression("styleClass", styleClassVE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using hibernate validators with JSF. How can I set my conversion error messages?
how can i check ACL in JSF pages? For JSP i can use a
I searched around for a basic WYSIWYG rich text editor that I can use
I want to use spring with jsf in my project. So how can I
I just started learning about JSF. In JSP file we can use <%= request.getAttribute(JsData)%>
Can I use jsf component libraries(primefaces) with spring mvc .I have problem with client
How can I use a JSF page as welcome file? The FacesServlet is mapped
I want to develop JSF page which can display the swap size if the
Can we mix JSF RI 1.1 with Tomahawk, Primefaces, MyFaces, etc in one application?
Can I rerender a jsf ui component when a valuechangelistener method is run? The

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.