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

  • Home
  • SEARCH
  • 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 906925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:27:59+00:00 2026-05-15T16:27:59+00:00

By default, every JSF FacesMessage is presented in a single row. I would like

  • 0

By default, every JSF FacesMessage is presented in a single row. I would like to add a HTML line break <br /> to the message itself, so that the message is shown neatly. I tried it like below

message = new FacesMessage("test<br/>test");

However, it got escaped by JSF and is shown as literal text. How can I add HTML code to a FacesMessage without it getting escaped?

  • 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-15T16:27:59+00:00Added an answer on May 15, 2026 at 4:27 pm

    In theory, you want an escape attribute for the h:messages component like the h:outputText has. You’re not the only one who wants this, this is requested before more than often, but it’s a WONTFIX according the JSF guys.

    You have several options:

    1. Use \n instead of <br> and apply CSS accordingly (easiest).

      #messages td { white-space: pre; }
      
    2. Create a custom renderer which extends MessageRenderer (bit harder, but nice if you want to cover more HTML than only linebreaks).

    3. Gather the messages yourself in some List in a bean and display them using <t:dataList>, or when you’re already using Facelets instead of JSP, using <ui:repeat>. This way you can use <h:outputText escape="false"> to display the individual messages.

    4. Or, when you’re already on JSF 2.0, just iterate over FacesContext#getMessageList() yourself. Each item gives you a FacesMessage back which in turn offers several getters. You could then display the summary in a <h:outputText escape"false" />.

      <ul>
          <ui:repeat value="#{facesContext.messageList}" var="facesMessage">
              <li>
                  <h:outputText value="#{facesMessage.summary}" escape="false" />
              </li>
          </ui:repeat>
      </ul>
      
    5. Or, when you’re using JSF utility library OmniFaces, use its <o:messages> component instead which has support for escape attribute.

      <o:messages escape="false" />
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I generate a default comment for cvs? I'd like every checkin comment
I have ListView. Every row has TextView with some text. And also by default
While making a WPF application I would like to change the default FocusVisualStyle (the
With SQLAlchemy, it is possible to add a default value to every function. As
The Password in default in every text box will appear like ••••••••• in the
I have a datagridview where the default values are provided for every new row
can I somehow configure JSF, Jboss to default use ?faces-redirect=true for every link? Or
Is it possible to minimize the default border of every side of a button?
I understand the default Git behaviour of updating the modification time every time it
In Apache Wicket web framework every component returns false from getOuputMarkupId() by default .

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.