Monday, September 3, 2012

How to show inline FacesMessage in page in Oracle ADF -

When we want to show any information , warning or error , we use FacesMessage Component. you can see on Show FacesMessage how we do this.
But sometimes we want to show Message in the same page, it means inside the page, In this tutorial we will see how to show Inline Message in ADF

FacesMessage look like this
Information Message Error Message Fatal Error Warning Message


But now we will use Inline Message, For this follow these steps

  • Create a Fusion Web Application
  • Now in ViewController create new Page
  • Now drop a button on page
  • Write this code on button ActionListener

  • public void showMessageButton(ActionEvent actionEvent) {
     FacesMessage msg=new FacesMessage("This is a FacesMessage that+ 
    "shows Fatal Error --JavaCup");
     msg.setSeverity(FacesMessage.SEVERITY_FATAL);
     FacesContext fctx=FacesContext.getCurrentInstance();
     fctx.addMessage(null, msg);
     }
    


  • Now It will work as FacesMessage, to show Message inside page you have to do some more
  • Drop a af:messages component on page from Component Pallette

  • af:messages
  • now select af:messages and go to property inspector and set Inline- true

  • Inline true
  • Now Run your page and click button it will look like this

  • InlineMessage
    Download Sample Application

No comments:

Post a Comment