Hi all,
the book I’ve worked on the last months has finally been published!!

JBoss RichFaces 3.3

JBoss RichFaces is a rich component library for JavaServer Faces and an AJAX framework that allows easy integration of Ajax capabilities into complex business applications. Do you wish to eliminate the time involved in writing JavaScript code and managing JavaScript-compatibility between browsers to build an Ajax web application quickly?

This book goes beyond the documentation to teach you how to do that. It will show you how to get the most out of JBoss RichFaces by explaining the key components and how you can use them to enhance your applications. Most importantly, you will learn how to integrate Ajax into your applications without using JavaScript, but only standard JSF components. You will learn how to create and customize your own components and add them to your new or existing applications.

First, the book introduces you to JBoss RichFaces and its components. It uses many examples of Ajax components which, among others, include: Calendar, Data Table, ToolTip, ToolBar, Menu, RichEditor, and Drag ‘n’ Drop. All these components will help you create the web site you always imagined. Key aspects of the RichFaces framework such as the Ajax framework, skinnability, and Component Development Kit (CDK) will help you customize the look of your web application. As you progress through the book, you will see a sample application that shows you how to build an advanced contact manager. You’re also going to be amazed to know about the advanced topics you will learn such as developing new components, new skins, optimizing a web application, inserting components dynamically using Java instead of XHTML, and using JavaScript to manage components. This book is more than a reference with component example code: it’s a manual that will guide you, step by step, through the development of a real Ajax JSF web application.

What This Book Covers

  • Chapter 1: What is RichFaces covers the aims of the RichFaces framework, its components, and what you can do by using it in a web application.
  • Chapter 2: Getting Ready explains how to configure your environment by creating a simple project using the seam-gen tool, adding support to Seam and Facelets, and the manual configuration for the RichFaces libraries. We will understand the IDE that we can use while developing with the framework.
  • In Chapter 3: First Steps, you will learn to build Ajax applications by developing a simple example, the basics of RichFaces step by step, from creating the project to editing the code, using very important components and their Ajax properties.
  • Chapter 4: The Application covers how to create the basics of our project by having a look at the side technologies we might know, in order to build good applications. It will cover templating with Facelets, JBoss Seam authentication, and customization of the entities.
  • Chapter 5: Making the Application Structure explains us how to create the login and registration system of the website. We’ll look at all the features that a real application might have.
  • In Chapter 6: Making the Contacts List and Detail, we will develop the core feature of our application—contact management. We’ll learn about Ajax interaction and containers, and about new Ajax components that RichFaces offers.
  • Chapter 7: Finishing the Application explains how to finish building the application using the RichFaces components, and about customizing them.
  • In Chapter 8: Skin Customization, we’ll see all the powerful customization capabilities that the RichFaces framework offers.
  • Chapter 9: Creating a New plug ‘n’ skin covers how to create, customize, and package and deploy a new pluggable skin.
  • Chapter 10: Advanced Techniques explains you how to use and implement pushing, partial updates, and session expiration handling in order to develop advanced applications.
  • In Chapter 11: Component Development Kit, we’ll see how to start a project in order to develop a simple JSF Ajax component in a simple and effective way using the features the CDK offers.
  • Appendix: RichFaces Components Overview covers a list of all the components of RichFaces with their functionalities.

Example chapter
You can download a sample chapter, Chapter 8: Skin Customization, by clicking here.

Where to buy it
You can buy JBoss RichFaces 3.3 from the Packt Publishing website.

Free shipping to the US, UK, Europe and selected Asian countries. For more information, please read the Packt Publishing shipping policy.
Alternatively, you can buy the book from Amazon, BN.com, Computer Manuals and most internet book retailers.

Thank you!

Demetrio

, , , , , , , , , , , , , , ,

Adding Cache support to a Seam project (Seam 2.1.x) it’s very simple and it is described in the official Seam developer documentation, anyways it doesn’t explain the exact steps to accomplish the task into an EAR project, I’m writing them to make your life even more simple :P

  • Add treecache.xml (you can find it into the seam blog example) to /resources/META-INF/
  • Open build.xml for editing, go to the “ear” target and tell to copy the treecache.xml file:
    <target name=”ear” description=”Build the EAR structure in a staging directory”>

        <copy todir=”${ear.dir}/META-INF”>
            <fileset dir=”${basedir}/resources/META-INF”>
                <include name=”application.xml”/>
                <include name=”jboss-app.xml”/>
                <include name=”seam-deployment.properties”/>
                <include name=”treecache.xml”/>
            </fileset>
        </copy>
    </target>
  • Edit components.xml, add the following XMLNS:
    xmlns:cache=”http://jboss.com/products/seam/cache”The following schema location:
    http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.1.xsd 

    And the following declaration:
    <cache:jboss-cache-provider configuration=”META-INF/treecache.xml” />

  • Edit deployed-jars-ear.list and add the required JARs, I used the JBoss Cache 1.x for JBoss AS 4.2.X:
    jboss-cache.jar
    jgroups.jarHere there is the list of jars (and versions) for other configurations.

And here you find the way how to use it in your projects.

Hope you liked it.

Demetrio

, , , , , ,

 

Adding a one-to-one relationship with shared primary key can become a difficult task if the main table key is an auto-generated one.

Even the Hibernate Annotations documentation example only works with not auto-generated id, if you try to use an auto incremental id, for example, 

it’s impossible to persist the 2 tables at the same time.

Surfing on the net I’ve seen some ppl with this kind of problem (I suppose one-to-one relationships are not so common, don’t know why) and most of ppl use the foreign-key approach that works ok but it’s not clean from my point of view, so I wanted to find a solution for my case.

The original example from the Hibernate Annotations Documentation is:

@Entity
public class Body {

    @Id
    public Long getId() { return id; }

    @OneToOne(cascade = CascadeType.ALL)
    @PrimaryKeyJoinColumn
    public Heart getHeart() {
        return heart;
    }

    …

}

 

@Entity
public class Heart {

    @Id
    public Long getId() { … }

}

As you can see this as not auto generated id and will not work just putting the @GeneratedValue annotation.

The final solution is:

@Entity
public class Body {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    public Long getId() { return id; }

    @OneToOne(cascade = CascadeType.ALL)
    @PrimaryKeyJoinColumn
    public Heart getHeart() {
        return heart;
    }

    …

}

@Entity
public class Heart {

    @Id
    @GeneratedValue(generator=”foreign”) 
    @GenericGenerator(name=”foreign”, strategy = “foreign”, parameters = {@Parameter(name=”property”, value=”body”)})
    public Long getId() { …}

    @OneToOne(mappedBy=”heart”)
    public Body getBody() { … }

}

Now all works fine for me.
Thanks
Demetrio
, , , , , ,

Hi,

As you know yesterday Google enabled Java as the second language on Google App.

I registered to the test version and I want to try to run JSF…I started with Jsf 1.1 and it worked perfectly!!

I tried the JSF example that come with JBoss Tools, try it at:

http://2.latest.demetrio81280.appspot.com/pages/inputUserName.jsf

If you want to try it, these are the simple steps:

  1. Register to Google App (they says just 10000 ppl initially!)
  2. Download and install Google App plugin for Eclipse
  3. Create a Google App project with Eclipse
  4. Create a JSF 1.1 project using the template using JBoss Tools Eclipse plugin (or make your own JSF demo)
  5. Copy all the libraries of the JSF demo into the war/WEB-INF/lib/ directory of Google App project
  6. Copy the src java file of the JSF demo into the src directory of Google App project
  7. Copy the WebContent java file of the JSF demo into the war directory of Google App project
  8. Add this string:
    <sessions-enabled>true</sessions-enabled>
    on the appengine-web.xml file to enable the session
  9. If you used the JSF 1.1 JBoss Tools template you have to make the User bean serializable just adding implements Serializable to the User class

Done! You can now deploy and test it!!

When I’ll have more time I want to try JSF 1.2 and RichFaces, I think there will be more problems trying to run JBoss Seam (we’ll see! :) )

UPDATE: Facelets works perfectly in JSF 1.1, JSF 1.2 has a problem during startup (see here)

Demetrio

, , ,