i would like to know how i could present a message where after the client filled a form and pressed a button ‘Send message ‘, a message ‘Wait while we send your message’ could appear to him and then after present ‘Message delivered’, something like that.
If i could show some icon i think it would be cool too =)
I try this for now:
public void sendMessage() {
// .. my programming logic
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, null, "Message Delivered");
FacesContext.getCurrentInstance().addMessage(null, message);
}
Best regards,
Valter Henrique.
Something like this is pretty easy using the ajax status indicator of JSF2 component libraries (such as the Richfaces component a4j:status)
If you want to build this yourself, Jim Driscoll has a blog post on how to create an ajax status indicator with vanilla jsf2, and a little javascript.
One of the nice things about the a4j:stataus components, is that it can be nested within a component, to provide status updates tailored for that component. You would then send your message in an action method of a backing bean, initiated with an ajax call.