<?xml version='1.0' encoding='UTF-8' ?><!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><ui:compositionxmlns="http://www.w3.org/1999/xhtml"xmlns:ui="http://java.sun.com/jsf/facelets"xmlns:f="http://java.sun.com/jsf/core"xmlns:h="http://java.sun.com/jsf/html"xmlns:sand="http://richfaces.org/sandbox"xmlns:a4j="http://richfaces.org/a4j"xmlns:rich="http://richfaces.org/rich"template="./../../template.xhtml"><ui:definename="htmlHead"><title>Focus sample</title></ui:define><ui:definename="header"><ui:includesrc="menu.xhtml"/></ui:define><ui:definename="content"><p>On initial request focus should be placed on username. This is because direct parent of focus component is not UIInput. In such situation focus is put on first UIInput in parent form. Please not that focus component is not direct child of form. This sample is to ensure you that UIInput is not searched within direct parent of focus component, but within nesting form.</p><ul><li>username gets default priority 0</li><li>email gets priority 1</li></ul><p>On form submit, when username is valid and email is invalid, focus should be placed on email.</p><p>On form submit, when all fields are valid, focus should be placed on username.</p><h:form><h:panelGridcolumns="3"><h:outputLabelvalue="Username"for="username"/><h:inputTextvalue="#{username}"id="username"required="true"/><h:messagefor="username"/></h:panelGrid><h:panelGridcolumns="3"><h:outputLabelvalue="Email"for="email"/><h:inputTextvalue="#{email}"id="email"required="true"/><h:messagefor="email"/><sand:focus/></h:panelGrid><h:commandButtonvalue="Submit"/></h:form><rich:insertsrc="/focus_5.xhtml"highlight="html"/></ui:define></ui:composition>