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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:17:29+00:00 2026-05-29T17:17:29+00:00

I am preparing a registration page using JSF/Spring webflow&mvc application. I have added two

  • 0

I am preparing a registration page using JSF/Spring webflow&mvc application. I have added two side validation one in client side every input fields has its own rich:message and other one at server side, registration bean response as facescontext.addMessage(). My problem when I try to test validation, rich:message components show errors correct but rich:messages show same errors as well. I want to use messages just for specific errors, something like mail already exist in database.

my rich:messages tag:

<rich:messages id="msg" layout="table" limitRender="true"
            style="font-weight:bold;color:#BDBDBD">
            <f:facet name="errorMarker">
                <h:graphicImage url="/images/messages_error.png" />
            </f:facet>
        </rich:messages>

<h:form ...>
   .....SOME LOGIC.....

<h:inputText id="i_ln" required="true" value="#{regBean.lastName}">
    <f:validateLength minimum="2" maximum="35" />
    <rich:ajaxValidator event="onblur" />
</h:inputText>
<rich:message for="i_ln">
    <f:facet name="errorMarker">
       <h:graphicImage url="/images/messages_error.png" />
    </f:facet>
</rich:message>
       .....
    </h:form>

I have checked similar issues that people advice to use globalOnly=”true” and when I use this attribute then duplicate validation stops but I am not able to add severity error. My oytput as below:

Feb 07, 2012 10:08:04 PM com.sun.faces.lifecycle.RenderResponsePhase execute
INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
sourceId=i_comment[severity=(ERROR 2), summary=(Eingabe wird benötigt.), detail=(Eingabe wird benötigt.)]
sourceId=i_title[severity=(ERROR 2), summary=(Eingabe wird benötigt.), detail=(Eingabe wird benötigt.)]
sourceId=i_salut[severity=(ERROR 2), summary=(Eingabe wird benötigt.), detail=(Eingabe wird benötigt.)]
sourceId=i_mobile[severity=(ERROR 2), summary=(Eingabe wird benötigt.), detail=(Eingabe wird benötigt.)]
sourceId=i_fax[severity=(ERROR 2), summary=(Eingabe wird benötigt.), detail=(Eingabe wird benötigt.)]

Another question is should I keep server side validation?

  • 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-05-29T17:17:32+00:00Added an answer on May 29, 2026 at 5:17 pm

    Ok here is a workaround:
    First of all its a known issue refer to jboss community:

    Hi guys,
    
    We investigated the issue further by debugging the RichFaces JavaScript code.
    
    We noticed that both the <rich:messages globalOnly="true" /> component and the <rich:message for="inputField" /> component bind to an "onMessage" event.
    
    When the event is triggered on tab, the "onMessage" function in "message.js.faces" is triggered for both components.
    
        As you can see in the attached screenshots the function is called twice: once for both components. Other <rich:message /> components which have a "for" attribute related to other fields are not triggered, just as expected.
        In the JavaScript code, we can see that a check is performed on the availability of the "forComponentId" attribute. If this attribute is available, a validation message is rendered for the specified component id. If this is not available, a global message is rendered.
        But when a global message is rendered, we cannot see any check on the globalOnly attribute. So any message is rendered, regardless of this attribute. The attribute is nowhere to be found in the JavaScript code.
    
        We were wondering if this is the bug or if there is an other piece of code that is responsible for checking whether only global error messages may be displayed?
    

    So I have played around with code and notice that rich:messages just picking messages when:

    1. if globalOnly=”true” and clientId is null or clientId is messages component id.
    2. if for=”xxx” attribute
      assigned and message has client&sourceID=”xxx”
    3. if no for=”xxx” and
      no globalOnly=”true” attribute assigned then any message also messages with
      the null client id.

    I was able to apply two solution for this:

    First solution for pages with just one rich:messages;

    My rich:messages tag just have globalOnly=”true” and there is no for attribute;

       <rich:messages id="msg" layout="list"
            style="font-weight:bold;color:#BDBDBD" 
            globalOnly="true">
            <f:facet name="errorMarker">
                <h:graphicImage url="/images/messages_error.png" />
            </f:facet>
        </rich:messages>
    

    And my bean send message with id=null;

    private void addSeverityError(String message)
        {
            FacesContext context = FacesContext.getCurrentInstance();
            FacesMessage fMessage = new FacesMessage();
            fMessage.setSeverity(FacesMessage.SEVERITY_ERROR);
            fMessage.setSummary(message);
            fMessage.setDetail("Validation error");
            context.addMessage(null, fMessage);
        }
    

    Second solution for pages with more than one rich:messages;

    I have added one hidden rich:message to use as a bridge, then my message can have hidden component id and will not be null, after I just pick it up by my rich:messages using this id.

    <rich:message id="nonExistClient" rendered="false"/>
    <a4j:form id="messagesForm">
        <rich:messages id="msg" layout="list"
            style="font-weight:bold;color:#BDBDBD" 
            for="nonExistClient">
            <f:facet name="errorMarker">
                <h:graphicImage url="/images/messages_error.png" />
            </f:facet>
        </rich:messages>
    </a4j:form>
    

    And I have added message as below via FacesContext:

    private void addSeverityError(String message)
    {
        FacesContext context = FacesContext.getCurrentInstance();
        FacesMessage fMessage = new FacesMessage();
        fMessage.setSeverity(FacesMessage.SEVERITY_ERROR);
        fMessage.setSummary(message);
        fMessage.setDetail("Validation error");
        context.addMessage("nonExistClient", fMessage);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building my first CodeIgniter app - and have a registration form. I'm using
I'm preparing my paypal system and have a separate page that forwards the user
My application is preparing a cover-sheet for submitting documents by fax. I identify the
Preparing for exam and got stuck at this question: Allowed operators are <<,+,& no
I'm preparing a set of reports using open source ReportLab. The reports contain a
I am preparing a script. I am using AJAX(load()) with jQuery. I am getting
CONTEXT: I am preparing a big C# merge using visual studio 2008 and TFS.
I'm preparing for a quiz, and I have a strong suspicion I may be
I'm preparing to the SQL Server exam (70-431). I have the book from Sybex
I am preparing to submit an app to the App Store and have come

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.