Wednesday, November 3, 2010

First Java EE 6 application

to create a Maven 2 Java EE 6 application. This will be primarily the UI part build with JSF. Primefaces is the library of choice to build the “windowshop” application. I will try to build a landing page similar to oscommerce. The figure 1 below shows a screenshot of the landing page mock up.


Figure 1 – Landing page prototype

Now let us create a Maven 2 web project using the - “maven-archetype-webapp”.

The listing below shows the pom.xml

Listing 1 – pom.xml

<project xmlns="" xmlns:xsi=""
    <name>shopweb Maven Webapp</name>
        <!-- Prime faces , JSF -->

            <name>Prime Technology Maven Repository</name>
            <name> Repository for Maven</name>
        </repository>     </repositories>

The web.xml need not have any entry as shown in listing 2. As per JSF 2 auto – registers FacesServlet which is required for JSF URL interpretation following the pluggability feature of Servlet 3. I will write about this feature and how this is enabled in JSF 2 in the next post. 

Listing.2 – web.xml

<web-app xmlns=""

Now let us modify the index.jsp page to redirect to the default home landing page as shown in listing 3.

Listing 3 – index.jsp

<jsp:forward page="ui/home.jsf"></jsp:forward>

I will add the facelet templates and the home page. These are all in the SVN now. I am lazy copying them over here.

You can add the JBOSS 5 server adapter in Eclipse to start stop JBOSS 6 for now. Add the shopweb project and start the server. Once deployment is over, browse to - http://localhost:8080/shopweb/. This should display the guest home page. I will work to make this page similar to the prototype in Figure 1.

No comments:

Post a Comment