Downloading and Installing NetBeans IDE

These instructions describe how to download and install NetBeans, a commonly used IDE for Java programming. Using an IDE means that you have all of the tools you need in one place (your "development environment") instead of having to organize things manually. Use the instructions in Step 2 to write a simple Java program called "Hello.java" and then compile and run it.

9. Developing and Deploying Web Application in NetBeans

9.5. Writing a Hello-world JSF 1.2 Web Application

Create a New JSF 1.2 Project

  1. From "File" menu ⇒ choose "New Project...".
  2. "Choose Project" ⇒ In "Categories", choose "Java Web" ⇒ In "Projects", choose "Web Application" ⇒ "Next".
  3. "Name and Location" ⇒ In "Project Name", enter "HelloJSF12" ⇒ In "Project Location", select a suitable directory to save your works ⇒ Check "Set as Main Project" ⇒ Next.
  4. "Server and settings" ⇒ choose your server, or "add" a new server ⇒ Next.
  5. "Frameworks" ⇒ Check "JavaServer Faces" ⇒ In "Libraries", "Registered Libraries", select "JSF 1.2" ⇒ Finish.
  6. A "WelcomeJSF.jsp" page is generated, as follows:
    <%@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>
    <%--
        This file is an entry point for JavaServer Faces application.
    --%>
    <f:view>
      <html>
        <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
          <title>JSP Page</title>
        </head>
        <body>
          <h1><h:outputText value="JavaServer Faces"/></h1>
        </body>
      </html>
    </f:view>    
    To run this page, right-click on the project ⇒ Run.

Create a new JSF 1.2 Page

  1. Right-click on the project ⇒ New ⇒ "Other..."
  2. "Choose File Type" ⇒ In "Category", select "JavaServer Faces" ⇒ In "File Type", select "JSF Page" ⇒ Next.
  3. "Name and Location" ⇒ In "File Name", enter "HelloJSF12" ⇒ In "Options", check "JSP File (Standard Syntax)" ⇒ Finish.
  4. In "HelloJSF12.jsp", enter the following codes:
    <%@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>
     
    <f:view>
      <html>
        <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
          <title>Hello JSF 1.2</title>
        </head>
        <body>
          <h1><h:outputText value="Hello World!"/></h1>
        </body>
      </html>
    </f:view>
  5. To execute the JSF page, right-click on the project ⇒ Run ⇒ Change the URL to http://localhost:8080/HelloJSF12/faces/HelloJSF12.jsp .