Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

So I see a lot of people here really trying to reinvent a lot of wheels here. You don't have to redo a lot of validators,converters,ui tags because there are some that have already been created. One such library is the Tomahawk library which was originally developed for the MyFaces JSF implementation.

To get this going for your application is simple.

  • Download the latest Tomahawk
  • Copy tomahawk-xxx.jar from your unpackaged download (located in the lib directory) to the your jboss-seam application's lib directory.
  • Download the latest Tomahawk Facelets implementation from Google Code . This is a library dedicated to making all of tomahawks components available for facelets.
  • Copy tomahawk-facelets-taglib.jar from your unpackaged download into jboss-seam application's lib directory.
  • Check your lib directory to see if you have commons-el.jar. If you don't download Commons EL from Apache Commons.
  • Copy commons-el.jar from your unpackaged download to the your jboss-seam application's lib directory.
  • Add the tomahawk-xxx.jar, tomahawk-facelets-taglib.jar, and commons-el.jar in your ant build under the war target (See Figure 1).
  • Now you can use tomahawk in your pages. Just be sure to add tomahawk as a xml namespace in your header to use the tags. (See Figure 2).

Figure 1

<target name="war" depends="compile"
            description="Build the  distribution .war file">
        <copy todir="${war.dir}">
            <fileset dir="${basedir}/view"/>
        </copy>
        <copy todir="${war.dir}/WEB-INF">
            <fileset dir="${basedir}/resources/WEB-INF">
                <include name="*.*"/>
                <include name="classes/**/*.*"/>
                <exclude name="classes/**/*.class"/>
            </fileset>
            <filterset>
                <filter token="debug" value="${debug}"/>
                <filter token="jndiPattern" value="${project.name}/#{ejbName}/local"/>
            </filterset>
        </copy>
        <copy todir="${war.dir}/WEB-INF">
            <fileset dir="${basedir}/resources/WEB-INF">
                <include name="lib/*.*"/>
                <include name="classes/**/*.class"/>
            </fileset>
        </copy>
        <copy todir="${war.dir}/WEB-INF/lib">
            <fileset dir="${lib.dir}">
                <include name="richfaces-impl*.jar"/>
                <include name="richfaces-ui*.jar"/>
                <include name="oscache*.jar"/>
                <include name="commons-digester.jar"/>
                <include name="commons-beanutils.jar"/>
                <include name="jsf-facelets.jar"/>
                <include name="jboss-seam-*.jar"/>
                <exclude name="jboss-seam-gen.jar"/>  
                <include name="tomahawk-1.1.6.jar"/> <!--ADDED-->
                <include name="tomahawk-facelets-taglib.jar"/> <!--ADDED-->
                <include name="commons-el.jar"/> <!--ADDED-->
            </fileset>
        </copy>
        <copy todir="${war.dir}/WEB-INF/classes">
            <fileset dir="${basedir}/resources">
                <include name="messages*.properties"/>
            </fileset>
        </copy>
    </target>

Figure 2

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:t="http://myfaces.apache.org/tomahawk"   
      xml:lang="en"
      lang="en">  <!--NOTICE THIS HEADER HAS CHANGED AND NOW CONTAINS XMLNS:T -->
<head>
    <title>User subform</title>
</head>
<body>
<ui:composition>
    <h:panelGrid columns="2">
        <h:outputLabel value="Email Address (used as login)" for="lastName"/>
        <h:panelGroup>
            <h:inputText value="#{user.emailAddress}"
                         id="emailAddress" required="true" size="50"/>
            <h:message for="emailAddress"/>
        </h:panelGroup>

        <h:outputLabel value="First Name" for="firstName"/>
        <h:panelGroup>
            <h:inputText value="#{user.firstName}"
                         id="firstName" required="true" size="50"/>
            <h:message for="firstName"/>
        </h:panelGroup>

        <h:outputLabel value="Last Name" for="lastName"/>
        <h:panelGroup>
            <h:inputText value="#{user.lastName}"
                         id="lastName" required="true" size="50"/>
            <h:message for="lastName"/>
        </h:panelGroup>

        <h:outputLabel value="Password" for="password"/>
        <h:panelGroup>
            <h:inputSecret value="#{user.password}"
                           id="password" required="true" size="50"/>
            <h:message for="password"/>
        </h:panelGroup>

        <h:outputLabel value="Password Match" for="passwordMatch"/>
        <h:panelGroup>
            <h:inputSecret value=""
                           id="passwordMatch" required="true" size="50">
                <t:validateEqual for="password"/>  <!==WANT TO MAKE SURE PASSWORDS MATCH? TRY THIS TAG! EASY!-->
            </h:inputSecret>
            <h:message for="passwordMatch"/>
        </h:panelGroup>
    </h:panelGrid>
</ui:composition>
</body>
</html>
3 comments:
 
23. Jul 2008, 00:53 America/New_York | Link

Great article. Thanks for posting it here. It helped me quite a bit.

Can you comment on the configuration of ExceptionFilter as seemed to be required by some of Tomahawk's component?

Thanks

 
23. Jul 2008, 01:05 America/New_York | Link

My apology Extensions Filter, not ExceptionFilter.

For example, when I used

<t:inputHtml .../>
, I received the following error when visit the page:

ExtensionsFilter not correctly configured. JSF mapping missing. JSF pages not covered. Please see: http://myfaces.apache.org/tomahawk/extensionsFilter.html
 
24. Nov 2009, 22:35 America/New_York | Link
Please, just put all you war libs inside 'deployed-jars-war.list', located in root of the seam app.