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

, , ,

I had a little problem while working on a JBoss Seam project: I used the MySQL decimal(10,2) type for price value but, while running seam tests, the hbm2ddl schema validator gave me this error:

Caused by: org.hibernate.HibernateException: Wrong column type: shippingCost, expected: numeric(10,0)
[testng]     at org.hibernate.mapping.Table.validateColumns(Table.java:261)
[testng]     at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1083)
[testng]     at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
[testng]     at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:317)
[testng]     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
[testng]     at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:918)
[testng]     at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:656)
[testng]     … 68 more

The problem is that hbm2java usa a wrong column definition for the entity property, in fact the @Column annotation on the property was:

@Column(name = “shippingCost”, nullable = false, precision = 10)

The solution is simple, just change it to:

@Column(name = “shippingCost”, nullable = false, precision = 10, scale=2, columnDefinition=”decimal(10,2)”)

Now the type is correctly defined and the schema validator doesn’t return any error.

Demetrio

Old posts

I’m moving my blog here, anyway you can find my old posts at the blogspot address (maybe one day I’ll find the time to pass them here):

http://demetrio812.blogspot.com/

Thanks!

Demetrio

Tributo a Fabrizio De Andrè a blog unificati

L’11 gennaio 2009 la musica italiana ricorda il grande Fabrizio De Andrè a dieci anni dalla sua scomparsa. 

Tra le 22.40 e le 22.50, un centinaio di radio italiane trasmetteranno, in contemporanea con lo speciale “Che tempo che fa” di Raitre dal titolo “Fabrizio 2009″, Amore che vieni amore che vai, la canzone scelta da Dori Ghezzi come simbolo di questo ricordo via etere.

L’idea è di rilanciare questa iniziativa anche sul web. Chiunque abbia un sito o un blog, quel giorno dedichi un post al grande Faber, pubblicando il video di “Amore che vieni, amore che vai“:

All’iniziativa può aderire chiunque, ecco la lista dei blog che parteciperanno:

http://malarablog.wordpress.com (Domenico Malara)
http://amatoblog.wordpress.com (Beppe Amato)
http://www.photosteno.it/blog (Stefano Costantino)
http://marcoursanowords.splinder.com (Marco Ursano)
http://www.massidestri.eu/mdblog (Massimiliano Destri)
http://www.taninoferri.com (Tanino Ferri)
http://lapinpi.spaces.live.com (Margherita Accardo)
http://www.bricioladipane.blogspot.com (Lucia Schillaci)
http://www.sergiobontempelli.net (Sergio Bontempelli)
http://ilsalli.altervista.org (Saverio Autellitano)
http://www.elsuenopasado.splinder.it (Mario Bertocchi)
http://blog.libero.it/contropotere/view.php (Marco Pittalis)
http://www.binarioloco.it (Massimo Frezza)
http://www.faberdeandre.com/public/forum (Marcello Motta)
http://sonia-magnolia75.spaces.live.com/default.aspx (Sonia Canorro)
http://blog.libero.it/newzealand (Massimo Morachioli)
http://blog.ildeposito.org (Il deposito dei canti di protesta)
http://www.cercanimali.com (Sabrina Calcagno)
http://blog.demetrio.it (Demetrio Filocamo)
http://ourjov.spaces.live.com (Giovanni Nostro)
http://deandre.forumfree.net (De Andrè Forum)
http://maurobiani.splinder.com (Mauro Biani)
http://blogdonna.wordpress.com (Valeria e Lucrezia Zingale)
http://faldoni.splinder.com (Lesath Ethan)
http://www.iusrheginum.net (Associazione studentesca universitaria RC)
http://www.bibamcdj.blogspot.com (Alessandro Checchi)
http://www.newz.it (Notizie da Reggio Calabria)
http://www.myspace.com/enricogiaretta (Enrico Giaretta)
http://mauriziomorabito.wordpress.com (Maurizio Morabito)
http://equilibri.wordpress.com (Maurizio Morabito)
http://ticopalabra.blogspot.com (Tico)
http://www.soundsblog.it (Dodo)
http://www.awayfromheaven.spaces.live.com (Mirko Tommasino)
http://www.zenigada.ilcannocchiale.it (Luca Cipriani)
http://www.lombricosociale.info (Angela Galasso)
http://www.wernermaresta.blogspot.com (Werner Maresta)
http://nomadi-ch.spaces.live.com (Paolo Califano)
http://www.myspace.com/nomadi_ch (Paolo Califano)
http://www.nomadi.ch (Paolo Califano)
http://incerteimpronte.blogspot.com/2009/01/inizio-dera.html (Laura Massera)
http://blogliaccio.blogspot.com (Franco De Nicola)
http://impia.helloweb.eu (Antonella Caridi)
http://stregamorgana22.spaces.live.com (Antonella Caridi)
http://iod.forumfree.net/?t=35799978 (Fabio D’Amelio)
http://www.magellano83.it (Giacomo Planeta)
http://www.ipaesaggidiparoledibelfagor.com (Maria Isabella D’Autilia)
http://www.nontrattare.splinder.com (Alessandro Menabue)
http://www.peppecunsolo.it (Giuseppe Cunsolo)
http://www.myspace.com/lusitania61 (Cinzia Savi)
http://www.robertobilli.it (Roberto Billi)
http://www.myspace.com/robertobilli (Roberto Billi)
http://guardandoilmondodaunoblo.spaces.live.com (Federina Cascino Rock)
http://www.pattionline.it (Patti On Line)
http://ilfantasticomondodilaura.wordpress.com (Laura Licata)
http://myspace.com/paddyjaygirl (Adele Fusacchia)
http://janefromthejungle.spaces.msn.com (Adele Fusacchia)
http://tvbright.spaces.live.com/default.aspx (Valeria Tirabasso)

Per maggiori informazioni clicca qui!

,

Purtroppo dopo gli enormi problemi avuto con il server dedicato (che ho prontamente disdetto) continuo ad avere problemi con i virtual server (che ovviamente non rinnoverò più alla scadenza): è da circa un mese che mando richieste di assistenza perché la password per l’accesso via ssh non funziona più senza motivo quindi vorrei resettarla…UN MESE!!!

Ho anche chiamato ma ho capito che il call center fa la stessa richiesta che faccio io via email, comunque ancora nessuno mi ha contattato né scritto!!

Una vergogna!!

Demetrio

,

Questo è quello che succede quando una compagnia (the coca cola company) regala mini lattine di alluminio (quanto spreco!) senza prevedere dei cestini capienti e un popolo di tamarri le prende e le butta dove capita, purtroppo non ho fatto le foto ai giardini pieni di lattine…

Evviva il rispetto dell’ambiente!

Demetrio

, , ,

Ho trovato questo post del 2001 sulla Programmazione Windows tra le mie cose salvate, è vecchio ma ancora divertente :)

 

Breve storia della programmazione Windows

Al principio, c’erano le API di Windows e “l’inferno delle DLL”, che roba e’? direte voi, semplice! E’ quella condizione per cui si installa un nuovo programma e 1) il programma non funziona e 2) tutto il resto smette di funzionare. Questo perche’ quel coglione che ha scritto l’installazione ha fatto in modo che questa sovrascrivesse 100 DLL di sistema che erano gia’ presenti, mentre non ne ha sovrascritte altre 100.

Dopo un po’ di tempo Microsoft invento’ VERSIOINFO, cioe’ la possibilita’ di ficcare dentro la DLL un numero di versione che il programma di installazione fatto bene (nessuno quindi) dovrebbe verificare per evitare di sovrascrivere una DLL piu’ nuova con una piu’ vecchia. OOOOOOOHHHHH!!!!

Ma nello stesso tempo, un altro gruppo di sviluppo all’interno di Microsoft stessa scopri’ un baco colossale nel DDE: che non lo avevano fatto loro! Cosi’ inventarono OLE, che e’ come il DDE, ma diverso, e proclamarono che l’OLE avrebbe risolto “l’inferno delle DLL”.

Ma poco tempo dopo, Microsoft “vide la luce” e le MFC emersero come soluzione ad ogni problema possibile immaginabile, be’ OLE non se ne stette seduto sugli allori, cosi’ riemerse come COM, che e’ come OLE, ma diverso (!).

Ma un altro gruppo di sviluppatori Microsoft scopri’ un baco colossale nelle MFC: non le avevano scritte loro! Essi procedettero a correggere il problema introducendo le ATL, che sono come le MFC, ma diverse, e nello stesso tempo si diedero da fare per nascondere tutti quei bei dettagli relativi a COM (o era OLE?) che il gruppo COM stava cercando di spiegarci.

Questo spinse il gruppo COM a cambiare nome, cosi’ vide la luce ActiveX, che e’ esattamente come OLE (o COM?) ma diverso, inoltre utilizza un’innovativo sistema di interfacce che (indovina un po’) elimina “l’inferno delle DLL”, non solo, ma rende anche il nostro codice scaricabile da Internet (insieme a tutti i virus dell’universo).

Come un figlio misconosciuto, il gruppo OS richiamo’ l’attenzione sul nuovo nato: Cairo che nessuno riusci’ mai a spiegare, lasciamo perdere poi produrre e distribuire. Nonostante cio’ questi introdussero un’affascinante meccanismo di protezione dei file che era espressamente pensato per eliminare l’inferno delle DLL!

A questo punto pero’, il gruppo di sviluppo linguaggi scopri’ un terribile errore in Java: non lo avevano fatto loro! Il rimedio fu la creazione di “J” o Jole o ActiveJ, che era come Java, ma diverso… tutto questo era molto eccitante, ma Sun apri’ un contenzioso contro Microsoft sostenendo che c’e’ un limite al quantitativo di schifezze che puoi rilasciare in un determinato tempo, e questo mise fine a “J” (o era Jole?).

Ovviamente tutto questo distolse l’attenzione da ActiveX (o era COM?), i quali pero’ ritornarono alla ribalta con COM+ (ma non avrebbe dovuto essere ActiveX+?) ed MTS (che non ho mai capito perche’ sia solo ‘MTS’ e non abbia dentro un qualche ‘Active’ o ‘+’ o ‘COM’…).

Nello stesso tempo pero’, un altro gruppo se ne usci’ con Windows DNA, che pero’ scomparve prima che io avessi avuto il tempo di capire a che cosa era uguale pero’ diverso…

Recentemente poi, Microsoft ha scoperto un altro terribile errore in Internet: che non lo hanno fatto loro! Ecco quindi la creazione di .NET, che e’ come Internet, ma con piu’ marketing. E che (sia chiaro questo) eliminera’ l’inferno delle DLL! Inoltre introduce un bellissimo linguaggio detto C# (c’era un errore terribile in Java come detto prima), e distribuira’ un bellissimo runtime che consentira’ di eseguire i programmi (c’e’ un errore terribile nel farlo fare alla CPU), inoltre include un esclusivo sistema di login centralizzato (c’e’ un errore terribile nel non inserire tutte le vostre password in un server Microsoft) e che rivoluzionera’ il modo di programmare…

Ma intanto, il gruppo OS e’ ritornato alla ribalta, hanno scoperto un errore colossale in Windows NT: non lo hanno fatto loro! (a no?), ma hanno pronta la soluzione: Window XP! (perche’ non Windows XP+ o ActiveWindows?) il quale (indovina un po’) eliminera’ l’inferno delle DLL!

…io intanto continuo ad usare Linux…

Davide Bianchi
13 Febbraio 2001

WordPress Loves AJAX