FacesMessage not displaying after validation via form submission
asookazian Jul 16, 2009 1:15 AMI have a xhtml/JSF page in which the validation is working and displaying on AJAX submission (onblur for HtmlInputText) and is working but not displaying when I click submit button (HTTP POST).
I am seeing the following in the console in the 2nd case:
16:06:49,151 INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed. sourceId=mainForm:findingCode1:_findingCode1[severity=(INFO 0), summary=(invalid value), detail=(invalid value)]
What must I do to get the invalid value
text to display next to the field like in the AJAX onblur case?
After submission of the form, error text is not displaying even though the ValidationException is thrown from the Validator class.
.xhtml:
<tr> <th align="left" width="50%"><h:outputText value="Problem Code 1: " /></th> <td align="left" width="50%"><a4j:region id="fcRegion1"> <s:decorate id="findingCode1" template="layout/edit.xhtml"> <h:inputText id="_findingCode1" value="#{createRepairCase.findingCode1}" validator="seamValidatorCodes"> <a4j:support event="onblur" reRender="findingCode1" bypassUpdates="true" eventsQueue="myQueue" requestDelay="200" ignoreDupResponses="true" oncomplete="setFocusFindingCodes();" /> </h:inputText> <a4j:status id="s4" for="fcRegion1"> <f:facet name="start"> <h:graphicImage value="/img/spinner.gif" /> </f:facet> </a4j:status> </s:decorate> </a4j:region></td> </tr>
SeamValidatorCodes:
@Name("seamValidatorCodes") @Scope(ScopeType.CONVERSATION) @org.jboss.seam.annotations.faces.Validator public class SeamValidatorCodes implements javax.faces.validator.Validator, java.io.Serializable public void validate(FacesContext context, UIComponent cmp, Object value) throws ValidatorException { if (!validateCodes(code)) throw new ValidatorException(new FacesMessage("invalid value")); }
in both cases (onblur AJAX or form submit), the ValidatorException is being thrown.
backing bean:
@Stateful @Name("createRepairCase") @SuppressWarnings("unchecked") public class CreateRepairCaseAction implements CreateRepairCaseLocal { public String submit(){ .... entityManager.flush(); ..... return "/RepairCaseDetails.xhtml"; //this is the next page in the page flow of the use case }