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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:31:24+00:00 2026-05-24T06:31:24+00:00

How to insert special characters like & and < into JSF components value attribute

  • 0

How to insert special characters like & and < into JSF components value attribute ?

For example: I want something like this:

<h:outputText value="Tom & Jerry Show" />

When I try this, I get the following exception:

javax.faces.view.facelets.FaceletException: Error Parsing /foo.xhtml: Error Traced[line: 15] The entity name must immediately follow the ‘&’ in the entity reference.

And in case of <, I get the following exception:

javax.faces.view.facelets.FaceletException: Error Parsing /foo.xhtml: Error Traced[line: 15] The value of attribute “value” associated with an element type “h:outputText” must not contain the ‘<‘ character.

  • 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-24T06:31:25+00:00Added an answer on May 24, 2026 at 6:31 am

    You need to escape them to XML entities.

    <h:outputText value="Tom &amp; Jerry Show" />
    

    This problem is not related to JSF per se, but to the view technology. You’re apparently using Facelets (which is perfectly fine!). Facelets is however a XML based view technology, so you would need to ensure that the template is well formed XML and that all special characters which are to be represented as-is, are been escaped like above.

    In the wikipedia you can find a list of predefinied character entities which needs to be escaped in the XML whenever you’d like to display them as-is. It are the following character entities:

    "     &quot;
    &     &amp;
    '     &apos;
    <     &lt;
    >     &gt;
    

    See also:

    • The entity name must immediately follow the '&' in the entity reference
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I insert ASCII special characters (e.g. with the ASCII value 0x01) into
how to insert special characters into a database(MySQL) like Registered symbol ( ® )
I want to insert special character & in my insert statement. My insert is:
I'm trying to insert the following Welsh special characters into a SQL Server database:
Like: insert into table (col) values (N'multilingual unicode strings') I'm using SQL Server 2008
I need to represent special characters like superscripts, copyright symbols etc in XML. What's
Greetings, I'd like to insert html via a form into my database using php.
I want to insert a xml file as a string as a entry into
My php script won't work if i try to insert into database something in
I insert a pair (key,value) to my hashmap but it seems like it doesn't

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.