Front-Page my templates (JEE)

Objective

Read more about Java Server Face and Servlet at http://download.oracle.com/docs/cd/E17410_01/javaee/6/tutorial/doc/bnafd.html

Step: 1 Servlet Retrospectives :

Looking back To Servlet

Step : 1.1: With NetBean 6.0 and Tomcat 6.0 combination

Below shows the downloaded additional plugins

Step : 2 Understanding JSP and JSF in Parallel

Creating Servlet series using Java-Server-Faces or JSP

  • Event handling is done differently in JSP (HTTP) and JSF (Java)
  • With JSP we use mark-up and should be run in JSP enabled server
  • JSF in contrast would use prebuilt components, like aps.net
  •  If you are in this vacuum here are some key points promoting JSF:
    1. Fundamental unit is the Component
    2. Built in event and state management
    3. Component sets can be provided by any vendor
    4. Closer to ASP.Net or Swing development
    5. Choice of UI technology
    6. Scale up (rich clients)
    7. Scale down (mobile devices)
    8. Built into J2EE containers in J2EE 5.0 (tentative)
  • See in this link NB_WebApplication3.htm
     
  • Java Server Faces (JSF) = quick view with NetBean 6.0

     

  • Quick Look  at (Java Server Pages) JSP : is more of HTML

    Coding type in Java Server Pages

    Below shows the ASP.Net Control

Step: 3 Example :  Create a new web-application-project

First look of Page1.jsp

Now let us Create a JSP page and a Servlet page

Path : C:\NetBean60\ServletContainer\ex1\SrvContainer1\web\index.jsp

First look of index.jsp

Note the differences

Step: Showing Palette

The mark-up available with JSP pages

Controls available with JSF, the scope of these controls are almost endless and be discussed in context of Java Server faces

 

Step:  Add a Servlet to this page

The above action will generate additional folders, as indicated with the package name

C:\NetBean60\ServletContainer\ex1\SrvContainer1\src\java\srvcontainer1\ex1\ServletResponse1.java

Now Click Next on the wizards pane

Note the imported api (If you are anxious to see the code follow the ink ServletResponse1.java.txt

parameters requested

Unmark the comments, compile and run  http://localhost:8080/SrvContainer1/ServletResponse1 ( the same computer ); for the intranet users http://manas2:8080/SrvContainer1/ServletResponse1 to runt the Servlet.

 

Step: Back to JSF and JSP containers

Adding a Label and Hyperlink Page1.jsp

Now Let us edit the label Test

We would cover the controls with all details, here just to compare Java Server Faces, Java Server Page and (not forgotten) Servlet, visually, the code in Java Server Face Pag1.jsp was edited,; as shown below.

Style-sheet used

Now let us Run again http://manas2:8080/SrvContainer1/  or

That will load ServletResponse1 , as shown below.

Pag1.jsp is default page over index.jsp ; you have to call sepecifically

http://manas2:8080/SrvContainer1/index.jsp

<%--
Document : index

--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>JSP Page</title>
</head>
<body>
<h2>Hello World!</h2>
<a href="http://manas2:8080/SrvContainer1/ServletResponse1"> Call SrvContainer1 </a>
</body>
</html>
 

Step:

Step:

Step:

Step:

Step: