Converters, Listeners and Validators in Java EE 7 (#1630)

This commit is contained in:
Jesus Boadas
2017-04-10 12:39:37 -04:00
committed by maibin
parent 3fd20f6479
commit b5e4c4e3e7
9 changed files with 181 additions and 6 deletions
+50
View File
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
<title>Converters, Listeners and Validators</title>
</h:head>
<h:body>
<h1>Testing converters</h1>
<h:form id="myform">
<h:outputLabel value="Age:"/>
<h:inputText id="age" value="#{convListVal.age}">
<f:converter converterId="javax.faces.Integer" />
</h:inputText>
<h:message id="ageError" for="age" />
<br/>
<h:outputLabel value="Average:"/>
<h:inputText id="average" value="#{convListVal.average}">
<f:converter converterId="javax.faces.Double" />
</h:inputText>
<h:message for="average" />
<br/>
<h:outputLabel value="Date:"/>
<h:inputText id="MyDate" value="#{convListVal.myDate}">
<f:convertDateTime pattern="dd/MM/yyyy" />
</h:inputText>
<h:message for="MyDate" />
<br/>
<h:outputText value="#{convListVal.myDate}">
<f:convertDateTime dateStyle="full" locale="en"/>
</h:outputText>
<br/>
<h:outputLabel value="Name:"/>
<h:inputText id="name" size="30" value="#{convListVal.name}">
<f:valueChangeListener type="com.baeldung.convListVal.MyListener" />
</h:inputText>
<br/>
<h:outputLabel value="surname" for="surname"/>
<h:panelGroup>
<h:inputText id="surname" value="#{convListVal.surname}">
<f:validateLength minimum="5" maximum="10"/>
</h:inputText>
<h:message for="surname" errorStyle="color:red" />
</h:panelGroup>
<br/>
<h:commandButton id="send" value="submit" type="submit" />
</h:form>
</h:body>
</html>