Your First Cup: An Introduction to the Java EE Platform

ProcedureAdding the Form to greeting.xhtml

Add the form that provides the user interface for displaying Duke's age and entering the user's birthday.

  1. In the firstcup project in greeting.xhtml add the following tags between the <body> and </body> tags.

    <h:form>
        <h2>
            <h:outputText value="#{bundle.Welcome}"/>
        </h2>
        <h:outputText value="#{bundle.DukeIs} "/>
        <h:outputText value="#{DukesBDay.age} #{bundle.YearsOldToday}"/>
        <p/>
        <h:outputText value="#{bundle.Instructions}"/>
        <p/>
        <h:outputText value="#{bundle.YourBD} "/>
        <fc:inputDate id="userBirthday" date="#{DukesBDay.yourBD}" />
        <h:outputText value=" #{bundle.Pattern}"/>
        <p/>
        <h:commandButton value="#{bundle.Submit}" action="#{DukesBDay.processBirthday}"/>
        <p/>
        <h:message for="userBirthday" style="color:red"/>
    </h:form>
  2. Right-click in the editor window and select Format.

  3. Select File -> Save.