Minggu, 16 Februari 2014

JSF 2.0 tutorial with Eclipse and Glassfish






Introduction


In this tutorial you will learn how to setup a JSF 2.0 (Mojarra) playground with Eclipse 3.6 SR1 (Helios) and Oracle Application Server v3 (Glassfish).





There are also another IDE's available next to Eclipse, e.g. Oracle Netbeans, IntelliJ IDEA, etcetera. The choice for Eclipse is made because it's highly configureable, customizeable, has lots of helpful wizards and .. it's free! True, it may eat memory and it may sometimes crash. Just make sure that your environment has enough RAM memory for Java EE development. I recommend at least 2GB of free RAM of which 1GB is reserved to Eclipse. Also at least a dual/quad core CPU around 2GHz is recommended to be able to work fluently. Also make sure that you install trusted Eclipse plugins the right and clean way, because the well-known Eclipse-instability is almost always caused by bad plugins.


There are also another application servers available next to Oracle Glassfish, e.g. JBoss Application Server, Apache Tomcat, etcetera. The choice for Glassfish is made because it ships as being a full fledged Java EE 6 application server already with JSF builtin and offers builtin support for lot of other handy Java EE aspects like JPA for database connectivity, EJB for business services, JSR303 for bean validation, CDI for dependency injection, etcetera. Also, in combination with the current Eclipse plugin, it allows for extremely fast development. Not only Glassfish starts up relatively quick, but it is able to hotdeploy code changes in a subsecond. It's certainly an improvement as compared to its predecesor, Glassfish v2. In the 3-year old JSF 1.2 tutorial, Apache Tomcat was been used. One of the reasons to prefer Tomcat over Glassfish v2 was the lack of a good Eclipse plugin for Glassfish back then in 2008.


Back to top


Preparing


Create a working directory where you install and store all related files. In this tutorial we'll use C:\Java as working directory. If you want to store it somewhere else, then you'll have to replace every occurence of "C:\Java" throughout the tutorial by the desired directory.


Back to top


Download and install Java SE 6 JDK


The Java SE 6 JDK contains both the runtime (JRE, java.exe) and the compiler (JDK, javac.exe) for the standard Java API.


You can skip this part if you already have downloaded/installed Java SE 6 JDK.



  1. Surf to the Java SE 6 download page.

  2. You'll see four big buttons next to each other, press the leftmost one, which says just 'Java'.

  3. Accept the License Agreement and choose the right file for your platform. For Windows x64 for example you will get the file jdk-6u23-windows-x64.exe (naming may differ per version), save it to disk.

  4. Install the JDK and JRE in C:\Java\jdk1.6.0_23 and C:\Java\jre1.6.0_23 respectively (or in their default paths, if you want).





Back to top


Download and install Java EE 6 Web Profile SDK


The Java EE 6 covers the enterprise Java API. This is basically an abstract API for which Glassfish is one of the concrete implementations. Actually, Glassfish is the reference implementation. The Java EE 6 Web Profile is a specified part of the huge Java EE 6 API which includes the minimum necessary API's required for Java web development: the Servlet 3.0 API, JSF 2.0 API, JPA 2.0 API and EJB 3.1 Lite. Note that Apache Tomcat 7.0 only includes Servlet 3.0 API.


You can also consider to pick the standard (full) profile. It's only too heavy-weight since it contains API components which are (possibly) not of your interest like EJB (full), JAX-WS, JAXB, JMS, JACC, JAX-RPC, JAXR, etcetera. It causes Glassfish to start slower as compared to the lightweight web profile, sometimes very noticeably slower. The web profile starts in only a few seconds. You can find an overview of differences halfway the download page of the Glassfish development site.


You can skip this part if you already have downloaded/installed Glassfish, even though you did it by their development site.



  1. Surf to the Java EE 6 download page.

  2. You'll see four big buttons next to each other, press the rightmost one, which says 'Java EE 6 Web Profile SDK'.

  3. Choose Platform/Language, accept the License Agreement and press the Continue button.




  4. In the section 'Available Files', click at the link below 'Java EE 6 Web Profile SDK Update 1', you will get the file java_ee_sdk-6u1-web-windows.exe (naming may differ per version), save it to disk.





  5. Install Glassfish in C:\Java\glassfishv3 and walk through the remnant of the wizard. Just with default settings is fine. You may possibly get a firewall warning whenever you go to the next step after setting the ports (the installer is just testing them). Just let the firewall allow access. Don't forget to remember the admin username and password for the case that you've changed them!


























Note that you may possibly get the error 'This application needs version 1.6 or higher of the Java 2 Runtime Environment.' when executing the installer. In this case, your best bet is to try reinstalling the JRE (not the JDK!) which you can download from java.com. In the latest Java 1.6 releases, there's apparently a little difference in how the JDK/JRE installers configures the necessary registry keys and DLL's in Windows. Just reinstall JRE from java.com in the same folder. During auto-uninstalling the original JRE, you'll possibly get warnings that msvcr71.dll is missing, just ignore it and go ahead (it's may namely be exactly that file which was broken in the original JRE install!).


Back to top


Download and install Eclipse Helios 3.6 SR1


The Eclipse IDE is available in several tastes. As we're going to develop Java EE web applications, we need the Java EE variant. It contains among others the invaluable WTP (Web Tools Platform) which eases the development of Java EE web applications. The currently latest version is Eclipse Helios 3.6 SR1.



  1. Surf to the Eclipse download page.

  2. Click at the Eclipse IDE for Java EE Developers link.

  3. On the right hand menu, pick the platform version.

  4. Click the default mirror or pick a mirror and you will get the file eclipse-jee-helios-SR1-win32-x86_64.zip (naming may differ per version), save it to disk.

  5. Extract the zip and move the child directory \eclipse to C:\Java\eclipse.


Back to top


Run and configure Eclipse


After starting Eclipse for the first time, we would like to finetune Eclipse a bit so that we don't after all end in trouble and/or annoyances. Eclipse has enormously a lot of settings of which some default values should after all not have been the default values. Here I'll describe only the most useful/important ones.



  1. Run C:\Java\eclipse\eclipse.exe. You will be asked to select a workspace. Point it to C:\Java\workspace.





  2. On the welcome screen, click at the icon with the curved arrow at the right top: Go to the workbench.







  3. In the top menu, go to Window » Preferences. This is the preferences dialogue.

  4. You want world domination, so enter 'encoding' in the 'type filter text' input field on the left top. On every section, change the encoding from default (often cp1252 or ISO 8859-1) to UTF-8.




  5. In the Preferences dialogue, clear if necessary first the entered filter text, then go to General » Editors » Text Editors » Spelling and disable it. Really. It will save you from a big annoyment, because it also unnecessarily spellchecks XML documents like web.xml, faces-config.xml and on.






  6. In the Preferences dialogue, go to Web » JavaServer Faces Tools » Validation and in the section Type Assignment Problems set Method expression signature incompatibility to Warning or Ignore if you want to allow JSF action methods return void. I also recommend to set the Unary operation number (and boolean) coercion problems in the section Type Coercion Problems to Warning or Ignore, because it would unnecessarily give an error when you're using for example UIComponent#getValue() -which has Object type outcome- in EL but you treated it as number or boolean.









  7. In the Preferences dialogue, go to Web » HTML Files » Editor » Templates and click New. Enter name New Facelet Page, select context New HTML, enter description Creates a new Facelet page, copypaste the following snippet in the pattern field and click OK:
     html>
    lang="en"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">

    </span>Insert title here<span class="codetag">


    ${cursor}









  8. Here are some more screenshots of how I configured some other preferences (Text Editors, HTML Editor and Errors/Warnings), you may find it useful as well (indent using spaces, set line width and print margin, finetune errors/warnings, etc):










  9. Click OK to close the Preferences dialogue.


Back to top


Integrate Glassfish in Eclipse


We need to familarize Eclipse with any installed application servers so that Eclipse can seamlessly link their libraries in the build path (read: the compiletime classpath) of the project. This is mandatory in order to be able to import classes from the Java EE API in your project (you know, the applications server is namely the concrete Java EE implementation).



  1. At the bottom box click at the Servers tab to open the servers view. Rightclick at the box and choose New » Server. In the wizard, click the link 'Download additional server adapters'. Wait until it has finished gathering all available adapters. Finally choose 'Oracle Glassfish Server Tools' from the list and click Next. Accept the license terms and click Finish. In the end you need to restart Eclipse, do it.









  2. After restarting and going to workbench, open the servers view once again to add a new server. In the wizard, select GlassFish » GlassFish Server Open Source Edition 3 (Java EE 6) and click Next. In the next page, click at Browse, point to C:\Java\glassfishv3\glassfish and click Next. In the next page, change if necessary the admin ID (username) and password, which is the same as the ones specified during Glassfish installation. Finally click Finish. Now Glassfish is integrated in Eclipse.









  3. Doubleclick the Glassfish server entry in the Servers tab, you'll get the server configuration. You can there if necessary change the admin name/password and configure the degree of publishing (hotdeploying). You may possibly get a firewall warning when you open the server configuration for the first time, just let it allow access. Glassfish is able to publish extremely fast on just a Ctrl+S. In the Publishing section, set Automatically publish when resources change and set the interval to 0.






  4. Rightclick the Glassfish server entry in the Servers tab and choose Start. You can also start it by clicking at the green arrow at the toolbar of the box. Again, you may possibly get a firewall warning here as well, just let it allow access (this should be the last time now ;) ). Once it is started, go to http://localhost:8080 (where 8080 is the HTTP port as in Glassfish config). You should get the default Glassfish home page. Also checkout the admin console on http://localhost:4848 (where 4848 is the admin port as in Glassfish config).









    If you get a timeout or kind of an unknown host error message, then doublecheck it is started properly and you're using the right port number. In Eclipse you can find the Glassfish logs at the Console tab of the bottom dialogue box (you can doubleclick the tab to maximize it and bring it back). Glassfish actually shows two consoles, one of the JVM and one of the server.log logfile. The last one is of your interest. Click the blue monitor icon on the right top to switch between consoles.







  5. You can stop the server by rightclicking at the Glassfish server entry in the Servers tab and choose Stop. You can also stop it by clicking at the red square at the toolbar of the box.


Back to top


Prepare JSF web project in Eclipse


Now we can finally create a JSF web project in Eclipse.



  1. At the left box open the Project Explorer tab if not already opened. Rightclick at the box and choose New » Dynamic Web Project. In the wizard, give it the Project name Playground, verify if Target Runtime is set to 'GlassFish Server Open Source Edition 3 (Java EE 6)' and Dynamic Web Module version is set to '3.0' (this is actually the Servlet API version). Under Configuration select 'JavaServer Faces v2.0 project' and click Next.





  2. In the next page, you can configure the source folder and build folder (there where compiled classes will end up in). Just keep it default and click Next.





  3. In the next page, you may change the module settings to your taste. Personally I like to have URL's always in lowercase, so I change the default Context Root from Playground to playground. Also, check the checkbox Generate web.xml deployment descriptor to have Eclipse auto-generate the web.xml. Click Next.




  4. In the next page, you need to define JSF Capabilities. At JSF Implementation Library, select 'Disable Library Configuration'. Glassfish already ships with JSF 2.0 builtin, so we don't need to specify anything. At URL Mapping Patterns, select the default /faces/* and click Remove to remove it. Prefix patterns end up to be less maintainable. Better use postfix patterns like *.jsf or even *.xhtml (unless you have XHTML files which you'd like not to have JSF's FacesServlet to kick in). We'll pick *.xhtml here, a major advantage is that this is an easy way to avoid that the enduser can see the JSF source code whenever s/he (accidently) opens the page with *.xhtml in the URL while the FacesServlet is mapped on *.jsf.

    Click Add... to add a new pattern with the value *.xhtml. Finally click Finish.




  5. After creation of the web project, you should get a directory structure similar to the screenshot below.




  6. Due to a combination of constraints in the HTTP/HTML/EL specifications, empty HTML input fields are by default treated as empty String. The average (Java) web developer usually dislikes this (so do I). We can instruct JSF to interpret them as null. Open WebContent/WEB-INF/web.xml file, click if necessary the Source tab at the bottom of the editor, and add the following context parameter:


    javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
    true


    If necessary hit Ctrl+Shift+F to format the xml file nicely.





  7. Save and close the file.


Back to top


Create JSF hello world in Eclipse - The model


As a hello world project, we'll create a simple ajax-flavored form which treats the use case of "Register User". We first need to create a data model. That's a class which represents a real world entitiy, in this case the User. It holds all the information about the user. It should be written as a Javabean. A Javabean is a class which holds properties as private fields which are exposed by public getters and setters.



  1. Open the newly created Playground project, rightclick at Java Resources folder and choose New » Class. In the wizard, enter the package name com.example, enter the class name User, keep the other fields default and click Finish. The package and the class will be created and the editor box will show the class source.









  2. Let the class implement Serializable. This is not mandatory per se, but this is useful in order to let the HTTP session survive server restarts. Also, as we're going to use a JSF view scoped bean, which will be stored in the component tree (the `UIViewRoot`) in the HTTP session, the view scoped bean itself and all of its properties should be Serializable as well.
    package com.example;

    import java.io.Serializable;

    public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    }

    Note that when you add implements Serializable, Eclipse will show a warning that the class needs to have a serialVersionUID field. You can if necessary just let Eclipse include it with a default or autogenerated ID. Click the yellow bullet on the left hand side and choose it.

  3. Add five fields to the class (note that Date is to be imported as java.util.Date, not as java.sql.Date):


    private Long id;
    private String username;
    private String password;
    private String email;
    private Date birthdate;





  4. Let Eclipse auto-generate the necessary getters and setters. Rightclick somewhere in blank space of the source code inside the source editor, choose Source » Generate Getters and Setters, or hit Alt+Shift+S, then R. In the wizard, click Select All and then untick the serialVersionUID one, if necessary choose the insertion point (I like to have getters and setters at the whole bottom of the class, thus Last member) and the sorting (it defaults to getter/setter pairs, which is okay) and then click at OK. If necessary, hit Ctrl+Shift+F to format the code again so that methods get separated by a blank line. You can configure formatting preferences in Window » Preferences » Java » Code Style » Formatter.









  5. Save the class by choosing File » Save in the top menu or by pressing Ctrl+S.



Create JSF hello world in Eclipse - The controller


The backing bean is in turn the glue between the view (the JSF page) and the data model (the entity). The backing bean is linked to the view and all properties of the model are by the backing bean exposed in the view. The backing bean can contain action methods which are linked in the view. The backing bean is basically a mini-controller at its own (in the bigger picture of JSF, the FacesServlet is actually the real web MVC controller).



  1. Rightclick at com.example package and choose New » Class. In the wizard, enter the class name Register, keep the other fields default (if you rightclicked on the package to create a new class, the package name should already be com.example) and click Finish. The class will be created and the editor box will show the class source.







  2. First let the class implement Serializable. Then add a new line above the class declaration, enter @ManagedBean, press Ctrl+Space and ensure that you choose the javax.faces one to import. Do the same for @ViewScoped annotation as well. Note that we can also use @RequestScoped here as well since the bean doesn't do any significantly expensive operations during the construction such as obtaining some data from a database, but if it did and you declared it @RequestScoped, then the bean will be constructed and thus the DB will be hit on every ajax request, keep this in mind!
    package com.example;

    import java.io.Serializable;

    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ViewScoped;

    @ManagedBean
    @ViewScoped
    public class Register implements Serializable {

    private static final long serialVersionUID = 1L;

    }







  3. Add a property for the User model, along with a getter and (optionally) a setter, add a @PostConstruct method with which initializes a new User and finally add an action method which just adds a success message (in real world, we would save the newly registered user in the DB as well, but that's beyond the scope of this tutorial):


    private User user;

    @PostConstruct
    public void init() {
    user = new User();
    }

    public void submit() {
    FacesMessage message = new FacesMessage("Registration succesful!");
    FacesContext.getCurrentInstance().addMessage(null, message);
    }

    public User getUser() {
    return user;
    }





  4. Save the class.


Back to top


Create JSF hello world in Eclipse - The view


blah



  1. Rightclick at WebContent folder and choose New » XHTML page. In the wizard, enter the File name register, click Next (the .xhtml extension will be appended automatically anyway), select the template New Facelet Page (which we have definied in the preferences) and click Finish.












  2. Change the </tt> to <i>Register user</i> and add the following ajax-flavored form to the body of the view:<br /><pre><span class="codetag"><h:form></span><br /> <span class="codetag"><h:panelGrid</span> columns=<span class="codevalue">"3"</span><span class="codetag">></span><br /> <span class="codetag"><h:outputLabel</span> for=<span class="codevalue">"username"</span><span class="codetag">></span>Username<span class="codetag"></h:outputLabel></span><br /> <span class="codetag"><h:inputText</span> id=<span class="codevalue">"username"</span> value=<span class="codevalue">"#{register.user.username}"</span> required=<span class="codevalue">"true"</span><span class="codetag">></span><br /> <span class="codetag"><f:ajax</span> event=<span class="codevalue">"blur"</span> render=<span class="codevalue">"usernameMessage"</span> <span class="codetag">/></span><br /> <span class="codetag"></h:inputText></span><br /> <span class="codetag"><h:message</span> id=<span class="codevalue">"usernameMessage"</span> for=<span class="codevalue">"username"</span> <span class="codetag">/></span><br /><br /> <span class="codetag"><h:outputLabel</span> for=<span class="codevalue">"password"</span><span class="codetag">></span>Password<span class="codetag"></h:outputLabel></span><br /> <span class="codetag"><h:inputSecret</span> id=<span class="codevalue">"password"</span> value=<span class="codevalue">"#{register.user.password}"</span> required=<span class="codevalue">"true"</span> redisplay=<span class="codevalue">"true"</span><span class="codetag">></span><br /> <span class="codetag"><f:ajax</span> event=<span class="codevalue">"blur"</span> render=<span class="codevalue">"passwordMessage"</span> <span class="codetag">/></span><br /> <span class="codetag"></h:inputSecret></span><br /> <span class="codetag"><h:message</span> id=<span class="codevalue">"passwordMessage"</span> for=<span class="codevalue">"password"</span> <span class="codetag">/></span><br /><br /> <span class="codetag"><h:outputLabel</span> for=<span class="codevalue">"email"</span><span class="codetag">></span>Email<span class="codetag"></h:outputLabel></span><br /> <span class="codetag"><h:inputText</span> id=<span class="codevalue">"email"</span> value=<span class="codevalue">"#{register.user.email}"</span> required=<span class="codevalue">"true"</span><span class="codetag">></span><br /> <span class="codetag"><f:ajax</span> event=<span class="codevalue">"blur"</span> render=<span class="codevalue">"emailMessage"</span> <span class="codetag">/></span><br /> <span class="codetag"></h:inputText></span><br /> <span class="codetag"><h:message</span> id=<span class="codevalue">"emailMessage"</span> for=<span class="codevalue">"email"</span> <span class="codetag">/></span><br /><br /> <span class="codetag"><h:outputLabel</span> for=<span class="codevalue">"birthdate"</span><span class="codetag">></span>Birthdate (yyyy-MM-dd)<span class="codetag"></h:outputLabel></span><br /> <span class="codetag"><h:inputText</span> id=<span class="codevalue">"birthdate"</span> value=<span class="codevalue">"#{register.user.birthdate}"</span><span class="codetag">></span><br /> <span class="codetag"><f:convertDateTime</span> pattern=<span class="codevalue">"yyyy-MM-dd"</span> <span class="codetag">/></span><br /> <span class="codetag"><f:ajax</span> event=<span class="codevalue">"blur"</span> render=<span class="codevalue">"birthdateMessage"</span> <span class="codetag">/></span><br /> <span class="codetag"></h:inputText></span><br /> <span class="codetag"><h:message</span> id=<span class="codevalue">"birthdateMessage"</span> for=<span class="codevalue">"birthdate"</span> <span class="codetag">/></span><br /><br /> <span class="codetag"><h:panelGroup /></span><br /> <span class="codetag"><h:commandButton</span> value=<span class="codevalue">"Register"</span> action=<span class="codevalue">"#{register.submit}"</span><span class="codetag">></span><br /> <span class="codetag"><f:ajax</span> execute=<span class="codevalue">"@form"</span> render=<span class="codevalue">"@form"</span> <span class="codetag">/></span><br /> <span class="codetag"></h:commandButton></span><br /> <span class="codetag"><h:messages</span> globalOnly=<span class="codevalue">"true"</span> layout=<span class="codevalue">"table"</span> <span class="codetag">/></span><br /> <span class="codetag"></h:panelGrid></span><br /><span class="codetag"></h:form></span></pre><br />You see, it creates a form with a 3-column table (however, a tableless form with a flood of CSS would semantically have been more correct, but that's beyond the scope of this tutorial, we teach JSF, not CSS). The 1st column contains the labels for input fields, the 2nd column contains the input fields and the submit button, the 3rd column contains the messages. The <tt><f:ajax></tt> tags in the input fields will submit (and validate!) only the current field and trigger a re-render of the associated message field when the JavaScript/HTML DOM <tt>blur</tt> event is triggered (when the field loses focus, i.e. when you tab out the field or click somewhere else on the page). The <tt><f:ajax></tt> tag in the command button will do a pure ajax submit instead of a normal submit. The <tt>globalOnly="true"</tt> in the messages field will only display messages whose client ID is <tt>null</tt> (as we've created in the managed bean's <tt>submit()</tt> method).<br/><br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPeOxSsBPiOhicXflC9IGjUAM0TF3U8AOY9WapNgih6tDyjB5ZJ3UpFb1cNBDilVkSkdwIZF158VbNQhGwJnc1jFnwMVyp-qY94fAFYDLFet_6tnhR4fvAkAgIOL43bjbkQuo33wCUeT0/s1600/HelloWorld-The-View-%252305.png"><img class="thumbnail" height="108" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPeOxSsBPiOhicXflC9IGjUAM0TF3U8AOY9WapNgih6tDyjB5ZJ3UpFb1cNBDilVkSkdwIZF158VbNQhGwJnc1jFnwMVyp-qY94fAFYDLFet_6tnhR4fvAkAgIOL43bjbkQuo33wCUeT0/s200/HelloWorld-The-View-%252305.png" /></a><br /><br /></li><br /><li>Save the view.</li><br /></ol><br /><h5><a href="#top">Back to top</a></h5><br /><br /><h4><a name="RunJSFWebProjectInGlassfish" href="#RunJSFWebProjectInGlassfish">Run JSF web project in Glassfish</a></h4><br /><p>Now it's time to deploy the project to Glassfish and run it!</p><br /><ol><br /><li>Rightclick the Glassfish server entry in the <i>Servers</i> tab and choose <i>Add and Remove Projects</i>. In the wizard, select the Playground project under <i>Available Projects</i> and click <i>Add</i> to add it to <i>Configured Projects</i>. Click <i>Finish</i>.<br/><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjWnTVWi_DgU0L6Ol8EwxqeZPf0ruE_if68gQVHjF4XA2WUbkyd2zH21JhlJ773XmV00VrQm1PgjZjqY6OYRitmg5mm48_AQ3t7DmO30squ7_gJF444MtxTMT2sFpg7Pct9iiMzgFAiXE/s1600/Run-Glassfish-%252301.png"><img class="thumbnail" height="107" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjWnTVWi_DgU0L6Ol8EwxqeZPf0ruE_if68gQVHjF4XA2WUbkyd2zH21JhlJ773XmV00VrQm1PgjZjqY6OYRitmg5mm48_AQ3t7DmO30squ7_gJF444MtxTMT2sFpg7Pct9iiMzgFAiXE/s200/Run-Glassfish-%252301.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT8i7QmQSxe7zyH01Xk5CfEiwH4qtG49sNQTIra04pbYeSRkaVdkjU8g-XmCCAcGuMUkiT5sGQj2hOtj2RXvx9MN7WFJ2SlLlD1Ck8nD24w2WQsFbEFykhSGpt-1lGwIvA08VxsfyloIo/s1600/Run-Glassfish-%252302.png"><img class="thumbnail" height="200" width="194" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT8i7QmQSxe7zyH01Xk5CfEiwH4qtG49sNQTIra04pbYeSRkaVdkjU8g-XmCCAcGuMUkiT5sGQj2hOtj2RXvx9MN7WFJ2SlLlD1Ck8nD24w2WQsFbEFykhSGpt-1lGwIvA08VxsfyloIo/s200/Run-Glassfish-%252302.png" /></a><br /><br /></li><br /><li>Rightclick the Glassfish server entry in the <i>Servers</i> tab and choose <i>Start</i>. You can also start it by clicking at the green arrow at the toolbar of the box. Glassfish is started successfully if the <tt>server.log</tt> in the <i>Console</i> tab (click the blue monitor icon on the right top to switch between consoles if necessary) displays at least the following line:<br /><pre><br />INFO: Playground was successfully deployed in 3,770 milliseconds.<br /></pre><br />Note that it may take longer or shorter, depending on whether the server has already started for the first time before or not.<br/><br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijLER3iIosCMC3Z8a1lHa4CLtVUve9IAEsYV1MefeCqBQfzEHe-DAWKK1PcsOKSc1Sx68Yqqi5H4wV6g-QWQuay0g7pFi89b7JJ9gmkpklcCzFBGDabT-SBgJt23P2yAzWY9uAkjIOYEM/s1600/Run-Glassfish-%252303.png"><img class="thumbnail" height="107" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijLER3iIosCMC3Z8a1lHa4CLtVUve9IAEsYV1MefeCqBQfzEHe-DAWKK1PcsOKSc1Sx68Yqqi5H4wV6g-QWQuay0g7pFi89b7JJ9gmkpklcCzFBGDabT-SBgJt23P2yAzWY9uAkjIOYEM/s200/Run-Glassfish-%252303.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjnlWIrOwmlP-Othg4O-jouFd3KRT0DxQznchzqOFjUy8JhEZ01Y5Sdra7DJHKSbacFdnWw0meS1TksQUGmtNKHtekAvgaRDxjsYsTiiW3tEwLUK9d_beB1cJa6Oq9T-JGhOMjb5pXJYk/s1600/Run-Glassfish-%252304.png"><img class="thumbnail" height="107" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjnlWIrOwmlP-Othg4O-jouFd3KRT0DxQznchzqOFjUy8JhEZ01Y5Sdra7DJHKSbacFdnWw0meS1TksQUGmtNKHtekAvgaRDxjsYsTiiW3tEwLUK9d_beB1cJa6Oq9T-JGhOMjb5pXJYk/s200/Run-Glassfish-%252304.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsG0GrJfEDxBzcpYiFqxg0fDjBbN7kYSUhPf9E8utuhYOhUnmZv-UlgJA_atPaCdfAeFgtJdews3UiSQ6VJP4j-rPRNCdj69EayaWdBEM8nr9HaOQ4OyOL8Hfqq3hKXp1BAcHF_2xT5mg/s1600/Run-Glassfish-%252305.png"><img class="thumbnail" height="108" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsG0GrJfEDxBzcpYiFqxg0fDjBbN7kYSUhPf9E8utuhYOhUnmZv-UlgJA_atPaCdfAeFgtJdews3UiSQ6VJP4j-rPRNCdj69EayaWdBEM8nr9HaOQ4OyOL8Hfqq3hKXp1BAcHF_2xT5mg/s200/Run-Glassfish-%252305.png" /></a><br /></li><br /><br /><li>Once it is started, go to <a href="http://localhost:8080/playground/register.xhtml">http://localhost:8080/playground/register.xhtml</a> in your favourite webbrowser. Note that the <tt>.xhtml</tt> extension must match the URL pattern of the <tt>FacesServlet</tt> mapping as we have definied in step 4 of chapter <a href="#PrepareJSFWebProjectInEclipse"><i>Prepare JSF web project in Eclipse</i></a>. Such a request URL will then trigger the <tt>FacesServlet</tt> and it will create the <tt>FacesContext</tt> and do all the JSF works.<br/><br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEJoNKZS1lAbMUm6oAPLBq2eyYbmB7NskmZ6No7_kGImRUZmoQl2X2k5IQ4YcqoWifnk8CZc9vLE6NunDOeM8B3WXkLgwAS3ShFVxRMBB1iykqeUR5YlzlSuc_KPhB3iSzaW5vvCru_DQ/s1600/Run-Glassfish-%252306.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEJoNKZS1lAbMUm6oAPLBq2eyYbmB7NskmZ6No7_kGImRUZmoQl2X2k5IQ4YcqoWifnk8CZc9vLE6NunDOeM8B3WXkLgwAS3ShFVxRMBB1iykqeUR5YlzlSuc_KPhB3iSzaW5vvCru_DQ/s200/Run-Glassfish-%252306.png" /></a><br /><br /><br/>If you get a timeout or kind of an unknown host error message, then doublecheck if Glassfish is started properly and if the port is correct. If you get an internal server error, then an exception was been thrown and is available in the server log. Also try to interpret and understand the exception message and the trace, if necessary with help of Google, and then fix the code accordingly.</li><br /><li>Play around it in your browser! Tab through the fields, enter values, remove values, press the submit button, etcetera. You'll note that it's running smoothly thanks to all the new JSF 2.0 ajax works.<br/><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdv6sgG6xq8nRejHLGeSDjyWbTVfxTJNSlhUW3rsTkTA5bgD7pbl2t9SH-NXuS5JK6aPmJxWq7rDIiFXbWMy5oEsuUeuoWfaSG7D4RG50Mwib04nerIHePkgwfSwKnFpZFaN6-l7eQdDI/s1600/Run-Glassfish-%252307.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdv6sgG6xq8nRejHLGeSDjyWbTVfxTJNSlhUW3rsTkTA5bgD7pbl2t9SH-NXuS5JK6aPmJxWq7rDIiFXbWMy5oEsuUeuoWfaSG7D4RG50Mwib04nerIHePkgwfSwKnFpZFaN6-l7eQdDI/s200/Run-Glassfish-%252307.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGx-rNGyaisA042hHZU7Kza-1ePBby4JX-UQR99xLKfuiNtq5xK4HgE6QlqXcbbVrhWdqC7UUeRqvQK9bvaRzxQjFHZrvxmapNY1WayzERB41TUK4tugmTuYx7xgFLNAZHqzjw9yWiRvw/s1600/Run-Glassfish-%252308.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGx-rNGyaisA042hHZU7Kza-1ePBby4JX-UQR99xLKfuiNtq5xK4HgE6QlqXcbbVrhWdqC7UUeRqvQK9bvaRzxQjFHZrvxmapNY1WayzERB41TUK4tugmTuYx7xgFLNAZHqzjw9yWiRvw/s200/Run-Glassfish-%252308.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg80n_Z-lzoyrmor8YQslhaAy7feMOAqAjhzamgtBn6b82PIY5KPoDdGuFZ5VvfwZ0UOkFFVQ5Vk_3fjcgRqkKkio3WWvDAQQvjgRfTGWxl-NNRsKPSp0hpOiUmxHcO4bIGCr4qpX5Hv_o/s1600/Run-Glassfish-%252309.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg80n_Z-lzoyrmor8YQslhaAy7feMOAqAjhzamgtBn6b82PIY5KPoDdGuFZ5VvfwZ0UOkFFVQ5Vk_3fjcgRqkKkio3WWvDAQQvjgRfTGWxl-NNRsKPSp0hpOiUmxHcO4bIGCr4qpX5Hv_o/s200/Run-Glassfish-%252309.png" /></a><br /><br /><br /></li><br /></ol><br /><h5><a href="#top">Back to top</a></h5><br /><br /><h4><a name="FinetuningValidation" href="#FinetuningValidation">Extra! Finetuning validation</a></h4><br /><p>You'll probably have noticed that the default validation error messages are scary and you would probably also like to add a bit more strong password and email validation. Now, you can finetune the validation messages in several ways.</p><br /><ol><br /><li>Those <tt>j_idt6:username</tt>, <tt>j_idt6:password</tt>, etc are actually client ID's of the input elements (that is, the generated <tt>id</tt> of the HTML input element which you can see when you do rightclick and <i>View Source</i> of the opened page in the webbrowser). The <tt>j_idt6</tt> part (which can differ) is controllable by giving the <tt><h:form></tt> a fixed <tt>id</tt>.<br /><pre><br /><span class="codetag"><h:form</span> id=<span class="codevalue">"form"</span><span class="codetag">></span><br /></pre><br />Edit it accordingly in the <tt>register.xhtml</tt>, save it and refresh the page (no server restart is required! Glassfish hotdeploys extremely fast, you don't need to wait for anything, just refresh the page in browser). Trigger the validation and you'll see <tt>form:username</tt>, <tt>form:password</tt>, etc instead.<br/><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrl7sqa0QWDCA1DoX9uoZ6tU2FVhLhC8rVmtWToDxu5ik0qoOdjsoHv09ZNiQ1wtejVlvjjPe_b-tZlYezNbvf5GqnnZHidMAToSRdy13QT4sxt7apWfkV3RBcKmGEY1n2IyYu-vWHVss/s1600/Finetune-Validation-%252301.png"><img class="thumbnail" height="108" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrl7sqa0QWDCA1DoX9uoZ6tU2FVhLhC8rVmtWToDxu5ik0qoOdjsoHv09ZNiQ1wtejVlvjjPe_b-tZlYezNbvf5GqnnZHidMAToSRdy13QT4sxt7apWfkV3RBcKmGEY1n2IyYu-vWHVss/s200/Finetune-Validation-%252301.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ-di7ZRn11RylqjlAug3pMNz-FsGHnK8h4lLoWtUBNewmHUjAVJOSlxsamgEVXxwtS8N61Hjp8c4bmGwO8JTiiM0RFocg8WCREg8BTCK_10iywkZHNLOHYpDv96ZP-34KVgVfB7mkP30/s1600/Finetune-Validation-%252302.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ-di7ZRn11RylqjlAug3pMNz-FsGHnK8h4lLoWtUBNewmHUjAVJOSlxsamgEVXxwtS8N61Hjp8c4bmGwO8JTiiM0RFocg8WCREg8BTCK_10iywkZHNLOHYpDv96ZP-34KVgVfB7mkP30/s200/Finetune-Validation-%252302.png" /></a><br /><br /></li><br /><li>That's already less scary. However, we can make the labels more human friendly by defining them in the <tt>label</tt> attribute of the input components.<br /><pre><span class="codetag"><h:inputText</span> id=<span class="codevalue">"username"</span> label=<span class="codevalue">"Username"</span> ... <span class="codetag">></span><br />...<br /><span class="codetag"><h:inputSecret</span> id=<span class="codevalue">"password"</span> label=<span class="codevalue">"Password"</span> ... <span class="codetag">></span><br />...<br /><span class="codetag"><h:inputText</span> id=<span class="codevalue">"email"</span> label=<span class="codevalue">"Email"</span> ... <span class="codetag">></span><br />...<br /><span class="codetag"><h:inputText</span> id=<span class="codevalue">"birthdate"</span> label=<span class="codevalue">"Birthdate"</span> ... <span class="codetag">></span></pre><br />Edit accordingly, save source, refresh page in browser, play around it. No pain!<br/><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj91CtXxANXYxMK2pfKloi7SR_i_2kvu_Ox23pYyDhF10tAGzFtth7yXTYwpugLvV8HhCG5QEbJJUwsw97XZJw1z9Jc-Hc7G0skJvyfcEiULyNZxWYTqIAM5tKkYYXKxpafqERd5bpx0e8/s1600/Finetune-Validation-%252303.png"><img class="thumbnail" height="108" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj91CtXxANXYxMK2pfKloi7SR_i_2kvu_Ox23pYyDhF10tAGzFtth7yXTYwpugLvV8HhCG5QEbJJUwsw97XZJw1z9Jc-Hc7G0skJvyfcEiULyNZxWYTqIAM5tKkYYXKxpafqERd5bpx0e8/s200/Finetune-Validation-%252303.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8zxoh-P3no2aJMJrEp-MeEE3tdtQYttCkthke8cDKyouDt-Lh6LjZXM_WctvsC0BOtYr8ZzEJWhZhCKmMNb4lWtCYi7lI9GhIJs667diL9jGpQc3jkHn-Ukc3QheU8yhxayDDTFcM6Ho/s1600/Finetune-Validation-%252304.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8zxoh-P3no2aJMJrEp-MeEE3tdtQYttCkthke8cDKyouDt-Lh6LjZXM_WctvsC0BOtYr8ZzEJWhZhCKmMNb4lWtCYi7lI9GhIJs667diL9jGpQc3jkHn-Ukc3QheU8yhxayDDTFcM6Ho/s200/Finetune-Validation-%252304.png" /></a><br /><br /></li><br /><li>Better, but still too "mechanic". However, there's a way to replace the <i>entire</i> default required and conversion message in the view side by defining them as <tt>requiredMessage</tt> and <tt>converterMessage</tt> accordingly.<br /><pre><span class="codetag"><h:inputText</span> id=<span class="codevalue">"username"</span> requiredMessage=<span class="codevalue">"Please enter username"</span> ... <span class="codetag">></span><br />...<br /><span class="codetag"><h:inputSecret</span> id=<span class="codevalue">"password"</span> requiredMessage=<span class="codevalue">"Please enter password"</span> ... <span class="codetag">></span><br />...<br /><span class="codetag"><h:inputText</span> id=<span class="codevalue">"email"</span> requiredMessage=<span class="codevalue">"Please enter email"</span> ... <span class="codetag">></span><br />...<br /><span class="codetag"><h:inputText</span> id=<span class="codevalue">"birthdate"</span> converterMessage=<span class="codevalue">"Please enter date in yyyy-MM-dd format"</span> ... <span class="codetag">></span></pre><br />Rinse and repeat.<br/><br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC8boYUrk-a3B1XEt4BmoXrBXk2dvcyvVzImLP77M_bhlExUes-rKysGL2kyrdw0TfKywf5MaYQfmGM6cWS59PySRyibzMxLTJK2-q0_ocMPZLVzySwwJaubvsp5LuG7RopgJMkx7VsxY/s1600/Finetune-Validation-%252305.png"><img class="thumbnail" height="108" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC8boYUrk-a3B1XEt4BmoXrBXk2dvcyvVzImLP77M_bhlExUes-rKysGL2kyrdw0TfKywf5MaYQfmGM6cWS59PySRyibzMxLTJK2-q0_ocMPZLVzySwwJaubvsp5LuG7RopgJMkx7VsxY/s200/Finetune-Validation-%252305.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoJ6y-5MqhYXaDKh46XpSqbQgyPI186uM1C8KLZn9LSczOC1_KpxQN2UQwOPTPA-mKq7GjX2RLAClR22vopq7inGHiRkPQpvazyHTaVIpN3lEB_d0S3rp5UzNIV5rQQkLLZyDsb70AJoI/s1600/Finetune-Validation-%252306.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoJ6y-5MqhYXaDKh46XpSqbQgyPI186uM1C8KLZn9LSczOC1_KpxQN2UQwOPTPA-mKq7GjX2RLAClR22vopq7inGHiRkPQpvazyHTaVIpN3lEB_d0S3rp5UzNIV5rQQkLLZyDsb70AJoI/s200/Finetune-Validation-%252306.png" /></a><br /><br/>There are other ways as well, for example defining them as <tt><message-bundle></tt> in the <tt>faces-config.xml</tt>, but that's beyond the scope of this tutorial.</li><br /></li><br /><li>We can also do the validation straight in the model instead of the view. This can be more useful if the model is a JPA entity. Glassfish ships with builtin bean validation (also known as <a href="http://jcp.org/aboutJava/communityprocess/final/jsr303/index.html">JSR 303</a>) which is anticipated seamlessly by JSF 2.0. It ships with several <a href="http://download.oracle.com/javaee/6/api/javax/validation/constraints/package-summary.html">validation constraint annotations</a> such as <tt>@NotNull</tt>.<br/><br/><br />First <b>remove</b> the <tt>required</tt> and <tt>requiredMessage</tt> attributes from the three input fields <tt>username</tt>, <tt>password</tt> and <tt>email</tt>. Then add the <tt>@NotNull</tt> annotation on exactly those properties of the model (note that this only works when you've added the <tt>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</tt> context parameter as described in step 6 of chapter <a href="#PrepareJSFWebProjectInEclipse"><i>Prepare JSF web project in Eclipse</i></a>, otherwise you need the Hibernate validation specific <tt>@NotEmpty</tt> annotation instead!).<br /><pre><br /><br /> <span class="codekeyword">private</span> Long <span class="codeproperty">id</span>;<br /> <span class="codeannotation">@NotNull</span><br /> <span class="codekeyword">private</span> String <span class="codeproperty">username</span>;<br /> <span class="codeannotation">@NotNull</span><br /> <span class="codekeyword">private</span> String <span class="codeproperty">password</span>;<br /> <span class="codeannotation">@NotNull</span><br /> <span class="codekeyword">private</span> String <span class="codeproperty">email</span>;<br /> <span class="codekeyword">private</span> Date <span class="codeproperty">birthdate</span>;<br /><br /></pre><br />Save and refresh browser (no, still no server restart needed here as well!)<br/><br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyFHf8hgFzBJyRldO5lRqTZn9AlbUC5HWf16BRDOxIQsl5Dn3KRBWk6dMB1rq_d9e5kXqeZc1SKVcXKrtZq4gIrdMFmi6XEpD0SsqZ6M5orjkrb1V7H0fYW8NK0ZnYm2FC5tYi1nvBE0k/s1600/Finetune-Validation-%252307.png"><img class="thumbnail" height="108" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyFHf8hgFzBJyRldO5lRqTZn9AlbUC5HWf16BRDOxIQsl5Dn3KRBWk6dMB1rq_d9e5kXqeZc1SKVcXKrtZq4gIrdMFmi6XEpD0SsqZ6M5orjkrb1V7H0fYW8NK0ZnYm2FC5tYi1nvBE0k/s200/Finetune-Validation-%252307.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCbJ4wtSf_9GWudDCCy8fxrehQpQrClCqXnuygCRsgFQYKPuWHOibqxcv6rVyfW1AL9nHZQsoecn77sSDN1ro2UelzrnsDzTOCseszuUkiVhhwQZEMeOCYMQkANcdeba90kOIuKH9DrW0/s1600/Finetune-Validation-%252308.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCbJ4wtSf_9GWudDCCy8fxrehQpQrClCqXnuygCRsgFQYKPuWHOibqxcv6rVyfW1AL9nHZQsoecn77sSDN1ro2UelzrnsDzTOCseszuUkiVhhwQZEMeOCYMQkANcdeba90kOIuKH9DrW0/s200/Finetune-Validation-%252308.png" /></a><br /><br /></li><br /><li>Again, the messages are too generic: "<i>may not be null</i>". We can however customize them straight in the model by the <tt>message</tt> field of the annotation.<br /><pre><br /><br /> <span class="codekeyword">private</span> Long <span class="codeproperty">id</span>;<br /> <span class="codeannotation">@NotNull</span>(message = <span class="codevalue">"Please enter username"</span>)<br /> <span class="codekeyword">private</span> String <span class="codeproperty">username</span>;<br /> <span class="codeannotation">@NotNull</span>(message = <span class="codevalue">"Please enter password"</span>)<br /> <span class="codekeyword">private</span> String <span class="codeproperty">password</span>;<br /> <span class="codeannotation">@NotNull</span>(message = <span class="codevalue">"Please enter email"</span>)<br /> <span class="codekeyword">private</span> String <span class="codeproperty">email</span>;<br /> <span class="codekeyword">private</span> Date <span class="codeproperty">birthdate</span>;<br /><br /></pre><br />Save, refresh, play.<br/><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz-Sb660W8MD5uVHVLDKeGD4bmqtRXVfLuZ_BL6VWIwXkHs830n9LCdCp0NVQRf8UVDCFzUvv10-q7wXOULUtGmt2HH98_8ElF8Q-SKUAcKaCDJSBaGu7rk2zPELN-MRQbw5fv7DppIds/s1600/Finetune-Validation-%252309.png"><img class="thumbnail" height="108" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz-Sb660W8MD5uVHVLDKeGD4bmqtRXVfLuZ_BL6VWIwXkHs830n9LCdCp0NVQRf8UVDCFzUvv10-q7wXOULUtGmt2HH98_8ElF8Q-SKUAcKaCDJSBaGu7rk2zPELN-MRQbw5fv7DppIds/s200/Finetune-Validation-%252309.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpeIf6Z3ByWJOfERMSfDYcG7eQL-dRuYfyYPsvXVog1M28hrg0tnFiYsHS081mWMW0V3mRSi6oMu_OcQJSJa2xNT46VeMU4qplN-mcJr3HEqUXKYF_ZtYT8f9aNXSRUHkTSDQUiTFyJsI/s1600/Finetune-Validation-%252310.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpeIf6Z3ByWJOfERMSfDYcG7eQL-dRuYfyYPsvXVog1M28hrg0tnFiYsHS081mWMW0V3mRSi6oMu_OcQJSJa2xNT46VeMU4qplN-mcJr3HEqUXKYF_ZtYT8f9aNXSRUHkTSDQUiTFyJsI/s200/Finetune-Validation-%252310.png" /></a><br /><br /><br/>Now we're back at the same state as with view-level validation finetuning.<br/><br/><br />Which one you should be using in your projects really depends on the requirements. For example, if you want to be able to run this on a random Tomcat machine or non-Java EE 6-container (JSF 2.0 is by itself backwards compatible with Java EE 5 / Servlet 2.5), then forget bean validation.</li><br /><li>We can even use regex to validate the strengthness of the password and correctness of the email. For this the JSR 303 <tt>@Pattern</tt> annotation is useful. We want the password to be at least 8 chars in length, contain at least one digit, at least one lowercase alphabet letter and at least one uppercase alphabet letter. We also want the email to be syntactically valid with regard to the <tt>@</tt> and the <tt>.</tt>. <a href="http://stackoverflow.com/questions/201323/what-is-the-best-regular-expression-for-validating-email-addresses/1931322#1931322">We shouldn't care about the actual characters in the email address</a>.<br /><pre><br /><br /> <span class="codekeyword">private</span> Long <span class="codeproperty">id</span>;<br /> <span class="codeannotation">@NotNull</span>(message = <span class="codevalue">"Please enter username"</span>)<br /> <span class="codekeyword">private</span> String <span class="codeproperty">username</span>;<br /> <span class="codeannotation">@NotNull</span>(message = <span class="codevalue">"Please enter password"</span>)<br /> <span class="codeannotation">@Pattern</span>(regexp = <span class="codevalue">".*(?=.{8,})(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).*"</span>, message = <span class="codevalue">"Password is not strong enough"</span>)<br /> <span class="codekeyword">private</span> String <span class="codeproperty">password</span>;<br /> <span class="codeannotation">@NotNull</span>(message = <span class="codevalue">"Please enter email"</span>)<br /> <span class="codeannotation">@Pattern</span>(regexp = <span class="codevalue">"([^.@]+)(\\.[^.@]+)*@([^.@]+\\.)+([^.@]+)"</span>, message = <span class="codevalue">"Email is not in valid format"</span>)<br /> <span class="codekeyword">private</span> String <span class="codeproperty">email</span>;<br /> <span class="codekeyword">private</span> Date <span class="codeproperty">birthdate</span>;<br /><br /></pre><br />Rinse and repeat.<br/><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjlTon0fp3N3RcCSTuXbbdRyQE4NheiJcSPbEF9QKWfIz0mfNc4PerD7JJZfP2hsAHQW9UKWfHuPAoco1037Pxkhe5KvCuwCNCvlp9xo_-tGarooFMQsVskdoNuhYccHYMLXMJZxZx-WA/s1600/Finetune-Validation-%252311.png"><img class="thumbnail" height="108" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjlTon0fp3N3RcCSTuXbbdRyQE4NheiJcSPbEF9QKWfIz0mfNc4PerD7JJZfP2hsAHQW9UKWfHuPAoco1037Pxkhe5KvCuwCNCvlp9xo_-tGarooFMQsVskdoNuhYccHYMLXMJZxZx-WA/s200/Finetune-Validation-%252311.png" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx-RLkVKy3zcX25CCWGCKMIomUE6Y0-v3Uw66_KqPPjKzI2362twrLqTQ6mnE-DoKlel4m0f7MSW7d-k_5cj7Oa6zEsUPvgYq-K-nV5eOQbGY_SeNIL8K65vfQ7gKOtDlqO4ijRsrphcg/s1600/Finetune-Validation-%252312.png"><img class="thumbnail" height="150" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx-RLkVKy3zcX25CCWGCKMIomUE6Y0-v3Uw66_KqPPjKzI2362twrLqTQ6mnE-DoKlel4m0f7MSW7d-k_5cj7Oa6zEsUPvgYq-K-nV5eOQbGY_SeNIL8K65vfQ7gKOtDlqO4ijRsrphcg/s200/Finetune-Validation-%252312.png" /></a><br /><br /><br /></li><br /></ol><br /><h5><a href="#top">Back to top</a></h5><br /><br /><h4><a name="AndNow" href="#AndNow">And now?</a></h4><br /><p>Play with it! Head if necessary to <a href="http://balusc.blogspot.com/2011/09/communication-in-jsf-20.html">Communication in JSF 2.0</a> article to learn about some tips and tricks.</p><br /><p>Here are the most important JSF 2.0 related links to be bookmarked and read thoroughly:</p><br /><ul><li><a href="http://jcp.org/aboutJava/communityprocess/final/jsr314/index.html">JSF 2.0 specification</a> (pick the 1st download link), it explains why JSF is there, how it works and what it all provides.</li><br /><li><a href="http://download.oracle.com/docs/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/api/index.html">JSF 2.0 API documentation</a>, it contains detailed javadocs of the JSF API classes, it explains where the classes are for, how to use them and what all fields/methods do.</li><br /><li><a href="http://download.oracle.com/javaee/6/javaserverfaces/2.0/docs/pdldocs/facelets/index.html">JSF 2.0 tag documentation</a>, it shows which JSF tags are all available, what they all do and which attributes they supports.</li><br /><li><a href="http://download.oracle.com/javaee/6/tutorial/doc/bnaph.html">Java EE 6 tutorial</a>, chapter 4 and on contains <strike>Sun's</strike> Oracle's own JSF 2.0 tutorial.</li><br /><li>If you want to get a book, I highly recommend the <a href="http://www.amazon.com/JavaServer-Faces-2-0-Complete-Reference/dp/0071625097">JSF 2.0: The Complete Reference</a>, one of its authors, Ed Burns, is the lead of the JSF specification. If you want to get a step further with Glassfish, then <a href="http://www.amazon.com/Beginning-Java-Platform-GlassFish-Professional/dp/1430219548/">Java EE 6 platform with GlassFish 3</a> is also an excellent choice.</li><br /><li>Another excellent online resource is the <a href="http://www.mkyong.com/tutorials/jsf-2-0-tutorials/">Mkyong.com JSF 2.0 Tutorials</a>. It contains lot of high quality JSF 2.0 examples (although there are unfortunately a bit too much advertisements, it's sometimes demotivating). There are other sites as well, but <i>please</i> don't even take a look at <a href="http://balusc.blogspot.com/2008/06/what-is-it-with-roseindia.html">Roseindia.net</a>.</li><br /></ul><br /><p>Finally you can check the <i>Favorites</i> section at the right column of this blog site for more interesting links (of which the majority of the older ones are still targeted on JSF 1.2, the future articles will cover JSF 2.0 anyway).</p><br /><h5><a href="#top">Back to top</a></h5><br /><br /><p class="note"><b>Copyright</b> - None of this article may be taken over without explicit authorisation.</p><br /><p class="update">(C) January 2011, BalusC</p><br /><div oncontextmenu='return false;' onmousedown='return false;' onselectstart='return false;'> <br /> Source:http://balusc.blogspot.com/2011/01/jsf-20-tutorial-with-eclipse-and.html<br></div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> Diposting oleh <span class='fn' itemprop='author' itemscope='itemscope' itemtype='http://schema.org/Person'> <span itemprop='name'>Unknown</span> </span> </span> <span class='post-timestamp'> di <meta content='http://rajapleci.blogspot.com/2014/02/jsf-20-tutorial-with-eclipse-and.html' itemprop='url'/> <a class='timestamp-link' href='https://rajapleci.blogspot.com/2014/02/jsf-20-tutorial-with-eclipse-and.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2014-02-16T13:01:00-08:00'>13.01</abbr></a> </span> <span class='post-comment-link'> </span> <span class='post-icons'> <span class='item-control blog-admin pid-1507639912'> <a href='https://www.blogger.com/post-edit.g?blogID=8971243793969201373&postID=5271949264168453230&from=pencil' title='Edit Entri'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=8971243793969201373&postID=5271949264168453230&target=email' target='_blank' title='Kirimkan Ini lewat Email'><span class='share-button-link-text'>Kirimkan Ini lewat Email</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=8971243793969201373&postID=5271949264168453230&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=8971243793969201373&postID=5271949264168453230&target=twitter' target='_blank' title='Bagikan ke X'><span class='share-button-link-text'>Bagikan ke X</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=8971243793969201373&postID=5271949264168453230&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Berbagi ke Facebook'><span class='share-button-link-text'>Berbagi ke Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=8971243793969201373&postID=5271949264168453230&target=pinterest' target='_blank' title='Bagikan ke Pinterest'><span class='share-button-link-text'>Bagikan ke Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> <div class='comments' id='comments'> <a name='comments'></a> <h4>Tidak ada komentar:</h4> <div id='Blog1_comments-block-wrapper'> <dl class='avatar-comment-indent' id='comments-block'> </dl> </div> <p class='comment-footer'> <div class='comment-form'> <a name='comment-form'></a> <h4 id='comment-post-message'>Posting Komentar</h4> <p> </p> <a href='https://www.blogger.com/comment/frame/8971243793969201373?po=5271949264168453230&hl=id' id='comment-editor-src'></a> <iframe allowtransparency='true' class='blogger-iframe-colorize blogger-comment-from-post' frameborder='0' height='410px' id='comment-editor' name='comment-editor' src='' width='100%'></iframe> <script src='https://www.blogger.com/static/v1/jsbin/2315299244-comment_from_post_iframe.js' type='text/javascript'></script> <script type='text/javascript'> BLOG_CMT_createIframe('https://www.blogger.com/rpc_relay.html'); </script> </div> </p> </div> </div> </div></div> </div> <div class='blog-pager' id='blog-pager'> <span id='blog-pager-newer-link'> <a class='blog-pager-newer-link' href='https://rajapleci.blogspot.com/2014/02/how-hashmap-works-in-java.html' id='Blog1_blog-pager-newer-link' title='Posting Lebih Baru'>Posting Lebih Baru</a> </span> <span id='blog-pager-older-link'> <a class='blog-pager-older-link' href='https://rajapleci.blogspot.com/2014/02/how-to-set-classpath-for-java-on.html' id='Blog1_blog-pager-older-link' title='Posting Lama'>Posting Lama</a> </span> <a class='home-link' href='https://rajapleci.blogspot.com/'>Beranda</a> </div> <div class='clear'></div> <div class='post-feeds'> <div class='feed-links'> Langganan: <a class='feed-link' href='https://rajapleci.blogspot.com/feeds/5271949264168453230/comments/default' target='_blank' type='application/atom+xml'>Posting Komentar (Atom)</a> </div> </div> </div></div> </div> </div> <div class='column-left-outer'> <div class='column-left-inner'> <aside> </aside> </div> </div> <div class='column-right-outer'> <div class='column-right-inner'> <aside> <div class='sidebar section' id='sidebar-right-1'><div class='widget BlogArchive' data-version='1' id='BlogArchive1'> <h2>Arsip Blog</h2> <div class='widget-content'> <div id='ArchiveList'> <div id='BlogArchive1_ArchiveList'> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2015/'> 2015 </a> <span class='post-count' dir='ltr'>(86)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2015/01/'> Januari </a> <span class='post-count' dir='ltr'>(86)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate expanded'> <a class='toggle' href='javascript:void(0)'> <span class='zippy toggle-open'> ▼  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/'> 2014 </a> <span class='post-count' dir='ltr'>(1384)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/12/'> Desember </a> <span class='post-count' dir='ltr'>(124)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/11/'> November </a> <span class='post-count' dir='ltr'>(120)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/10/'> Oktober </a> <span class='post-count' dir='ltr'>(124)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/09/'> September </a> <span class='post-count' dir='ltr'>(120)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/08/'> Agustus </a> <span class='post-count' dir='ltr'>(124)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/07/'> Juli </a> <span class='post-count' dir='ltr'>(124)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/06/'> Juni </a> <span class='post-count' dir='ltr'>(120)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/05/'> Mei </a> <span class='post-count' dir='ltr'>(124)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/04/'> April </a> <span class='post-count' dir='ltr'>(120)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/03/'> Maret </a> <span class='post-count' dir='ltr'>(124)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate expanded'> <a class='toggle' href='javascript:void(0)'> <span class='zippy toggle-open'> ▼  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/02/'> Februari </a> <span class='post-count' dir='ltr'>(112)</span> <ul class='posts'> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-increase-java-heap-space-on.html'>How to increase java heap space on Maven and ANT</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-use-java-1-7-multiple-catch.html'>How to use Java 1. 7 Multiple Catch Block with exa...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-15-java-multithreading-concurrency.html'>Top 15 Java Multithreading, Concurrency Interview ...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/difference-between-classnotfoundexcepti.html'>Difference between ClassNotFoundException vs NoCla...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/why-multiple-inheritances-are-not.html'>Why multiple inheritances are not supported in Java</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/string-vs-stringbuffer-vs-stringbuilder.html'>String vs StringBuffer vs StringBuilder in Java</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/10-tips-to-debug-java-program-in-eclipse.html'>10 Tips to Debug Java Program in Eclipse</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-resolve-javalangunsupportedclass.html'>How to resolve java.lang.UnsupportedClassVersionEr...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/list-of-special-bash-parameter-used-in.html'>List of special bash parameter used in Unix or Li...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/3-exampls-to-convert-array-to-arraylist.html'>3 Exampls to Convert an Array to ArrayList in Java</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/10-example-of-using-vim-or-vi-editor-in.html'>10 example of using Vim or VI editor in UNIX and L...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/3-ways-to-solve-javalangnoclassdeffound.html'>3 ways to solve java.lang.NoClassDefFoundError in ...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-use-comparator-and-comparable-in.html'>How to use Comparator and Comparable in Java? With...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/10-examples-of-grep-command-in-unix-and.html'>10 examples of grep command in UNIX and Linux</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-30-programming-questions-asked-in.html'>Top 30 Programming questions asked in Interview - ...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorial-reliability-parameter.html'>Tibco tutorial : Reliability Parameter Explained</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-volatile-in-java-works-example-of.html'>How Volatile in Java works? Example of volatile ke...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/10-example-of-using-arraylist-in-java.html'>10 example of using ArrayList in Java &gt;&gt;&gt;...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/why-wait-notify-and-notifyall-called.html'>Why wait notify and notifyAll called from synchron...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-30-unix-command-interview-questions.html'>Top 30 UNIX command Interview Questions asked in I...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/10-points-about-java-heap-space-or-java.html'>10 points about Java Heap Space or Java Heap Memory</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorials-for-beginners.html'>Tibco Tutorials for beginners</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-10-tips-on-logging-in-java-tutorial.html'>Top 10 Tips on Logging in Java - Tutorial</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/java-synchronization-tutorial-what-how.html'>Java Synchronization Tutorial : What, How and Why?</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/difference-between-concurrenthashmap.html'>Difference between ConcurrentHashMap, Hashtable an...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/fix-protocol-tutorial-for-beginners.html'>FIX Protocol Tutorial for beginners</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-create-update-and-remove-soft.html'>How to Create, Update and Remove Soft link in UNIX</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-10-java-serialization-interview.html'>Top 10 Java Serialization Interview Questions and ...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/unix-command-tutorial-tips-and-examples.html'>UNIX Command Tutorial, Tips and Examples for Begin...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-garbage-collection-works-in-java.html'>How Garbage Collection works in Java</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/replaying-messages-in-fix-protocol.html'>Replaying messages in FIX protocol</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-20-core-java-interview-questions.html'>Top 20 Core Java Interview Questions and Answers a...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-enable-doclinks-in-custom-maximo.html'>How to enable doclinks in a custom Maximo application</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-schedule-preventive-maintenance.html'>How to schedule Preventive Maintenance at the firs...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/understanding-dataloss-advisory-in.html'>Understanding DATALOSS Advisory in Tibco Rendezvou...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/10-tips-on-working-fast-in-unix-or-linux.html'>10 Tips on working fast in UNIX or Linux</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/10-example-of-find-command-in-unix-and.html'>10 Example of find command in Unix and Linux</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-20-fix-protocol-interview-questions.html'>Top 20 FIX Protocol Interview Questions</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/10-singleton-pattern-interview.html'>10 Singleton Pattern Interview Questions in Java -...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-setup-java-remote-debugging-in.html'>How to setup Java remote debugging in Eclipse</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/overriding-equals-and-hashcode-method.html'>Overriding equals() and hashCode() method in Java ...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-execute-native-shell-commands.html'>How to execute native shell commands from Java Pro...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/fix-protocol-tutorials-difference.html'>FIX Protocol tutorials: Difference between Session...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/repeating-groups-in-fix-protocol.html'>Repeating groups in FIX Protocol</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-ledger-file-in-certified.html'>TIBCO Ledger file in Certified messaging : TIBCO T...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-implement-thread-in-java-with.html'>How to Implement Thread in Java with Example</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/fix-protocol-session-or-admin-messages.html'>FIX Protocol Session or Admin messages tutorial</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/introduction-to-tibco-hawk-as-tibco.html'>Introduction to Tibco Hawk as Tibco Tutorial</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-hashmap-works-in-java.html'>How HashMap works in Java</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/jsf-20-tutorial-with-eclipse-and.html'>JSF 2.0 tutorial with Eclipse and Glassfish</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-set-classpath-for-java-on.html'>How to Set Classpath for Java on Windows and Linux</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/difference-between-fix-42-vs-fix-44-in.html'>Difference between FIX 4.2 vs FIX 4.4 in FIX conne...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/things-to-note-down-while-writing-your.html'>Things to note down while writing your own FIX Eng...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-20-tibco-rendezvous-and-ems.html'>Top 20 Tibco Rendezvous and EMS Interview question...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorial-http-interface-of-tibco.html'>Tibco tutorial : Http Interface of Tibco RV</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorial-rvd-rendezeous-daemon-vs.html'>Tibco tutorial : RVD (Rendezeous daemon) vs RVRD (...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/basics-of-fix-protocol-and-fix-engine.html'>Basics of FIX protocol and FIX Engine</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/fix-protocol-tutorial-fix-session-is.html'>FIX protocol tutorial : Fix Session is not connect...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorial-tibrv-errors-and.html'>Tibco tutorial : Tibrv Errors and Exceptions</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorial-difference-between-tibco.html'>Tibco tutorial : Difference between Tibco EMS and ...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/financial-information-exchange-fix.html'>Financial Information Exchange (FIX) Protocol Inte...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/common-issue-on-financial-information.html'>Common issue on financial information exchange (FI...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/fix-protocol-and-fix-messaging.html'>FIX protocol and fix messaging interview questions</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/interview-question-asked-on-financial.html'>Interview question asked on Financial Information ...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/list-of-tibco-rv-ems-tutorials-tips.html'>List of Tibco RV, EMS Tutorials , Tips from Javare...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/add-description-field-in-unit-of.html'>Add description field in the Unit of Measure lookup</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorial-certified-messagging.html'>Tibco tutorial : Certified Messagging</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/what-are-builtin-properties-in-ant.html'>What are builtin Properties in ANT &gt;&gt; Tutor...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/editing-to-menu.html'>Editing &#39;Go To&#39; menu</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-30-eclipse-keyboard-shortcuts-for.html'>Top 30 Eclipse Keyboard Shortcuts for Java Programmer</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-write-buildxml-and-run-build-in.html'>How to write build.xml and run build in Apache ANT</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/hot-to-build-project-using-apache-ant.html'>Hot to build project using Apache ANT ? ANT Build...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/mysql-tutorial-and-commands-part-3.html'>MySQL tutorial and commands part 3</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/mysql-tutorial-mysqldump-utility-in.html'>MySql Tutorial : mysqldump utility in mysql</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/mysql-tutorial-and-commands-part-2.html'>MySQL tutorial and commands part 2</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-use-regular-expression-in-unix.html'>How to use Regular Expression in Unix Linux</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/mysql-tutorial-and-commands-part-1.html'>MySQL tutorial and commands Part 1</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/networking-basics-for-fix-connection-in.html'>Networking Basics for FIX Connection in Unix Linux</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/improving-performance-of-java.html'>Improving Performance of java application</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-10-basic-networking-commands-in.html'>Top 10 basic networking commands in linux/unix</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/top-10-most-useful-cvs-commands-in.html'>Top 10 Most useful cvs commands in linux/unix</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-avoid-deadlock-in-java-threads.html'>How to avoid deadlock in Java Threads</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/what-is-difference-between-synchronized.html'>What is difference between Synchronized and Concur...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/what-is-difference-between-hashmap-and.html'>What is difference between HashMap and Hashtable i...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/what-is-difference-between-enumeration.html'>What is difference between Enumeration and Iterato...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/fundamentals-of-object-oriented.html'>Fundamentals of Object Oriented Programming in Java</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/what-is-abstraction-in-java-abstract.html'>What is Abstraction in Java? Abstract Class or Int...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorial-tibco-rendezvous-or.html'>TIBCO Tutorial : TIBCO Rendezvous or TIBCO RV me...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorial-fundamentals-of-tibco-rv.html'>Tibco Tutorial: Fundamentals of Tibco RV messagging.</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/tibco-tutorial-tibco-rv-tips-and.html'>Tibco tutorial : Tibco RV tips and commands</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/why-string-is-immutable-or-final-in-java.html'>Why String is Immutable or Final in Java</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-to-check-if-thread-holds-lock-on.html'>How to check if a thread holds lock on a particula...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/how-do-you-find-length-of-singly-linked.html'>How do you find length of a Singly Linked list</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/why-comparing-integer-using-in-java-5.html'>Why Comparing Integer using == in Java 5 is Bad?</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/what-is-use-of-class-ajavalangclassa-in.html'>What is the use of class “java.lang.Class” in ...</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/quick-maximo-development-environment.html'>Quick Maximo Development Environment Setup</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/disadvantages-of-jsf-bit-of-history.html'>Disadvantages of JSF, a bit of history</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/using-mvc-design-pattern-with-jspservlet.html'>Using the MVC design pattern with JSP/Servlet</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/fix-maximo-6-ui-problem-with-microsoft.html'>Fix Maximo 6 UI problem with Microsoft Explorer 8</a></li> <li><a href='https://rajapleci.blogspot.com/2014/02/using-html-in-jsf-messages.html'>Using HTML in JSF messages</a></li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://rajapleci.blogspot.com/2014/01/'> Januari </a> <span class='post-count' dir='ltr'>(48)</span> </li> </ul> </li> </ul> </div> </div> <div class='clear'></div> </div> </div></div> </aside> </div> </div> </div> <div style='clear: both'></div> <!-- columns --> </div> <!-- main --> </div> </div> <div class='main-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> <footer> <div class='footer-outer'> <div class='footer-cap-top cap-top'> <div class='cap-left'></div> <div class='cap-right'></div> </div> <div class='fauxborder-left footer-fauxborder-left'> <div class='fauxborder-right footer-fauxborder-right'></div> <div class='region-inner footer-inner'> <div class='foot no-items section' id='footer-1'></div> <table border='0' cellpadding='0' cellspacing='0' class='section-columns columns-2'> <tbody> <tr> <td class='first columns-cell'> <div class='foot no-items section' id='footer-2-1'></div> </td> <td class='columns-cell'> <div class='foot no-items section' id='footer-2-2'></div> </td> </tr> </tbody> </table> <!-- outside of the include in order to lock Attribution widget --> <div class='foot section' id='footer-3' name='Footer'><div class='widget Attribution' data-version='1' id='Attribution1'> <div class='widget-content' style='text-align: center;'> Tema Sederhana. Diberdayakan oleh <a href='https://www.blogger.com' target='_blank'>Blogger</a>. </div> <div class='clear'></div> </div></div> </div> </div> <div class='footer-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> </footer> <!-- content --> </div> </div> <div class='content-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> </div> <script type='text/javascript'> window.setTimeout(function() { document.body.className = document.body.className.replace('loading', ''); }, 10); </script> <script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/745881458-widgets.js"></script> <script type='text/javascript'> window['__wavt'] = 'AOuZoY5zlrjDnkUjKwb1X7yH81UNW6D-nA:1735166378461';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d8971243793969201373','//rajapleci.blogspot.com/2014/02/jsf-20-tutorial-with-eclipse-and.html','8971243793969201373'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '8971243793969201373', 'title': 'Raja PLECI', 'url': 'https://rajapleci.blogspot.com/2014/02/jsf-20-tutorial-with-eclipse-and.html', 'canonicalUrl': 'http://rajapleci.blogspot.com/2014/02/jsf-20-tutorial-with-eclipse-and.html', 'homepageUrl': 'https://rajapleci.blogspot.com/', 'searchUrl': 'https://rajapleci.blogspot.com/search', 'canonicalHomepageUrl': 'http://rajapleci.blogspot.com/', 'blogspotFaviconUrl': 'https://rajapleci.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'id', 'localeUnderscoreDelimited': 'id', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'isDynamicViewsAvailable': true, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Raja PLECI - Atom\x22 href\x3d\x22https://rajapleci.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22Raja PLECI - RSS\x22 href\x3d\x22https://rajapleci.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Raja PLECI - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/8971243793969201373/posts/default\x22 /\x3e\n\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Raja PLECI - Atom\x22 href\x3d\x22https://rajapleci.blogspot.com/feeds/5271949264168453230/comments/default\x22 /\x3e\n', 'meTag': '', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': false, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/361ce9cf7a112c52', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': 'Dapatkan link', 'key': 'link', 'shareMessage': 'Dapatkan link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Bagikan ke Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'X', 'key': 'twitter', 'shareMessage': 'Bagikan ke X', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Bagikan ke Pinterest', 'target': 'pinterest'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27id\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Baca selengkapnya', 'pageType': 'item', 'postId': '5271949264168453230', 'postImageThumbnailUrl': 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkGyfP8XqyTBJHGziEnDz8cwWorRPb765ET2hn5sFzYGXjQ_RmspcA8yvpQJAyTqz4M-nCfPB9hvh0nMMLHRVGPDA0LhBM3n782IsCow3a4RRqvl4u9ixBm9qKcjCCe1nBLQYIqKGWxRM/s72-c/Download-Java-SE-6-JDK-%252304.png', 'postImageUrl': 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkGyfP8XqyTBJHGziEnDz8cwWorRPb765ET2hn5sFzYGXjQ_RmspcA8yvpQJAyTqz4M-nCfPB9hvh0nMMLHRVGPDA0LhBM3n782IsCow3a4RRqvl4u9ixBm9qKcjCCe1nBLQYIqKGWxRM/s200/Download-Java-SE-6-JDK-%252304.png', 'pageName': 'JSF 2.0 tutorial with Eclipse and Glassfish', 'pageTitle': 'Raja PLECI: JSF 2.0 tutorial with Eclipse and Glassfish'}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Tautan disalin ke papan klip!', 'ok': 'Oke', 'postLink': 'Tautan Pos'}}, {'name': 'template', 'data': {'name': 'Simple', 'localizedName': 'Sederhana', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': false, 'variant': 'bold', 'variantId': 'bold'}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'JSF 2.0 tutorial with Eclipse and Glassfish', 'description': ' Fast menu Introduction Preparing Download and install Java SE 6 JDK Download and install Java EE 6 Web Profile SDK Download and...', 'featuredImage': 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkGyfP8XqyTBJHGziEnDz8cwWorRPb765ET2hn5sFzYGXjQ_RmspcA8yvpQJAyTqz4M-nCfPB9hvh0nMMLHRVGPDA0LhBM3n782IsCow3a4RRqvl4u9ixBm9qKcjCCe1nBLQYIqKGWxRM/s200/Download-Java-SE-6-JDK-%252304.png', 'url': 'https://rajapleci.blogspot.com/2014/02/jsf-20-tutorial-with-eclipse-and.html', 'type': 'item', 'isSingleItem': true, 'isMultipleItems': false, 'isError': false, 'isPage': false, 'isPost': true, 'isHomepage': false, 'isArchive': false, 'isLabelSearch': false, 'postId': 5271949264168453230}}]); _WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar', document.getElementById('Navbar1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/3846405171-lbx.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/1964470060-lightbox_bundle.css'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar-right-1', document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': 'Memuat\x26hellip;'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AttributionView', new _WidgetInfo('Attribution1', 'footer-3', document.getElementById('Attribution1'), {}, 'displayModeFull')); </script> </body> </html>