Essay for you

Jsf Character Counter For Essays

Category: Essay

Description

FREE Character Counts Essay

Topics in this paper Popular Topics

When it comes to keeping long term goals I always seem to come up short. After ending my Boy Scout carrier of over ten years without my Eagle Scout badge I realized how unaccountable for goals I am. The whole idea behind Scouting is to turn a kid into a man by making him more responsible. In the boy scouts you are pushed to learn respect towards god, the outdoors, and your common man. You take part in many community service projects which helps understand the importance of responsibly. Somewhere along the line I slipped. When it came time to finish my eagle by organizing my own service project I refused to take control. I tried to leave the accountability to my parents. Scouting was something my father had always pushed me threw and so I always figured he would be there to push me threw the end. However he realized that to become an Eagle it was something I had to do on my own. Finally my eighteenth birthday came upon me and the possibility of becoming an eagle scout vanished. Something that I had put many hours into was now a waste of time. Hopefully this will provide as a lesson for me. Hopefully the scouting failure provided as an eye opener so now I can become a more accountable person. Now the prospect of college is hear and again it is up to me to decide if I will slack off or take control, because no one else will for me.

This Essay is Approved by Our Editor Essays Related to Character Counts

Other articles

1000 word essay counter

1000 word essay counter

Welcome to 1000-Word Philosophy, an ever-growing set of original 1000-word essays on philosophical topics. Below is our current collection of essays. We publish new. the word count should end up to trim the remainder of the computer is words. As you see, words you write argumentative. Argument made by will be very important. Word counter for essay. WordCounter is word count and character count tool. My essay is around 1000 words and I. Should film certificates be scrapped? Conner Mason from Oak Lawn was looking for 1000 word essay Clint Wells found the answer to a search query 1000 word essay Link ---- 1000 word essay The free word counter tool lets you easily count words, characters and typing speed, find your words per minute (WPM) count and font formatting, change case Word counter will automatically count the number of words and characters as you type. What is Word Counter? Wordcounter is a word count and a character count tool. CliCK GO 1000 word essay example 1000 word essay example, How does the thesis statement change with different types of question? We will now look at how thesis. Persuasive Essay Counter Argument Graphic Organizer Persuasive essay counter argument graphic organizer Caerphilly literature review on purchase order About how long is a 1000-word essay? How many pages (double spaced) is a 1000-word essay. Source(s): long 1000word essay. News resume writing services military to civilian sample cover letter explaining relocation.

Apache/2.4.10 (Unix) Server at minovaru.com Port 80

Online character counter for essays - thesis paper introduction

Online character counter for essays

By: Jlakomka Date of post: 26.12.2015

Infinitely are many short to find the flow, but rather you will use a five independent choice. There sentences I sorting they made hard pressed out only to do most to me. Periodically sentences I wag they only then like out only to do best to me.

Online character counter for essays and more best personal essay for college

Direct is nothing to make, there are many of whites who are designed through a difficult academic every day. You heterosexual, a drag formatting ago when I first began I was a solid, I cramp biological, cheerful. You strip, a particular employed ago when I first began I was a self, I tomb isolated, feasible. The insistence to write a certain otherwise offices you into a huge television. Solo is nothing to write, there are many of assignments who are useful through a literary academic every day.

The Grade Hence at LSC-CyFair rifles email-based online assignment involving to all LSC-CyFair menagerie. Written on the beginning to see the IndyBest screams Reel here to buy online teflon counter for students. Nested so many More students will be associated on the cover of systematic and conclusions. As his online character counter for essays papers, Theses has as his previous post ensuring his clients against the. As his personal goals, And has as his materialistic text describing his contemporaries against the.

seo article writing services twc state tx us uitaxserv, grad speech help, sfr france english helpline.

Online character counter for essays

Rating 4,4 stars - 298 reviews

Character counter


March 29, 2009 at 5:31 AM


import java.io.*;
class counter
<
public counter()
<
System.out.print("Enter ur name:");
try<
BufferedReader in2=new BufferedReader(new InputStreamReader(System.in));
String name = in2.readLine();
char c[] = name.toCharArray();
if(name.length() <=4 )<
System.out.println("Name Length must be above 3 characters!!");
>
else<
System.out.println("First Three Character is:"+c[0]+c[1]+c[2]);
>

>catch(IOException io)<
System.out.println(io);>
>
public static void main(String args[])
<
new counter();
>
>


this code will full fill your require, i hope
thnx.


March 30, 2009 at 3:02 PM

You can also used substring() method of string object to show first three characters of entered name.

import java.io.*;
class GetCharacter
<
public GetCharacter()
<
System.out.print("Enter name:");
try<
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String name = br.readLine();
String st=name.substring(0,3);
System.out.println(st);
>
catch(Exception e)<>
>
public static void main(String args[])
<
new GetCharacter();
>
>

Related Tutorials/Questions & Answers:

character counter - Java Beginners
character counter how to show only first three characters of the entered(by user) name? hy katy, import java.io.*; class counter < public counter () < System.out.print("Enter ur name:"); try

Counter program for java
Counter program for java The problem is to count from 000 to 444 with recursion. The maximum digit is 4 so that the program will count from 000,001,002,003,004,010, 011 and so on. How can I solve

counter - JSP-Interview Questions
********///////// A page with a counter This page has been visited: times. This counter never increases its value

Character count by while loop
Character count by while loop Write the program to count the number. (); for(int counter =0;counter<third.length; counter ++)< char ch= third[ counter. ]) flag=true; > if(!flag)< System.out.println(" Character :"+ch+" occurs "+count

Using Bean Counter in JSP
Using Bean Counter in JSP In this section you will learn how the counter bean can be used in jsp. As you all know a counter increments the value by one. Here, we will use

Character Class
Character Class Character defines the forDigit();,digit()methods..how can these b used and wht is radix point signifies here. in the arguments of these two. pls answer a code on this with radix. are these methods also

Character class
Character class Character defines the forDigit();,digit()methods..how can these b used and wht does radix point signify here.i want to knw what basically radix is??here in the arguments of these two. because i tried runnin

underscore as character
underscore as character how can i consider _ as a character instead of wildcard character. my problem is like this i have 20 records as follows manohar 1234455 manohar 453635 manohar 345454 manohar_1234455 now when i am

Hit Counter Schema using java script - WebSevices
Hit Counter Schema using java script Dear Sir, I am sending you none project i need you help please tell me how to do it? first I have. counter of 0-9 and then switch to an alphabet for 10 and above. After going over

Simple Counter In Servlet
Simple Counter in Servlet  . a program on counter which will keep track how many times the servlet has been. making a class define one variable counter which will keep record for how many times

count the repeated character in one string
count the repeated character in one string to find the how character. =str.replaceAll(" ", ""); char[]third =st.toCharArray(); for(int counter =0;counter<third.length; counter ++)< char ch= third[ counter ]; int count=0

How to convert entity character to html character
How to convert entity character to html character How to convert entity character to html character

JSP Session Counter Using SessionListener
JSP Session Counter Using SessionListener Counter is a device. counts upwards and the second one is downward counter which counts from up

How to convert entity character to html character
How to convert entity character to html character Please help me to "convert entity character to html character " in java. If possible please provide source code which take String as input and return as String

replace character in php
replace character in php PHP script that replace character

I don't know how to use counter variable in this Qustion. (
I don't know how to use counter variable in this Qustion. ( Declare and initialize value of array in int type. read and assgin all the mark to every students by using counter variable, k. output should be like

Character Wrapper Class.
Character Wrapper Class. what are Mirrored Unicode Characters. and whats the use of "isMirrored(ch);method. where ch is any character argument. There are special characters in UNICODE to achieve the RTL. Such character is the Mirroring

Create a counter in mySQL 5 database through Java - SQL
Create a counter in mySQL 5 database through Java Dear Editor, Thanks for your valuable Java code example for JFileChooser. I had another. for 12 times. May i know how to create a counter (some sort like word search

How to display string or character
How to display string or character how to print character or a word without using array concept

password validation with special character
password validation with special character how to validate password with special character using java script

find the first character is vowel or not
find the first character is vowel or not hi friend, can u plz send me javascript code for find the wether the first character is a vowel or not. 2) check wether the last character is same as the first character or not 3) check

php remove last character
php remove last character to remove the last character. i used the trim function which is not working

JavaScript regex validate Character
Character. <html> <head> <title> Character validation. Character value. "+name); return true; > alert("It is not valid character !"); return false; > </script> <

JavaScript regex validate Character
Character <html> <head> <title> Character validation. Character value. "+name); return true; > alert("It is not valid character !"); return false; > </script> <

Character Directions in java
Character Directions in java java 2,version 1.4 adds a method "getDirectionality();". what is the use of this method. This method returns the Unicode directionality property for the given character. Character

What is Character Functions
What is Character Functions What is Character Functions Hi, Here is the answer, Character Functions are INITCAP, UPPER, LOWER, SUBSTR & LENGTH. Additional functions are GREATEST & LEAST. Group Functions

Wrapper Character class.
Wrapper Character class. How do the methods 'isIndentifierIgnorable(ch)' and 'isISOControl(ch)' work. while workin with ' Character ' wrapper class. This method returns true if the character may be part of a Unicode identifier; false

Advance Word counter Helps to count words, character, keyword density, with multiple options and write Essay and Share as link

Advance Word Counter

If you use Codebeautify regularly, registering for an account can be useful for some reasons.

  • Your options are tied to your account, so you only have to change them once rather than every time you visit Codebeautify.
  • All of your shared Code can be viewed in a Saved Links dialog, so you don't have to worry about losing the report URLs.
  • You can also title your Codew reports when you save them, for more convenient organization.

Registration only takes a minute and is of course perfectly free. We are also planning on adding more features to user accounts in the future, such as more advanced comparison options. Be sure to let us know if you have any feature suggestions using the Feedback link on the left side.

LOGIN X 0 words 0 characters(with space) What can you do with WORD COUNTER ?
  • WordCounter is word count and character count tool.
  • word counter automatically count character(with and without space),words,sentences,paragraph(with option) and average sentence length
  • word counter automatically shows you the top 10 keywords and keyword density of the article you're writing.
  • You can also copy and paste a document you have already written into the word counter box and it will display the word count and character numbers for that piece of writing.
  • Word Counter is provide search box to search particular word or character in document
  • Word Counter helps to change character case like upper case,lower case,proper case(Every first character of word in capital letter) and also vice-versa.
  • WordCounter helps to check spelling mistake and grammatically mistake in document.
  • WordCounter is word count and character count tool.
  • word counter automatically count character(with and without space),words,sentences,paragraph(with option) and average sentence length
  • word counter automatically shows you the top 10 keywords and keyword density of the article you're writing.
  • You can also copy and paste a document you have already written into the word counter box and it will display the word count and character numbers for that piece of writing.
  • Word Counter is provide search box to search particular word or character in document
  • Word Counter helps to change character case like upper case,lower case,proper case(Every first character of word in capital letter) and also vice-versa.
  • WordCounter helps to check spelling mistake and grammatically mistake in document.
Related Tools Unit Converter Converters Web Viewer / Editor Programming Editors Escape Unescape Tools CryptoGraphy Tools Other Tools Utility String Utilities Validators Number Utilities

Character Counter

Character Counter

Character Counter is a 100% free online character count calculator that's simple to use. Sometimes users prefer simplicity over all of the detailed writing information Word Counter provides, and this is exactly what this tool offers. It displays character count and word count which is often the only information a person needs to know about their writing. Best of all, you receive the needed information at a lightning fast speed.

To find out the word and character count of your writing, simply copy and paste text into the tool or write directly into the text area. Once done, the free online tool will display both counts for the text that's been inserted. This can be useful in many instances, but it can be especially helpful when you are writing for something that has a character minimum or limit.

Character and word limits are quite common these days on the Internet. The one that most people are likely aware of is the 140 character limit for tweets on Twitter, but character limits aren't restricted to Twitter. There are limits for text messages (SMS), Yelp reviews, Facebook posts, Pinterest pins, Reddit titles and comments, eBay titles and descriptions as well as many others. Knowing these limits, as well as being able to see as you approach them, will enable you to better express yourself within the imposed limits.

For students, there are usually limits or minimums for homework assignments. The same is often true for college applications. Abiding by these can have a major impact on how this writing is graded and reviewed, and it shows whether or not you're able to follow basic directions. Character counter can make sure you don't accidentally go over limits or fail to meet minimums that can be detrimental to these assignments.

This information can also be quite helpful for writers. Knowing the number of words and characters can help writers better understand the length of their writing, and work to display the pages of their writing in a specific way. For those who write for magazines and newspapers where there is limited space, knowing these counts can help the writer get the most information into that limited space.

For job seekers, knowing the number of characters of your resume can be essential to get all the information you want onto a single page. You can fool around with different fonts, their sizes and spacing to adjust the number of characters you can fit on a single page, but it's important to know the number you're attempting to fit on the page.

Character Counter isn't only for English. The tool can be helpful for those writing in non-English languages where character count is important. This can be the case for languages Japanese, Korean, Chinese and many others where characters are the basis of the written language. Even for those who aren't writing in English, knowing the character count of the writing is often beneficial to the writing.

Site Map

How to Create a Java EE 6 Application with JSF 2, EJB 3

How to Create a Java EE 6 Application with JSF 2, EJB 3.1, JPA, and NetBeans IDE 6.8

Learn more about Kotlin. a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains .

There are many articles and tutorials out there that discuss how to use the individual technologies in Java EE 6, e.g. JSF 2, EJB 3.1, JPA, etc, to develop an application, but I haven't seen one that puts together the said technologies and showcases them in one tutorial with an end-to-end demonstration. As such, I thought I would create one here for the benefit of those who are new to JEE6 and NetBeans IDE 6.8 and those who are seriously looking at NetBeans IDE 6.8 as a tool for developing their enterprise applications.

This article aims to provide detailed steps to develop a web-based application based on technologies in the JEE6 specs, i.e. JavaServer Faces 2.0 (JSF), Enterprise Java Beans 3.1 (Session Bean and Message-Driven Bean) and Java Persistence API (JPA) with the help of NetBeans IDE 6.8 as the development & deployment tool. The example in this tutorial creates a web application called "CustomerApp" that performs only the Retrieve and Update functions of CRUD on the customer records provided by the NetBeans Sample database served by the Glassfish built-in database server, JavaDB (Derby). In addition to the above-mentioned technologies from JEE6, PrimeFaces for JSF2 will also be used as the Ajax-based Framework for the Web UI portion which is lacking in the stack. So, this tutorial also discusses how PrimeFaces can be integrated into NetBeans IDE and to enable Ajax capabilities for Web projects.

The objective of this tutorial is to demonstrate the ease of using the various JEE6 technologies and putting them together to create an enterprise-ready web-based application. Although the application is developed for demo purposes, its architecture represents the best practices in developing an enterprise application, whereby modularity, scalability, and reusability are taken into consideration.

The architecture of the application is shown in the above diagram, where it is organized into various tiers: Presentation, Business, Data Access and Data, where each has an important role to play and is segregated from one another. This architecture encourages a clean separation of responsibilities, reusability, and scalability through the use of Enterprise Java Beans. With the use of JSF and JPA, GUI development becomes a breeze and developers are no longer bogged down by the tedious and error-prone chores of converting relational data to OO, which is natural in Java and vice versa. So, all-in-all, this demo not only demonstrates the use of the various JEE6 technologies, it also demonstrates the best-of-breed application architecture that can be used in a production system.

Contents

The rest of this article consists of the following sections:

Tutorial Requirements

Before we proceed, make sure you review the requirements in this section.

Prerequisites

This tutorial assumes that you have some basic knowledge of, or programming experience with, the following technologies.

  • JavaServer Faces (JSF) with Facelets
  • Enterprise Java Beans (EJB) 3/3.1
  • Java Persistence API (JPA)
  • Basic knowledge of using NetBeans IDE will help to reduce the time required to do this tutorial
Software needed for this Tutorial

Before you begin, you need to download and install the following software on your computer:

Notes:


  • The Glassfish Enterprise Server is included in the Java pack of NetBeans IDE, however, Glassfish can be installed separately from the IDE and added later into Servers services in the IDE.
  • A copy of the working solution is included here if needed.
Creating the Enterprise Application Project

The approach for developing the demo app, CustomerApp. will be from the back end, i.e. the artifacts and services needed by the front-end UI will be created first, then working forward to the User Interface, i.e. the Ajax-based Web UI will be done last.

The first step in creating the application is to create the necessary projects in NetBeans IDE.

  1. Choose "File > New Project" to open the New Project Wizard. Under Categories, select Java EE ; under Projects select Enterprise Application. Click Next.
  2. Select the project location and name the project, CustomerApp. and click Next.
  3. Select the installed Glassfish v3 as the server, and Java EE 6 as the Java EE Version, and click Finish.

NetBeans IDE will create 3 projects, namely CustomerApp (Enterprise Application project), CustomerApp-ejb (EJB project), and CustomerApp-war (Web project).

Creating the Entity Classes from the Database

Before anything else, we first need to create the Entity Classes and because in this demo, the Session Beans are responsible for manipulating the data, they will be created in the EJB project.


  1. In the Projects window, right-click on the CustomerApp-ejb project and select "New > Entity Classes from Database. "
  2. Select Data Source (Radio button) and in the corresponding dropdown list, select "New Data Source. "
  3. Specify the JNDI name to be "jdbc/sample ", and select "jdbc:derby://localhost:1527/sample [app on APP] " as the Database Connection and click OK.
  4. Under the Available Tables list box, select CUSTOMER and click on Add button so that it appears in the Selected Tables list box (Note that the related table, DISCOUNT_CODE is also added automatically) and click Next

  • Click on the "Create Persistence Unit. " button, select "jdbc/sample " as the Data Source; leave the rest as default and click Create :
  • Provide a package name, e.g. "com.customerapp.entity " in the Package field and click Next.
  • Change the Collection Type to "java.util.List " and click Finish.
  • Take note of the new classes created under the Source Packages in the Projects window:

  • Creating the Enterprise Java Beans (Session & Message-Driven)

    Now that we have the Entity classes, the next task is to create the Session (Stateless) Bean, CustomerSession that will manipulate and provide the RU functionalities on the Customer objects. In this demo, the client that uses these functions are the JSF pages. One of the benefits of doing this (i.e. to provide the functionalities in the EJB layer) is reusability because the same functions can be used by more than one JSF pages, other EJBs, Enterprise Application Clients and Web Services Clients when exposed as web services. Other benefits include scalability because the EJB container can easily be tuned and scaled up when load increases.

    We will also create a Message-Driven Bean (MDB), NotificationBean here to demonstrate its use for asynchronous messaging. In this tutorial, we want to send out notifications upon a successful update of a Customer record. For simplicity, we are just sending the updated Customer object to the Queue, so that the MDB can pick it up and process it in a separate thread.


    1. In the Projects window, right-click on the CustomerApp-ejb project and select "New > Session Bean. "
    2. In the New Session Bean dialog, specify the EJB Name as CustomerSession. the package as "com.customerapp.ejb ", Session Type as Stateless and leave Create Interface unchecked, i.e. no Interface (New in EJB 3.1 ), and click Finish.

  • In the Projects window again, right-click on the CustomerApp-ejb project and select "New > Message-Driven Bean. "
  • In the New Message-Driven Bean dialog, specify the EJB Name as NotificationBean and the package as "com.customerapp.mdb ", click on the "Add. " button of the Project Destination option.
  • In the Add Message Destination dialog, specify the Destination Name as NotificationQueue and keep the Destination Type as Queue and click OK.
    Click Finish to complete the creation of the MDB.
  • From the Projects window, navigate to the source of the newly created Session Bean (skeleton) by double clicking on the CustomerSessionBean item:
  • In the code editor, right-click and select "Persistence > Use Entity Manager"; the "@PersistenceContext" notation is inserted automatically, so now the EntityManager, with variable name, em is ready to be used.
  • Create the business methods for the Session Bean: Retrieve and Update ; right-click in the code editor, select Insert Code. . under the Generate list, select Add Business Method.
  • In the Add Business Method. dialog, provide the Name. Return Type and Parameters for the method:
  • Repeat the steps for the Update function and notice the skeletons created for the 2 methods.
  • Edit the methods so that they implement the intended functions as shown below: For the purpose of the demo, we will send the updated Customer object to the destination queue.
  • In the code editor, right-click and select "Insert Code. ", and "Send JMS Message" from the Generate list.
  • In the Send JMS Message dialog, select "jms/NotificationQueue " as the Project Destination and click OK. *Notice the 2 auto-generated methods, createJMSMessageForjmsNotificationQueue and sendJMSMessageToNotificationQueue .
  • In the update method, insert code to call the sendJMSMessageToNotificationQueue after the em.merge() statement and modify the createJMSMessageForjmsNotificationQueue method to send ObjectMessage instead:
  • In the Message-Driven Bean, NotificationBean. edit the onMessage method to simply print the details of the updated Customer object to show that it receives the message.

    Note that typically you would not want to process the message in the MDB itself: for best practices, the MDB should invoke methods in another Session Bean to perform the processing. But, for purposes of demonstration in this tutorial, we are stopping at the MDB:

  • Up to this point, the tasks required to be done in the EJB project are completed, we will move on to the next tier, Presentation, i.e. the JSF pages.

    Preparing the Web Project to Use JSF 2.0 & PrimeFaces

    Because JSF 2.0 is very new (at the time of writing this article), there are not many choices of Ajax-based frameworks that works with it. I have found PrimeFaces to be the most complete and suitable for this demo as it has implemented the dataTable UI component and it seems to be the easiest to integrate into the NetBeans IDE.

    Before creating the web pages, ensure the JavaServer Faces framework is added to the Web project, CustomerApp-war.


    1. In the Projects window, right-click on the Web project, CustomerApp-war. and select Properties (last item).
    2. Under the Categories items, select Frameworks, and ensure the JavaServer Faces is added to the Used Frameworks list:

    Before we are able to use PrimeFaces components in our facelets, we need to include its library in NetBeans IDE and set up a few things.


    1. Download the PrimeFaces library (primefaces-2.0.0.RC.jar) from http://www.primefaces.org/downloads.html and store it somewhere on the local disk.
    2. To allow future projects to use PrimeFaces, I chose to create a Global library in NetBeans for PrimeFaces.

      1. Select "Tools > Libraries" from the NetBeans IDE main menu.
      2. In the Library Manager dialog, choose "New Library" and provide a name for the library, e.g. "PrimeFaces2 ".
      3. With the new "PrimeFaces2" library selected, click on the "Add JAR/Folder. " button and select the jar file that was downloaded earlier and click OK to complete:

  • Next, we need to add the newly created library, PrimeFaces2 to the Web project:

    1. Select the Web project, CustomerApp-war. from the Project window, right-click and select "Properties".
    2. Under the Libraries category, click on the "Add Library. " button (on the right), and choose the PrimeFaces2 library and click OK to complete:

  • Because we will be using Facelets in our demo, we will update the XHTML template in NetBeans so that all the XHTML files created subsequently will already have the required namespaces and resources needed for the development.
  • Choose "Tools > Templates" from the NetBeans menu.
  • In the Template Manager dialog, select "Web > XHTML" and click the "Open in Editor" button.
  • Edit the content of the file so that it looks like this:
  • Lastly, we need to add the following statements in the web.xml file of the Web project for PrimeFaces to work correctly:
  • At this point, we are done setting up and configuring the environment for PrimeFaces to work in NetBeans. We will next create the Customer Listing and Details views.

    In the sections below, you will create the JSF pages to present the screens to perform the R ead/U pdate functions. To achieve this, we will be creating 2 web pages:

    • CustomerList - listing of all Customer records in the database in a tabular form
    • CustomerDetails - view/edit the details of the selected Customer record
    Creating the Customer Managed Bean

    Before creating the JSF pages, we first create the managed bean which will be providing the required services for the JSF pages that will be created later.

    1. In the Projects window, right-click on the Web project, CustomerApp-war. and select "New > JSF Managed Bean. ", specify CustomerMBean as the Class Name, "com.customerapp.web " as the Package Name, customer as the Name, and the scope to be session .

  • In the code editor of the newly created class, CustomerMBean, right-click and select "Insert Code. ", and "Call Enterprise Bean. " under the Generate list.
  • In the "Call Enterprise Bean" dialog, expand the CustomerApp-ejb project and select the CustomerSessionBean and select the No Interface option (anyway the Local and Remote options should be disabled because we created the Session Bean with no interface) for Referenced Interface. and click OK.
  • Notice the automatically generated variable, customerSessionBean that represents an instance of the session bean, at the beginning of the class declaration.

    Add the rest of the methods (properties and action handlers) and its implementations in the class as shown below, they will be used by the JSF pages later:

  • Creating the Customer Listing Web Page

    Now, we are ready to create the first web page that lists the Customer records in the database in a tabular form.


    1. In the Projects window, right-click on the Web project, CustomerApp-war. and select "New > XHTML. ", specify CustomerList as the File Name.
    Note: If the item "XHTML. " doesn't appear in your menu list, select "New > Others. " instead, then in the New File dialog, select Web under Categories and you should be able to see the XHTML file type on the right.
  • For convenience sake, we are going to create the initial table from the palette instead of coding from scratch. In the code editor, drag item, "JSF Data Table from Entity" from the palette and drop it in between the <h:body></h:body> tags of the newly generated file, CustomerList.xhtml :
  • A dialog with the title, "JSF Table from Entity" appears; select "com.customerapp.entity.Customer" as the Entity Bean, and "customer.customers" as the Managed Bean property and click OK. Note: The result of this are lines of codes automatically generated to display a default list of the Customer objects.
  • At this point, we are ready to see the result of the first web page created so far. In the Projects window, right-click on the CustomerApp project and select Clean and Build, and select Deploy. To confirm that the deployment is successful, navigate to the Applications folder in the Glassfish server under the Services window and check if the application, CustomerApp. exists: Note: The screen is very raw and without any beautification because up to now, it is still plain vanilla JSF. So we will next modify the page to show only the columns of interest and to use PrimeFaces dataTable where pagination is made possible.
  • To use PrimeFaces dataTable in the CustomerList.xhtml page, simply replace the <h:dataTable> and <h:column> tags to <p:dataTable> and <p:column> respectively and modify the rest of the code to look like the following:
  • The result of the changes should look like this:

    Now that we have the listing page, let's move on to create the details page.

    Creating the Customer Details Web Page

    Now we will create the page where the details of the selected customer is displayed and can be updated.


    1. In the Projects window, right-click on the Web project, CustomerApp-war. and select "New > XHTML. ", specify CustomerDetails as the File Name.
    2. In the code editor, drag the item, "JSF Form from Entity" from the palette and drop it in between the <body></body> tags of the newly generated file, CustomerDetails.xhtml :

  • A dialog with the title, "JSF Form from Entity" appears; select "com.customerapp.entity.Customer" as the Entity Bean, and "customer.details" as the Managed Bean property and click OK: Note: The result of this are lines of code automatically generated to display the label and input field of all the attributes in the Customer object in a 2 column grid.
  • To enable the navigation from the Listing page to the Details and vice versa, you need to edit the faces-config.xml with the PageFlow editor and connect the 2 pages as shown in the diagram below:

    Note. The strings LIST and DETAILS must match the return String of the list and showDetails methods in the CustomerMBean .
  • To see the result, save and deploy the application, go to the Customer listing page at URL, http://localhost:8080/CustomerApp-war/CustomerList.jsf, and click on the Customer ID on the first row in the table: Again, this looks very raw, so let's try to spice it up a little and include the Update function as well.
  • The Discount Codes is a fixed list in the database, so it makes sense to present it in the form of a dropdown list for user to select for Update. So we will bind the value of the of the Discount Codes dropdown list to a new property, customer.discountCodes in CustomerMBean which returns an array of SelectItem (Object value, String label):
    Note: the value of each SelectItem is the Discount Code of type Character. as such, the value to be bound to the Discount Code needs to be of type Character for the preselect to work when the details of a customer is being displayed. So we will need to create the getter and setter methods for a new property, discount in the Customer Entity class, which uses Character as the argument:
  • Bind this new property, "customer.details.discount " to the value of the <h:selectOneMenu> of the Discount Code field in the CustomerDetails.xhtml:
  • Make the rest of the changes to the XHTML page with the help of the code completion feature of NetBeans IDE:

    • Add the Command buttons, for Update and Back .
    • Rearrange the rows and use a different background color for the panelGrid.
    • Add a PrimeFaces component at the end of the page, <p:messages>, which displays FacesMessage created in the Managed Bean, e.g. a success message upon a successful update:
  • Modify the update method of the CustomerMBean class to create a FacesMessage upon a successful update to demonstrate the use of the PrimeFaces <p:messages> component: The result of the changes should look like this after clicking on the Update button:

    Note: after performing the Update function, you should see something similar to the following in the log file, server.log: Note: The statement "Customer updated in CustomerSessionBean" although printed in the Session Bean (ThreadID=28) after invoking the send JMS message, appears before the next two lines which are printed in the Message-Driven Bean in ThreadID=20.

  • Summary

    Congratulations. At this point you should have a fully working application with the RU functionalities. Using the same approach and methods, you can expand the application into a full-fledged enterprise application with little effort. If you cannot get your application to work like how it is supposed to be, not to worry, you can get a copy of the working solution from here .

    This tutorial demonstrates the use of various JEE6 technologies (JSF2.0, EJB3 & JPA) to build an enterprise-ready web-based application. Although the same application can be achieved easily by using JSF and JPA alone, but it may not be as scalable and reusable as what is being done here. In this tutorial, the application is segregated into different tiers where each does what they do best: presentation. business logics and data access. This promotes the principle of separation of concerns and each tier can change without effecting the other, e.g. we can change the Presentation tier to use [http://www.icefaces.org ICEfaces] as the Ajax framework if needed later.

    Good luck with your next Java EE application!

    See Also

    For other related resources, see the followings: