File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes How To Remove the Faces Messages in Form of JSf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How To Remove the Faces Messages in Form of JSf" Watch "How To Remove the Faces Messages in Form of JSf" New topic
Author

How To Remove the Faces Messages in Form of JSf

Sreekanth Kalakanti
Greenhorn

Joined: Sep 09, 2009
Posts: 12

Hi Guys,
I developed an application using JSF1.2,In a form named register.jsf Some mandatory fields are there like MobileNo,FirstName,LastName i.e required="true" is set for all these fields and a Submit Button.

When i click the Submit Initially i am getting all the Messages for Mandatory fields. To My requirement i need to remove all the Messages at certain point of Time.

so I tried to removed all the FacesMessages in a form using the below Code in My backing bean :

for (Iterator<FacesMessage> iter1 = context.getMessages(null); iter1.hasNext();)
{
iter1.remove();

}
but i not able to get Succeed with the above code.so I need the solution to remove all the FacesMessages in a form.

Regards,
Sreekanth
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

Welcome to the JavaRanch, Sreekanth!

I'm not sure I understand. The FacesMessage object is re-created (empty) every time you make an HTTP request on a JSF page view. So only the items which have offended the current page request should be appearing. That's usually what you'd want to do.


Customer surveys are for companies who didn't pay proper attention to begin with.
inora kumar
Greenhorn

Joined: Apr 14, 2011
Posts: 5
Hi

I am also facing the same problem, I want to clear the message appearing through <h:message> tag.

FacesContext.getCurrentInstance().getMessages() comes empty only.

I want to clear the messages on success of ajax call.

Sorry for bringing the old post.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How To Remove the Faces Messages in Form of JSf
 
Similar Threads
Rearrange Order of Messages in FacesMessages
JSTL and facesmessages
FacesMessages
FacesMessages and valueChangeListener with immediate="true"
Validation messages - FacesMessages