The Source for Java Technology Collaboration


Wiki FAQ for the jsf-extensions Project

DynaFaces Questions

General DynaFaces Questions

General Questions

What is jsf-extensions?

jsf-extensions is a collection of non-UI components that extend the functionality of a JSF 1.2 based web-app. Most importantly, it includes support for AJAX.

Using jsf-extensions

How do I use it?

Download the binary in the "releases" directory of the Documents and Files section.

Is There a Sample WAR to Try?

There are two online sample apps linkd at the main project home page.

What are the Requirements for using jsf-extensions?

jsf-extensions is designed for JSF 1.2 and requires a JSF 1.2 implementation. Currently, Sun's Glassfish Project is the only such publically available implementation.

Improving jsf-extensions

Where do I file bugs?

In the Issue Tracker.

What are the Governance and Licensing Policies for jsf-extensions?

The same as those in the glassfish project. The license is Sun's Common Development and Distribution License.

How do I become a committer?

Please see the answer in the javaserverfaces FAQ.

What is the Relationship Between jsf-extensions and the Glassfish Project?

Currently, jsf-extensions depends on a JSF 1.2 implementation, and right now that means Glassfish. There is nothing in the current jsf-extensions codebase that leverages any implementation specific features, however, so when other JSF 1.2 implementations become available, jsf-extensions are expected to run there as well.

Where is the source code?

The source code is in subversion in the jsf-extensions project. Please follow the "Version control - SCM" link at https://jsf-extensions.dev.java.net/source/browse/jsf-extensions/. Once there, click on the "Access Options" link.

The source code for jsf-extensions that works with JSF 1.2 is at https://jsf-extensions.dev.java.net/svn/jsf-extensions/branches/jsf-extensions-0_1_BRANCH

The source code for jsf-extensions that works with JSF 2.0 is at https://jsf-extensions.dev.java.net/svn/jsf-extensions/trunk

How do I Build It for JSF 1.2?

Requirements

  1. Java EE 5 SDK (or Project Glassfish build 43 or later)
  2. Maven 2
  3. Subversion

Install the above on your machine, making sure the hardware and software requirements for each are met. Make sure the java command that is first in your execution path is the Java SE 5 version.

Instructions

  1. If you are behind a firewall, configure maven and subversion so they can get through the firewall

    Maven Firewall Configuration

    1. Create a ~/.m2/settings.xml file. On windows, you'll have to figure out what your windows home directory is. You can use the following file as a guide.

      <?xml version="1.0" encoding="UTF-8"?>
      <settings>
        <localRepository>/jsfci1/edburns/m2repository</localRepository>
        <proxies>
          <proxy>
            <active/>
            <protocol>http</protocol>
            <port>8080</port>
            <host>webcache.sfbay.sun.com</host>
            <id/>
          </proxy>
          <proxy>
            <active/>
            <protocol>https</protocol>
            <port>8080</port>
            <host>webcache.sfbay.sun.com</host>
            <id/>
          </proxy>
        </proxies>
      
      </settings>
      

      The <localRepository> element is not related to proxy settings, but sometimes it is useful to place the repository in a different location. This is especially useful when your home directory is NFS mounted. You really want the repository to be on a disk local to the CPU running maven.

    2. When running the mvn executable, pass the necessary JVM options to enable the proxy. For example:

      
      mvn -Dhttp.proxyHost=webcache.sfbay.sun.com -Dhttp.proxyPort=8080 -Dhttps.proxyHost=webcache.sfbay.sun.com -Dhttps.proxyPort=8080
      

    Subversion Firewall Configuration

    Create a ~/.subversion/servers file. On windows, you'll have to figure out what your windows home directory is. You can use the following file as a guide.

    [groups]
    http-proxy-host = webcache.sfbay.sun.com
    http-proxy-port = 8080
    group1 = *.java.net
     
    [group1]
    http-proxy-host = webcache.east.sun.com
    http-proxy-port = 8080
    

  2. Using subversion, checkout out the code [[#SourceCode][as directed above.]

  3. cd to the directory containing run-time, assembly, and other directories, including the top level pom.xml file.

    Enter the command mvn.

    Remember, if you're behind a firewall, you'll need to add the -Dhttp.proxy and such, as shown previously.

    The first time you build it, it will download TONS of stuff so be prepared to wait. Subsequent times, you can add the -o flag to prevent it from downloading anything extra.

How do I Build It for JSF 2.0?

Make sure you have the software requirements listed in the section on building for JSF 1.2. Before building jsf-extensions, you must build the jsf 2.0 code from source. Change to the "jsf-api" directory and run the ant target "push-to-maven-prepare". This will push the jsf-api jar necessary to build jsf-extensions for JSF 2.0 to the local maven repository, where the jsf-extensions build will find it.


DynaFaces Questions

When editing some scripts locally, is there a way I can make sure all the dependencies are satisfied from the local filesystem?

Try putting something like this in your <head>:



<script type="text/javascript" src="/absolute/path/to/jsf-extensions-code/run-time/avatar/src/main/resources/prototype.js"></script>
<script type="text/javascript" src="/absolute/path/to/jsf-extensions-code/run-time/avatar/src/main/resources/effects.js"></script>
<script type="text/javascript" src="/absolute/path/to/jsf-extensions-code/run-time/avatar/src/main/resources/dragdrop.js"></script>
<script type="text/javascript" src="/absolute/path/to/jsf-extensions-code/run-time/avatar/src/main/resources/controls.js"></script>
<script type="text/javascript" src="/absolute/path/to/jsf-extensions-code/run-time/avatar/src/main/resources/com_sun_faces_ajax.js"></script>
<script type="text/javascript" src="/absolute/path/to/jsf-extensions-code/run-time/avatar/src/main/resources/com_sun_faces_ajax_zone.jsx"></script>

For example, for me this is:



<script type="text/javascript" src="/Users/edburns/Projects/J2EE/workareas/jsf-extensions-branch/run-time/avatar/src/main/resources/prototype.js"></script>
<script type="text/javascript" src="/Users/edburns/Projects/J2EE/workareas/jsf-extensions-branch/run-time/avatar/src/main/resources/effects.js"></script>
<script type="text/javascript" src="/Users/edburns/Projects/J2EE/workareas/jsf-extensions-branch/run-time/avatar/src/main/resources/dragdrop.js"></script>
<script type="text/javascript" src="/Users/edburns/Projects/J2EE/workareas/jsf-extensions-branch/run-time/avatar/src/main/resources/controls.js"></script>
<script type="text/javascript" src="/Users/edburns/Projects/J2EE/workareas/jsf-extensions-branch/run-time/avatar/src/main/resources/com_sun_faces_ajax.js"></script>
<script type="text/javascript" src="/Users/edburns/Projects/J2EE/workareas/jsf-extensions-branch/run-time/avatar/src/main/resources/com_sun_faces_ajax_zone.jsx"></script>

When using an ajaxZone, can I have only one event in there?

Sometimes inside an ajaxZone tag I could have a few events that would need the subview to be updated. If I had a listbox for example I could have three events:

  1. double click on a list element

  2. pressing enter after selecting a list element

  3. the regular onchange event when a different row is selected...

Can I fit something like this in a single "eventType" attibute? If not how would I accommodate this scenario?

The AjaxZone approach only allows one type of JavaScript event to be co-opted for use by DynaFaces. For example, "I want to co-opt the 'onclick' event for a subset of the HTML elements within this zone to cause an AJAX transaction to occurr". If you want to co-opt more than one event type, on different elements, you'll have to use Faces.Event or Faces.Command directly.

You can use the ajaxZone approach and the Faces.Event/Faces.Command approach together, by the way. For example, consider your inspectElement hook.

This hook returns true or false depending on whether or not you want the element ajaxified per the requirements you have listed as attributes on your ajaxZone tag. Let's say you're ajaxifying for the "onclick" event in the ajaxZone tag, but there are some elements you want to ajaxify for the "ondoubleclick" event. Your inspectElementHook will look something like this:


function inspectElement(element) {

  // Look at element, if it's to be ajaxified with the regular "onclick"
  // just return true.  Otherwise, see if it's to be ajaxified with
  // "ondoubleclick".  If so, perform the ajaxification manually, and
  // return false.

  var options = new Object();
  options.render = // client ids to re-render
  var c = new Faces.Command(element, "doubleclick", options);

  return false;
}

Topic JsfExtensionsFaq . { Edit | Ref-By | Printable | Diffs r21 < r20 < r19 < r18 < r17 | More }
 XML java.net RSS

Revision r21 - 25 Nov 2008 - 15:43:43 - Main.edburns
Parents: WebHome > Jsf-extensions