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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:58:31+00:00 2026-06-08T21:58:31+00:00

I have a basic CRUD view-scoped bean. Within the setter methods I am performing

  • 0

I have a basic CRUD view-scoped bean. Within the setter methods I am performing some data-specific validation, which build a detailed error message for each setter if an error occurs in any of them.

This works fine, but I would like to empty this error message on each request and I have no idea how I would do that.
preRenderView won’t cut it, because this error message needs to be rendered as well. Something like a postRenderView would be ideal.

  • 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-06-08T21:58:34+00:00Added an answer on June 8, 2026 at 9:58 pm

    You shouldn’t perform validation in setter methods and you shouldn’t store validation messages in the backing bean. Your whole problem is just caused by bad design and not utilizing JSF provided validation facilities.

    Just utilize JSF provided validation facilities instead of working completely around it and all your problems as described so far will disappear. You can use several of the JSF builtin validators such as required="true", validator="javax.faces.XxxValidator, <f:validateXxx> tags, etc on input components. You can create a custom validator by implementing Validator interface and giving it an unique validator ID which you use in validator="myValidator" or <f:validator validatorId="myValidator">.

    When using JSF standard validation, any validation error will be thrown as a ValidatorException with a FacesMessage in the request scope which would be shown in a <h:message> associated with the component. This way the messages will “automagically” disappear in the subsequent requests.

    Here’s a very basic kickoff example:

    <h:form>
        <h:inputText id="foo" required="true" requiredMessage="Enter this!" />
        <h:message for="foo" />
        <h:commandButton value="Submit" />
    </h:form>
    

    See also:

    • Is there how to validate into rich:calendar if the date selected is before a specific date?
    • How to create JSF form with AJAX data validation
    • How to show multi error message in jsf while validation is in EJB?
    • How validate two password fields by ajax?
    • etc…
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a baseDAO which contains methods for basic CRUD operations. And for each
So, I have a basic app for storing, searching, and manipulating data. Basic CRUD
I have some basic jquery code sitting in the header of the header file
I have set up a site that is correctly using basic CRUD functionality succesfully.
I have a basic CRUD with Company model. To make the company name show
I have to come up with a basic CRUD app. as fast as possible
I have a pretty generic repository that does basic CRUD for many of my
I have thrown together a small Lift application, using CRUDify, to perform basic CRUD
I have an extremely basic Windows Forms app for data capture and reporting on
actionmailer actionpack activeresource activesupport I have a basic scaffolded CRUD app that uses ActiveRecord

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.