<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head />
<ui:composition template="_template.xhtml">
<ui:define name="titulo">
Novo Autor
</ui:define>
<ui:define name="conteudo">
<h:form>
<h:messages id="messages" />
<fieldset>
<legend>Dados do Autor</legend>
<h:panelGrid columns="2">
<h:outputLabel value="Nome:" for="nome" />
<h:inputText id="nome" value="#{autorBean.autor.nome}"
required="true" requiredMessage="Nome do autor é Obrigatório" />
<h:commandButton value="Gravar" action="#{autorBean.gravar}">
<f:ajax execute="@form" render="@form :formTabelaAutores:tabelaAutores"/>
</h:commandButton>
</h:panelGrid>
</fieldset>
</h:form>
<fieldset>
<legend>Lista de Autores</legend>
<h:form id="formTabelaAutores">
<h:dataTable value="#{autorBean.autores}" var="autor"
id="tabelaAutores">
<h:column>
<f:facet name="header">Nome do Autor</f:facet>
<h:outputText value="#{autor.nome}" />
</h:column>
<h:column>
<h:commandLink value="Alterar"
action="#{autorBean.carregar(autor)}" />
</h:column>
<h:column>
<h:commandLink value="Remover" />
</h:column>
</h:dataTable>
</h:form>
</fieldset>
</ui:define>
<ui:define name="nomePagina">autor.xhtml</ui:define>
</ui:composition>
</html>