Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label SEVERITY_FATAL. Show all posts
Showing posts with label SEVERITY_FATAL. Show all posts

Tuesday 16 October 2012

ADF Basics: Show FacesMessage in Oracle ADF


How to use FacesMessage in ADF

FacesMessage is used to show confirmation, warning, information .In this tutorial, you will see that how to use FacesMessage to show any information, warning or any error. Suppose you want to show a confirmation when you save your records, here we use FacesMessage.

Managed Bean Code to use FacesMessage(Information)-



      FacesMessage Message = new FacesMessage("Record Saved Successfully!");   
      Message.setSeverity(FacesMessage.SEVERITY_INFO);   
      FacesContext fc = FacesContext.getCurrentInstance();   
      fc.addMessage(null, Message);   


To use for Error and Warning just change FacesMessage.SEVERITY_INFO to SEVERITY_ERROR or SEVERITY_WARN.
It will look like this



FacesMessage in Oracle ADF

You can change your Message accordingly


Monday 15 October 2012

ADF Basics: Show inline Message in Oracle ADF




When we use any technology sometimes we need to show an alert message or warning or confirmation.
In Oracle ADF we use Faces Message same as JSF.
In this tutorial I am showing you that how to implement inline FacesMessage .

Those who are familiar with Oracle ADF can create basic architecture of MVC.
So follow these steps

  • Create a Fusion Web Application in Jdeveloper(IDE)
  • Now in ViewController create new Page.
  • Simply drag a CommandButton from Component Palette to page
  • and Write this code on button




public void showMessageButton(ActionEvent actionEvent) {
 FacesMessage msg=new FacesMessage("This is an inline FacesMessage");
 msg.setSeverity(FacesMessage.SEVERITY_FATAL);
 FacesContext fctx=FacesContext.getCurrentInstance();
 fctx.addMessage(null, msg);
 }
  • It will work as FacesMessage
  • Now drag a af:messages component in page from Component Palette

    select af:message from component pallette

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

    Set inline true for af:message

  • Now run your page and click on button , it will look like this

    Inline Error Message Oracle ADF

  • This is how we show inline alert in Oracle ADF