webtier@glassfish.java.net

Incorrect rendering of custom validation message

From: <webtier_at_javadesktop.org>
Date: Tue, 21 Sep 2010 12:36:01 PDT

My application using a custom validation method. The validation works and the message is presented, however not in the correct format. Rather then being wrapped inside a span with the specified (error) CSS class set, I am only getting the plan text without any style attached. The required message is presented using the correct style

I have defined the input component as follows:
[code]
<tr>
  <td colspan="2">
    <h:outputText value="#{faces_translations['Ingredients']}"/>
    <h:message for="ingredients" errorClass="error"/>
  </td>
</tr>
<tr>
  <td colspan="2">
    <h:inputTextarea id="ingredients" rows="15" cols="90" value="#{recipeController.recipe.ingredients}" required="true" requiredMessage="#{faces_translations['RequiredField']}" style="width: 100%;" validator="#{recipeController.validateIngredients}"/>
  </td>
</tr>
[/code]

And added the following validation code:
[code]
public void validateIngredients(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object object)
{
  IncredientParser parser = new IncredientParser();
  try
  {
    parser.parseIncredients((String) object);
  }
  catch (RuntimeException rte)
  {
    FacesMessage message = new FacesMessage("Invalid Ingredients : " + rte.getMessage());
    throw new ValidatorException(message);
  }
}
[/code]

Any suggestions why this does not work and what I can do to format my validation messages correctly.

Thanks in advance.
[Message sent by forum member 'lostinspace2011']

http://forums.java.net/jive/thread.jspa?messageID=483277