February 27, 2013

Creating object to inner class in Java

I have a class definition like below and I want to create an object for the inner class.

class outerclass
    public class innerclass{

To create an object for the above innerclass, we should follow the below syntax.

outerclass.innerclass obj=new outerclass().new innerclass();

February 6, 2013

Data Source connection to AppModule

By default AppModule is configured to database through the connection created in JDeveloper. But if we want to change the connection type to “JDBC DataSource” from “JDBC URL”, it expects a Datasource name as an input. But we need to pass the JNDI name to this field instead of data source name.

How to display a message dialog on the JSF page

The below code will be used to display a message dialog on the JSF page.

        FacesContext facesContext = FacesContext.getCurrentInstance();
        FacesMessage facesMessage = new FacesMessage(message);
        facesContext.addMessage(null, facesMessage);

Where message is the message what we want to display on the dialog box and severity is to show the severity of the message. Example for severity is FacesMessage.SEVERITY_INFO which displays the dialog box as an information message. Inputs for severity is available in FacesMessage class.