Wed. Jan 26th, 2022

Requirement: I have a button with the name “Show Inline FacesMessage” on the ADF Page. Once the user clicks on the “Show Inline FacesMessage” button it should display an inline message as shown below:

Solution: For solution of the above requirement follow the steps as shown below:

Step 1: Create an Oracle ADF Fusion Web Application.

Create demo.jspx page inside the ViewController project.

Step 2: Drag and drop an af:button and text=”Show Inline FacesMessage”

Also set actionListener=”#{pageFlowScope.MyBean.showInlineMessageActionListener}”

Thus, the code for the demo.jspx page is as below:

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="" version="2.1" xmlns:f=""
          xmlns:af="">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
        <af:document title="demo.jspx" id="d1">
            <af:form id="f1">
                <af:button text="Show Inline FacesMessage" id="b1"
                           actionListener="#{pageFlowScope.MyBean.showInlineMessageActionListener}"/>
            </af:form>
        </af:document>
    </f:view>
</jsp:root>

And the complete code in the MyBean.java class is as below:

package susantotech.com;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class MyBean {
    public MyBean() {
    }

    public void showInlineMessageActionListener(ActionEvent actionEvent) {
        FacesMessage msg = new FacesMessage("This is an inline FacesMessage");
        msg.setSeverity(FacesMessage.SEVERITY_FATAL);
        FacesContext fctx = FacesContext.getCurrentInstance();
        fctx.addMessage(null, msg);
    }
}

Save all and run the application. Thus, the ran application is shown below:

Click on “Show Inline FacesMessage” button and we can see the message as below.

In the above output the message is displayed inside a dialog as a Faces Message. But my requirement is to display the message inline with the “Show Inline FacesMessage” button.

Hence, for that we have to do few addition changes.

So, let us drag and drop af:messages component in the demo.jspx page just after the “Show Inline FacesMessagebutton.

Set the inline property as true

Thus, the modified code for the demo.jspx page is as below:

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="" version="2.1" xmlns:f=""
          xmlns:af="">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
        <af:document title="demo.jspx" id="d1">
            <af:form id="f1">
                <af:button text="Show Inline FacesMessage" id="b1"
                           actionListener="#{pageFlowScope.MyBean.showInlineMessageActionListener}"/>
                <af:messages id="m1" inline="true"/>
            </af:form>
        </af:document>
    </f:view>
</jsp:root>

Save all and run the application. Thus, the ran application is shown below:

Click on “Show Inline FacesMessage” button and we can see the message as below.

Hence, the solution to the error.

If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.

Thanks & Regards,
Susanto Paul

 366 total views,  1 views today

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

Leave a Reply

Your email address will not be published. Required fields are marked *

satta king chart