Listing 1

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window id="myWindow" title="Bob's search"
        xmlns:html="http://www.w3.w3.org/1999/xhtml"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:p>
  Search for:
  <html:input id="find-text"/>
  <button id="bobOK" label="My Button"/>
</html:p>
</window>

Listing 2

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window id="myWindow" title="Bob's search"
        xmlns:html="http://www.w3.w3.org/1999/xhtml"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:p>
  Search for:
  <html:input id="find-text"/>
  <button id="bobOK" label="My Button"
          oncommand="alert('This is Bob\'s label: ' +  event.target.label);
          return false;"/>
</html:p>
</window>

Listing 3

<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
          xmlns:xbl="http://www.mozilla.org/xbl"
          xmlns:html="http://www.w3c.w3.org/xhtml/19991999/xhtml"
          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

 <binding id="welcome">
  <content>
   <xul:text value="Welcome to Writing JSF Components, " />
   <xul:text value="Guest" xbl:inherits="value=name" />
   <xul:text value="!" />
      <xul:textbox id="your-name"
                   value="Guest"
                   xbl:inherits="value=name" />
  </content>
 </binding>
<binding id="bye">
    <content>
      <xul:text value="Welcome back, "/>
      <xul:text value="Guest" xbl:inherits="value=name" />
      <xul:text value="!" />
      <html:input type="button" value="Press me!" />
    </content>
  </binding>
</bindings>

Listing 4

<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
          xmlns:xbl="http://www.mozilla.org/xbl"
          xmlns:html="http://www.w3c.w3.org/xhtml/19991999/xhtml"
          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <binding id="welcome">
    <content>
      <xul:text value="Welcome to Writing JSF Components, " />
      <xul:text value="Guest" xbl:inherits="value=name" />
      <xul:text value="!" />
    </content>
    <implementation>
      <field name="bob">'Bob Reed'</field>
    </implementation>
  </binding>
  <binding id="bye">
    <content>
      <xul:text value="Welcome back, "/>
      <xul:text value="Guest" xbl:inherits="value=name" />
      <xul:text value="!" />
      <xul:button label="Submit" />
    </content>
  </binding>
</bindings>

Listing 5

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="bob.css" >
    <title>Mozilla XBL Example</title>
  </head>
  <body>
    <div><bob:welcome id="welcome"></bob:welcome></div>
    <div>
    <input type="button" value="Press me!"
    onclick="alert(document.getElementById('welcome').bob)" />
    </div>
  </body>
</html>

Listing 6

<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
          xmlns:xbl="http://www.mozilla.org/xbl"
          xmlns:html="http://www.w3c.w3.org/xhtml/19991999/xhtml"
          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<binding id="welcome">
  <content>
    <xul:text value="Welcome to Writing JSF Components, " />
    <xul:text value="Guest" xbl:inherits="value=name" />
    <xul:text value="!" />
    <html:input type="button" value="Press me!" />
    <xul:button label="Press me!" />
  </content>
  <implementation>
    <field name="bob">'Bob Reed'</field>
  </implementation>
  <handlers>
    <handler event="click"
             action="alert(document.getElementById('welcome').bob); "/>
  </handlers>
</binding>

Listing 7

<?xml version="1.0" encoding="utf-8" ?>
<jsp:root version="1.2"
          xmlns:jsp="http://java.sun.com/JSP/Page"
          xmlns:bobh="http://www.bob.org/jsf/html"      
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html" >
  <jsp:directive.page contentType="text/html"/>
  <f:view>
    <h:form>
      <bobh:inputDate id="theDate" 
                      title="Other Date" 
                      value="#{backingBean.date}" >
        <f:convertDateTime pattern="d MMMMM yyyy" />
        <bobh:validateDate availability="#{backingBean.getAvailability}" />
      </bobh:inputDate>
      <br/>
      <h:message for="theDate" />
      <br/>
      <h:commandButton value="Submit" />
      <br/>
      <h:outputText value="#{backingBean.date}" >
        <f:convertDateTime pattern="d MMMMM yyyy" />
      </h:outputText>
    </h:form>
  </f:view>
</jsp:root>