Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The reason for your question may be is that if you want to validate the empty values you should change you <code>web.xml</code>'s setting, to let empty fields allowed.</p> <pre><code> &lt;context-param&gt; &lt;param-name&gt;javax.faces.VALIDATE_EMPTY_FIELDS&lt;/param-name&gt; &lt;param-value&gt;true&lt;/param-value&gt; &lt;/context-param&gt; </code></pre> <p>But this way is not suggested by authority. The jsf doc said that :<br/></p> <blockquote> <p>For a validator to be fully compliant with Version 2 and later of the specification, it must not fail validation on null or empty values unless it is specifically intended to address null or empty values. An application-wide is provided to allow validators designed for JSF 1.2 to work with JSF 2 and later. The javax.faces.VALIDATE_EMPTY_FIELDS must be set to false to enable this backwards compatibility behavior.]<a href="https://stackoverflow.com/questions/3933786/jsf-2-bean-validation-validation-failed-empty-values-are-replaced-with-las">1</a></p> </blockquote> <p>So as you are using jsf2.0, a another way to validate the empty value is that you can add do like this :<br/> <code>&lt;h:inputText value="#{PersonalInformationDataBean.fullName}" size="75" id="fullName" required="true" requiredMessage="Please enter name." &gt;</code> And also make sure the <code>web.xml</code>' setting as follows :</p> <pre><code>&lt;context-param&gt; &lt;param-name&gt;javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL&lt;/param-name&gt; &lt;param-value&gt;true&lt;/param-value&gt; &lt;/context-param&gt; </code></pre> <p>But this way will accuse another unreasonable thing.When you input the name will some thing and this form is failed for this sumbit.And user delete the name field's value to blank, it will will throw Please enter name message.But the name field in page is still the pre value(not blank).<br/> So it is a JSF bug.To fix this, you've to alter the first part of HtmlBasicRenderer#getCurrentValue(),Please take a look at this: <a href="https://stackoverflow.com/questions/3933786/jsf-2-bean-validation-validation-failed-empty-values-are-replaced-with-las">JSF 2 - Bean Validation: validation failed -&gt; empty values are replaced with last valid values from managed bean</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload