Your First Cup: An Introduction to the Java EE Platform

ProcedureCreating the inputDate Composite Component

Create the inputDate composite component as a resource in the components resource library.

  1. In the firstcup project select the resources/components directory and then select File->New File.

  2. Select JavaServer Faces under Categories, Facelets Simple File under File Types, and click Next.

  3. Enter inputDate under File Name and click Finish.

  4. In the newly created inputDate.xhtml replace the <html> tag with the following:

    <html xmlns="" xml:lang="en" lang="en"

    The inputDate.xhtml composite component uses the Facelets Composite Component, the HTML Render Kit, and the JSF Core tag libraries.

  5. Add the composite component interface definition between the <body> and </body> tags in inputDate.xhtml:

    		<composite:attribute name="date" required="true" />
  6. Add the composite component implementation below the interface definition:

    		<h:inputText value="#{}">
    			<f:convertDateTime pattern="MM/dd/yyyy" />
  7. Right-click in the editor window and select Format.

  8. Select File->Save.