index.xhtml 1.81 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"
      xmlns:watermark="http://richfaces.org/sandbox/watermark">
<head>
    <title>Watermark sample</title>
    <style type="text/css">
        .rich-container input.watermark {
            color: #777;
        }
    </style>
</head>

<body class="rich-container">
<ui:include src="menu.xhtml"/>
<h:messages/>

<p>

</p>
<rich:messages ajaxRendered="true"/>
<h:form id="theForm">
    <a4j:poll ajaxSingle="true" interval="5000"/>
    <a4j:queue requestDelay="400" ignoreDupResponses="true"/>

    <h:outputLabel value="Watermark text" for="text"/>
    <h:inputText id="text" value="#{watermarkBean.text}" required="true">
        <a4j:support event="onchange" ajaxSingle="true" reRender="theForm"/>
    </h:inputText>
    <h:commandButton value="Submit" action="#{watermarkBean.submit}"/>
    <br/><br/>
    <h:inputText id="watermarked" value="#{watermarkBean.watermarkedInput}">
        <watermark:watermark value="#{watermarkBean.text}"/>
    </h:inputText>

    <rich:calendar id="calendar" value="#{watermarkBean.date}" enableManualInput="true" ajaxSingle="true">
    </rich:calendar>
    <watermark:watermark value="#{watermarkBean.text}" for="calendar" suffix="InputDate"/>

    <rich:comboBox>
        <watermark:watermark value="#{watermarkBean.text}" suffix="comboboxField"/>
    </rich:comboBox>

    <input id="htmlInput"/>
    <watermark:watermark value="#{watermarkBean.text}" for="htmlInput"/>
</h:form>

<div id="status"></div>
<rich:insert src="/index.xhtml" highlight="xhtml"/>

</body>
</html>