title: How to define an onLoad function in JSF template that will be defined elsewhere
body: <p>I'm designing the view for my site, which has a standard login and landing page, and I want to have an onLoad function called for my login page, but not for my other pages (yet). I've got a template.xhtml file, which has this insert:</p>
  
  <p><code>
      &lt;div id="content"&gt;
          &lt;ui:insert name="content"/&gt;
      &lt;/div&gt;
  </code></p>
  
  <p>Then in login.xhtml I have:</p>
  
  <p><code>
      &lt;ui:define name="content"&gt;
      ...
      &lt;/ui:define&gt;
  </code></p>
  
  <p>Normally I would put this in login.xhtml:</p>
  
  <p><code>
      &lt;body onload="document.getElementById('login_form:name').focus();"&gt;
  </code></p>
  
  <p>But since I'm using JSF's ui composition tags, I can't have the <code>&lt;body/&gt;</code> tag in login.xhtml (at least the way I am attempting to do it).</p>
  
  <p>Is there a way to accomplish this with the structure I've described? The way I would think of doing it is to have onLoad call a function in the template, and then each page with ui:define would populate this function. Is that possible?</p>
  
  <p>Thanks!</p>