Advertisement
hsianghui

IS3106 Lab2 Exercise 5 (createCustomer.xhtml)

Sep 16th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.38 KB | None | 0 0
  1. <?xml version='1.0' encoding='UTF-8' ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml"
  4.      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
  5.      xmlns:h="http://xmlns.jcp.org/jsf/html"
  6.      xmlns:f="http://xmlns.jcp.org/jsf/core"
  7.      xmlns:p="http://primefaces.org/ui">
  8.  
  9.     <body>
  10.  
  11.         <ui:composition template="./layout/default.xhtml">
  12.  
  13.             <ui:define name="title">
  14.                 New Customer
  15.             </ui:define>
  16.  
  17.             <ui:define name="content">
  18.                 <h:form>
  19.                     <p:panelGrid columns="2">
  20.                         <h:outputLabel for="name">Name: </h:outputLabel>
  21.                         <h:panelGroup>
  22.                             <h:inputText id="name" value="#{customerManagedBean.name}" required="true" requiredMessage="Name is required"/>
  23.                             <p:message for="name" />
  24.                         </h:panelGroup>
  25.                         <h:outputLabel>Gender:</h:outputLabel>
  26.                         <h:selectOneMenu value="#{customerManagedBean.gender}">
  27.                             <f:selectItem itemValue="1" itemLabel="Female" />
  28.                             <f:selectItem itemValue="2" itemLabel="Male" />
  29.                         </h:selectOneMenu>
  30.                         <h:outputLabel for="dob">Date of Birth (dd/mm/yyyy):</h:outputLabel>
  31.                         <h:panelGroup>
  32.                             <h:inputText id="dob" value="#{customerManagedBean.dob}"
  33.                                         required="true"  
  34.                                         requiredMessage="DOB is required"
  35.                                         converterMessage="Format should be dd/mm/yyyy">
  36.                                 <f:convertDateTime pattern="dd/MM/yyyy" />
  37.                             </h:inputText>
  38.                             <p:message for="dob" />
  39.                         </h:panelGroup>
  40.                     </p:panelGrid>
  41.                     <br />
  42.                     <h:commandButton value="Submit"
  43.                                     actionListener="#{customerManagedBean.addCustomer}"
  44.                                     action="searchCustomers?faces-redirect=true"/>
  45.                 </h:form>
  46.             </ui:define>
  47.  
  48.         </ui:composition>
  49.  
  50.     </body>
  51. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement