Sat. Dec 4th, 2021

Explanation: FacesMessage represents a single validation (or other) message, which is typically associated with a particular component in the view. A FacesMessage instance may be created based on a specific messageId. The specification defines the set of messageIds for which there must be FacesMessage instances.

FacesMessage is used to show confirmation, warning, information.

Requirement: I have a demo.jspx page. On that page I have a button with the name as Show ADF FacesMessage. Now, on click of the Show ADF FacesMessage button it show opens an ADF FacesMessage window displaying the message as “FacesMessage shown Successfully!

The look and feel of the default FacesMessage box is shown below:

Now, the requirement is to hide the icon and the title of the above FacesMessage dialog. Sample output is shown below:

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

Step 1: Create an ADF Fusion Web Application. Create a demo.jspx page. On that page have a button with the name as Show ADF FacesMessage.

Step 2: Create an actionListener with the name as showFacesMessage for the Show ADF FacesMessage button. The name of the bean is MyBean.java

Thus, the complete code for the demo.jspx is shown 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 ADF FacesMessage" id="b1" actionListener="#{MyBean.showFacesMessage}"/>
            </af:form>
        </af:document>
    </f:view>
</jsp:root>

Step 3: Write the below code for the actionListener that is for the showFacesMessage method.

Thus, the complete code for MyBean.java is shown below:

package com.susanto;

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

public class MyBean {
    public MyBean() {
    }

    public void showFacesMessage(ActionEvent actionEvent) {
        FacesMessage Message = new FacesMessage("Testing FacesMessage, This is sample Message");
        Message.setSeverity(FacesMessage.SEVERITY_INFO);
        FacesContext fc = FacesContext.getCurrentInstance();
        fc.addMessage(null, Message);
    }
}

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

Now, click on the Show ADF FacesMessage button and we can see the FacesMessage as shown below:

Now, as per the requirement we have to hide the icon and the title from the above FacesMessage dialog.

Step 4: Now, we have to create Skin in the ViewController project. For that right click ViewController project > New > From Gallery

Select ADF Skin (JSF/Facelets) > Click OK

Step 5: Provide the File Name, Directory, and the Family.

Click Next.

Step 6: Select alta-v1.desktop > Click Finish

Step 7: Open skin1.css and write the below CSS code.

af|dialog::header, af|dialog::header-end, af|dialog::header-start {
    display: none;
}

Save all and run the application. Now, click on the Show ADF FacesMessage button and we can see the FacesMessage as shown below:

If we notice in the below FacesMessage Dialog, we can no longer see the icon and title.

Hence, the solution to our requirement.

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

 574 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