<

JSF <f:validateDoubleRange> Tag

It is used to check that the value of a input field is within a certain range or not. The value must be floating-point or convertible to floating-point.

<f:validateDoubleRange> TagAttributes



Attribute Description
minimum It is used to set minimum value for this component.
maximum It is used to set maximum value for this component.


<f:validateDoubleRange> Tag Example



index.xhtml

<h:outputLabel for="amount">Enter Amount </h:outputLabel>  
<h:inputText id="name-id" value="#{user.amount}" validatorMessage="Please enter amount between 1000.50 and 5000.99">  
<f:validateDoubleRange minimum="1000.50" maximum="5000.99"/>  
</h:inputText><br/><br/>  
<h:commandButton value="Submit" action="response.xhtml"></h:commandButton>  
</h:form>  


user.java
import javax.faces.bean.ManagedBean;  
import javax.faces.bean.RequestScoped;  
@ManagedBean  
@RequestScoped  
public class User{  
double amount;  
public double getAmount() {  
return amount;  
}  
  
public void setAmount(double amount) {  
this.amount = amount;  
}  
}  


response.xhtml


<h:body>  
<f:view locale="fr">  
Amount entered by you: <h:outputText id = "user-name-id" value="#{user.amount}">  
</h:outputText>  
</f:view>  
</h:body>  
















© copyright 2017-2022 Completedone pvt ltd.