Create new RichFaces Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

Chapter 5. Component usage overview

After the <inputDate> component has been created you could use it on a page. Create a simple JSF project, called myapp for example, with only one JSP page that has a form with our <inputDate> component.

Here is the necessary page (index.jsp):



<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://mycompany.org/inputDate" prefix="my"%>
<html>
    <head>
        <title>My inputDate</title> 
    </head>
    <body>
        <f:view>
            <h:form>
                <my:inputDate value="#{bean.text}">
                    <f:facet name="caption">
                        <f:verbatim>
                            Calendar:
                        </f:verbatim>
                    </f:facet>
                </my:inputDate>
                <h:commandButton value="Submit" />
            </h:form>
        </f:view>
    </body>
</html>

In order to build this application, you should create a managed bean:



package app;
public class Bean {
    private String text = null;
    public Bean() {
    
    }
    public String getText() {
        return text;
    }
    public void setText(String text) {
        this.text = text;
    }
}

It is necessary to register your bean inside of the faces-config.xml file:



<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
    version="1.2">
    <managed-bean>
        <managed-bean-name>bean</managed-bean-name>
        <managed-bean-class>myapp.Bean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
</faces-config>

It is also necessary to take following steps:

Finally, you should be able to place this application on your Web server. To start your project, point your browser at http://localhost:8080/myapp/index.jsf.