Version 28

    Getting Started with the JBoss Ajax4jsf CDK


    Configuring the Environment


    Install and configure the Maven how it is shown at Ajax4jsf. Maven Repository Configuration


    Project Structure


    The environment is now set up to use the CDK. Let's use it to make a dummy component for a quick test of the CDK to make sure everything is in place. To do this, we will create a project, a component library within this project, and then a component within this component library. Finally, we'll build the component library.


    Set Up the Project


    • Create a new directory

    • Create a file named pom.xml in the directory with the following content:


    <?xml version="1.0" encoding="UTF-8"?>


    Here is what some of these elements are used for:



    Prefix for the Java package structure of your library


    Name space for your library to be used in the TLD file


    Version of your library


    Set Up the Component Library


    • In the project directory you just created, launch the following command (all in one line):


    mvn archetype:create -DarchetypeGroupId=org.richfaces.cdk -DarchetypeArtifactId=maven-archetype-jsf-component  -DarchetypeVersion=3.1.2.GA -DartifactId=mylib


    A new directory with the name mylib will be created. It does not have any components in it yet, but it has this predefined structure:



    Contains the metadata for the components


    Contains Java code (both pre-generated and created by you)


    Used to store resource files, such as pictures, JavaScript, and CSS files


    Will contain the JSP-like templates that define the component layout


    Set Up the Component


    • Go to the mylib directory

    • Launch the following command:


    mvn cdk:create -Dname=panel


    This command creates a skeleton for a new component called panel. Three artifacts will be created:


    • An XML configuration file for the metadata

    • A UI class

    • A JSP-like template


    Build the Component Library


    • Staying in the mylib directory, launch the following command:


    mvn install


    This command generates and compiles the library and then creates a result JAR file. A directory named target will be created along with a src directory. If you get a file named target/mylib-1.0-SNAPSHOT.jar as a result of mvn install, everything is set up OK. From here, you can start to create real components.


    More About...