Custom message with FacesContext.getCurrentInstance().addMessage is not displayed in page (JSF)
- by bblanco
Hi!
My page:
...
<div id="header">
<!-- content header -->
</div>
<div id="content">
<h:messages />
<h:ouputText value="#{example.text}" />
</div>
...
My managedBean:
public class ExampleManagedBean(){
private String text;
public String getText(){
FacesContext.getCurrentInstance().
addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_WARN,
"Warning message...", null));
return text;
}
public void setText(String text){
this.text = text;
}
}
My problem is that the warning message not is rendered in page. Why?