15 & 16. Java Learning: JavaServer Faces Technology (JSF), part – 3 – a rant

Here is a story about 15th and 16th hours. In this hour I have learnt about few basic HTML elements in JSF and how to pass control to Java code. How to show a message pop-up when a button is clicked, how to show List, Menu controls, Checkbox and Options.

Here is a one small application:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    This file is an entry point for JavaServer Faces application.
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>JSP Page</title>
            <h1><h:outputText value="JavaServer Faces"/></h1>
                <h:commandButton value="Click" action="#{Msg.plain}"/>

FileName: newclass.java

package newpackage;
import javax.swing.JOptionPane;
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * @author satya
public class NewClass {
    public String plain() {
        JOptionPane.showMessageDialog(null, "Plain Message", "PLAIN", JOptionPane.PLAIN_MESSAGE);
        return "success";


Added this much in the file:


F***king thing is the new dialog goes behind Main browser window and I keep on wondering what has happened. Got suggestion here that I need to use JDialog for this. I will see.

Comments are open for an year period. Please, write here on Facebook page.