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 File -> New File.

  2. Select JavaServer Faces under Categories, JSF Composite Component under File Types, and click Next.

  3. In the New JSF Composite Component dialog, enter inputDate under File Name, components under Folder, and click Finish.

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

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

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

  7. Select File -> Save.