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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:55:29+00:00 2026-05-26T00:55:29+00:00

Two stupid questions about bean validation used in JSF: How can I remove the

  • 0

Two stupid questions about bean validation used in JSF:

  1. How can I remove the prefix form1:userName: from the output message?

    <h:message for="userName" /> 
    

    Which gets:

    form1:userName: Please enter a valid username (5-20 characters)
    

    I‘d also like to translate the name form1:userName to User Name, it’s easy to implement such translation but I can’t find where to build the message.

  2. I have a custom validator, say @CreditCard, its default message is {foo.bar.BadCreditNumber}

    @interface CreditCard {
        String message() default "{foo.bar.BadCreditNumber}";
    }
    

    And the message is defined in foo/bar/ValidationMessages.properties in classpath. Now how can I make this properties file loaded in every page?

  • 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-26T00:55:29+00:00Added an answer on May 26, 2026 at 12:55 am

    Concerning 1: The error message’s format depends on the property javax.faces.validator.BeanValidator.MESSAGE which must be specified in a resource bundle of the application like this:

    javax.faces.validator.BeanValidator.MESSAGE={1}: {0}
    

    The placeholder {0} refers to the error message as created by the Bean Validation runtime, {1} refers to the component label. So if you don’t want to have the label within the message, just make sure that the placeholder {1} isn’t contained within that property value.

    More information can be found in the JSF 2 spec. section 3.5.6.3.

    Concerning 2: It’s as BalusC is saying, just put ValidationMessages.properties to the root of your classpath. More information can also be found in the Hibernate Validator reference guide.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible stupid question: let's say I have two apps contained within one project. Can
Two general questions I'm wondering about both in the case for a given file(.js,
I'm newbie in C world and I have two probably stupid questions. I'm reading
I feel totally stupid. I'm rusty with my sql. I have two tables, Message
Two questions only: I have a website including a section of Blog in wordpress.
Two related questions. First: does this repro for you or is it something local
Two questions here, second is a little more complicated than first. 1 - I
I'm sure this is a stupid easy question, but with HTML I can never
I have got a (stupid?) C / C++ question about a loop: for (size_t
Hey folks, I have a question which feels stupid but I can't quite say

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.