WebAnnotation2 (JEE)

Objective :

Step: 1 Start Net Bean

Step: Creating a new project : From file menu select "New Project".

a) choose a project type

b) Name and location

c) Server Settings

d) Selecting Framework

Now Finish to complete the wizard

The default template is loaded with built in JSTL tag

The codes created in web.xml would manage the runtime views over a browser. The Servlet class is "FacesServlet" and url-pattern is "/faces/", than servlet .

Step:  3 Now add a JSP page , as shown below

Now if you choose "XHTML" extension , you are creating a similar Facelets where direct Annotation is supported. FYI, Annotation is very similar to Preprocessor of C+/C# programming.

We would use JSF 2.0/JSP page to show the distinction between "Facelets" and "JSP" pages.

The default codes created by this wizard is shown below. The file will be compiled and can be viewed independently but can't be hyper linked

The default code generated by the wizared

Now when we run this file

Step: Separation between Facelets and JSP

Now let us run Index.xhtml

You may get this kind of response as shown below.

Now let us run the project.

Note the error at line 14, although the pages are technically well formed, but are disconnected from each other

Step:  Now add a JSP page and name it Page2.jsp

Note the regular tag library is not declared in Page2.jsp.

Edit index.xhtml and add a hyperlink to Page2.jsp

 

Phase II

Step:  Add a JSF managed Bean

Note that two annotated bean objects are added to this class.

Now add a Public String variable, as shown below.

Encapsulate and create a method that will support a read only property to the client.

The screen shot after using Refractor/encapsulating a field.

Add some values to the string-variable str1.

 

Step:  Now go back to the Web page and refer this to the pages.

index.xhtml

Step:  Adding Use Bean to Page2.jsp page ( A simple Java Server Page)

Fill out the boxes as indicted below

 

Run As a file

Step: Project Runtime

Using hyper link open Page2.jsp