开发者

richfaces and displaying errormessages

开发者 https://www.devze.com 2023-01-25 21:35 出处:网络
<h:form id=\"userSettingsForm\"> <rich:messages> <f:facet name=\"errorMarker\"> <h:graphicImage value=\"/img/msgerror.png\" />
        <h:form id="userSettingsForm">
            <rich:messages>
                <f:facet name="errorMarker">
                    <h:graphicImage value="/img/msgerror.png" />
                </f:facet>
            </rich:messages>


     开发者_运维技巧       <h:outputText value="Description:" />
            <h:inputText label="Description:" id="description"
                value="#{userSettingsForm.instance.description}" required="true"
                size="5">
                <f:validateLength minimum="3" />
            </h:inputText>

            <a:commandButton value="Validate" />

        </h:form>

When an error occurs I see e.g. this: screenshot

How can I display the text "Description" in front of "Required field" ?

Like it is used on the richfaces demo page at richfaces demo page


Take a look at <rich:message> - it shows a single message.


I found out that I was missing something in my messages_en.properties file.

When I create one using seam setup the generated file contains e.g. this:

javax.faces.converter.IntegerConverter.INTEGER=Value is not a number javax.faces.component.UIInput.REQUIRED=Required field

When I add:

javax.faces.converter.IntegerConverter.INTEGER={2}: Value is not a number or javax.faces.component.UIInput.REQUIRED={0}: Required field

The field label is added in front of the message.

0

精彩评论

暂无评论...
验证码 换一张
取 消