I'm using NetBeans 8.2, JSF 2.2 and glassfish 4.1. I've tried the following portions of code:
My xhtml page code:
<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form>
<h:inputText value="#{myBean.inputValue}">
<f:validateLongRange minimum="25" maximum="40"/>
</h:inputText>
<h:commandButton
value="submit"
action="#{myBean.action}" />
<h:outputText
value="#{myBean.outputValue}" />
<h:messages />
</h:form>
</h:body>
</html>
My managed bean is as follow:
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean
@RequestScoped
public class MyBean {
private String inputValue;
private String outputValue;
public MyBean() {
}
public void action() {
outputValue = inputValue;
}
// Getters/setters
public String getInputValue() {
return inputValue;
}
public void setInputValue(String inputValue) {
this.inputValue = inputValue;
}
public String getOutputValue() {
return outputValue;
}
}
Everything works fine. My question is: when I inspect the resulting page
I don't see any javascript function or any other code doing the tests. I want to understand what is happening exactly, where is the part of code doing the tests?
Besides, here in the "3.3) Validator" section, I've read this:
Validation is a must for almost any application. Data entered by the clients have to be validated before being sent to the Server for processing.
Which confused me more. Does the validation happens on the client's side or on the server's side?