• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

h:messages prints error message twice on first submit

 
Greenhorn
Posts: 4
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am new to JSF and I have been trying to solve this since a week now.

I am using <h:messages> to display on the top of the page, all the errors on the page.

Issue is when I submit the form for the FIRST TIME, a single error message gets displayed twice.
But when I submit the form again, the error message gets displayed just once which is what I want.

Can anyone please explain why <h:messages> is behaving like this.

Appreciate it. Thanks.
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post your page tags that are causing this?

You should be aware that there is an attribute specific to <h:messages> that is not available in the component-specific <h:message> tag: . This will display only messages that are NOT queued for a specific component. However, if you are not using this attribute, and you have component-specific messages as well, it will display both...once with the <h:message> tag, and once with the <h:messages> tag. I don't know if that's the problem, but I've had similar behavior caused by that default behavior.
 
Sagar Salimath
Greenhorn
Posts: 4
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tom,

I got the issue.
Issue was I had two messages. One tied to the component and the other one was not.
So, the one not tied with the component was a redundant code. How stupid of me

Regards,
Sagar
 
Tom Fulton
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"You learn how to avoid mistakes from experience. Unfortunately, you only gain experience by making mistakes".

I've done the same thing a number of times, often when I am copying code and adding some functionality. I don't carefully check to see if I am duplicating something that was already happening in the copied code.
 
Sagar Salimath
Greenhorn
Posts: 4
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very true Tom. . miss some take some and mistake some. part of learning

I have another one. Regarding jsfcljs.
Will post it if I am not able to resolve it .

Thanks.
Take care.
 
reply
    Bookmark Topic Watch Topic
  • New Topic