<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple JSF Demo</title>
<link rel="stylesheet" type="text/css" href="../../css/example.css" />
</head>
<body>
<f:view>
<h1>Simple JSF Demo</h1>
<hr noshade="noshade"/>
<h:messages/>
<h:form id="personForm">
<table>
<tr><td>* Lastname: </td><td><h:inputText id="lastname" value="#{SimpleManagedBean.personBean.lastname}" size="40"/></td></tr>
<tr><td>* Firstname: </td><td><h:inputText id="firstname" value="#{SimpleManagedBean.personBean.firstname}" size="40"/></td></tr>
<tr><td> Address: </td><td><h:inputText id="address" value="#{SimpleManagedBean.personBean.address}" size="80"/></td></tr>
<tr><td> Weight: </td><td><h:inputText id="weight" value="#{SimpleManagedBean.personBean.weight}" size="5"/></td></tr>
<tr>
<td> Birthdate: </td>
<td>
<h:inputText id="birthdate" value="#{SimpleManagedBean.personBean.birthdate}" size="20">
<f:convertDateTime type="date" pattern="dd.MM.yyyy"/>
</h:inputText>
</td>
</tr>
</table>
<p>What is your favorite color?:
<h:selectOneMenu id="color" value="#{SimpleManagedBean.personBean.color}">
<f:selectItem itemValue="red" itemLabel="Red" />
<f:selectItem itemValue="green" itemLabel="Green" />
<f:selectItem itemValue="blue" itemLabel="Blue" />
</h:selectOneMenu>
</p>
<p><h:selectBooleanCheckbox id="married" value="#{SimpleManagedBean.personBean.married}"/> Are you married?</p>
<p>How much do you like yourself?: <br/>
<h:selectOneRadio id="rating" value="#{SimpleManagedBean.personBean.rating}" >
<f:selectItem itemValue="1" itemLabel="Actually, I hate me" />
<f:selectItem itemValue="2" itemLabel="Not so much" />
<f:selectItem itemValue="3" itemLabel="I'm indifferent" />
<f:selectItem itemValue="4" itemLabel="I'm pretty neat" />
<f:selectItem itemValue="5" itemLabel="I'm totally in love with me" />
</h:selectOneRadio>
</p>
<p>
<h:commandButton id="submit" action="#{SimpleManagedBean.addPerson}" value="Submit" />
<h:commandButton id="cancel" action="#{SimpleManagedBean.cancel}" value="Cancel" />
</p>
</h:form>
<br/>
<hr noshade="noshade" />
<h:dataTable value="#{SimpleManagedBean.allPersons}" var="row" border="1">
<h:column>
<f:facet name="header">
<h:outputText value="Last Name"/>
</f:facet>
<h:outputText value="#{row.lastname}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="First Name"/>
</f:facet>
<h:outputText value="#{row.firstname}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Address"/>
</f:facet>
<h:outputText value="#{row.address}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Weight"/>
</f:facet>
<h:outputText value="#{row.weight}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Birthdate"/>
</f:facet>
<h:outputText value="#{row.birthdate}">
<f:convertDateTime type="date" pattern="dd.MM.yyyy"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Color"/>
</f:facet>
<h:outputText value="#{row.color}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Married"/>
</f:facet>
<h:outputText value="#{row.married}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Rating"/>
</f:facet>
<h:outputText value="#{row.rating}"/>
</h:column>
</h:dataTable>
</f:view>
</body>
</html>