Getting started

Basic requirements

You have to know little about XUL and JSF to be able to start with xulfaces.

Check the following links:



XUL Planet is great site for XUL developers.

JSFCentral is a JSF portal, you can find lots of valuable links.

A sample page

This a very simple xulfaces page, empty.jsp from sample application :

			
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<%@ page contentType="application/vnd.mozilla.xul+xml" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="core"%>
<core:view>
<window	
	xmlns:html="http://www.w3.org/1999/xhtml"
	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
	
	<label>No properties</label>
		
		
</window>
</core:view>
			
		

The final document sent by the server is a XUL document. But, we use JSF and xulfaces to render it. The view tag is a JSF tag defining a JSF view, it's a core tag and it is required.

The body of the document is a well formed XUL document using XUL tags.

An error page

error.jsp from sample application :


<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<%@ page contentType="application/vnd.mozilla.xul+xml" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="core"%>
<%@ taglib uri="http://xulfaces.sourceforge.net/xulfaces/jsf/xul" prefix="xf"%>
<core:view>
<window		
	xmlns:html="http://www.w3.org/1999/xhtml"
	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
	xmlns:xfc="http://xulfaces.sourceforge.net/xulfaces/xul/client.xul">

	
	<vbox flex="1">
		<groupbox flex="1">
			<xf:label value="#{mesgCtrl.message}"/>
		</groupbox>
	</vbox>	
	
	<xf:bridge debug="true"/>	
</window>
</core:view>
			
		

This is a dynamic XUL document. We import the xulfaces tag lib for that purpose.

The name space "xfc" means that xulfaces add XML content to the generated XUL page.

xfc stands for xulfaces client : this is a set of tags interpreted by the xulfaces bridge.

The xulfaces bridge is a Javascript class which ensures communication between XUL client and application server.

It parses xfc content and triggers DOM update.

The tag "xf:bridge" render the xfc content and include the xulfaces-bridge.js

mesgCtrl is a managed bean with a message attribute (see faces-sample-config.xml). We use value binding technique to publish our bean attribute.

You must use the following pattern to access xulfaces page : http://host:port/webappname/page.xul