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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:30:54+00:00 2026-06-04T06:30:54+00:00

In both MyFaces and Mojarra 2.1, there exists a defect where when javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is

  • 0

In both MyFaces and Mojarra 2.1, there exists a defect where when javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL is set to true, any fields that are marked as required and pre-populated in the model, when blanked-out and submitted are re-shown with their original non-blanked-out values instead of being left blank.

Scenario is:

  1. User loads page with a single required field that is populated with existing data from the model
  2. User clears out the field on the page and submits the form
  3. Validation fails, as expected, and the user is shown an error message that they must fill in the
    required field.

The issue is that the field, which should show what the user submitted — which is that they submitted a blank value for the field — is instead populated with the original value from the model. The only workaround is to set javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL to false. Setting to false delivers the desired behavior that the field remains blanked out when the page is redisplayed with the required field error message.

A defect was logged with Mojarra (http://java.net/jira/browse/JAVASERVERFACES-2375) and MyFaces (https://issues.apache.org/jira/browse/MYFACES-3525) but no progress has been made in 6 weeks.

Note that it appears Mojarra had a similar issue reported over 6 mos
ago yet no progress has been made.

Does anyone know of a workaround for this where we can keep javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL set to true instead of false and yet not encounter this required field usability issue?

  • 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-04T06:30:55+00:00Added an answer on June 4, 2026 at 6:30 am

    This problem is explained in detail in JSF 2 – Bean Validation: validation failed -> empty values are replaced with last valid values from managed bean. To the point, in Mojarra it’s caused by a bug or at least an oversight in HtmlBasicRenderer#getCurrentValue() and has been reported as issue 2266.

    In the meanwhile, the easiest way to workaround this, while taking 3rd party component libraries with their own renderers like PrimeFaces into account, is to copy the source file of UIInput straight in your project’s source folder and then edit the getSubmittedValue() accordingly:

    public Object getSubmittedValue() {
        if (submittedValue == null && !isValid() && considerEmptyStringNull(FacesContext.getCurrentInstance())) {
            return "";
        }
        else {
            return submittedValue;
        }
    }
    

    It’ll end up in /WEB-INF/classes and this will get precedence in classloading above the one in the JSF JAR file. Admittedly, it’s somewhat clumsy, but it’s less painful than rebuilding the JSF JAR file or overriding every single input renderer.

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

Sidebar

Related Questions

It seems that today (April 2012), both MyFaces and Mojarra's JSF 2.1 implementations have
Both of them mean space, but is there any difference?
Recently I switched to mojarra from myfaces and noticed that primefaces datatable checkbox multiple
Both of these seem to be doing the same thing. Is there are reason
Both of them pretty much do the same thing. Identify that the method is
Both offer policies which have to be enforced and are similar in operation. There
Both ideas sound very similar to me, but there might be subtle differences or
Both .NET Socket and NetworkStream offer Read method, which blocks, when there is no
Both of these blocks of code work. Is there a right way to do
Both are mathematical values, however the float does have more precision. Is that 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.