servlets struts hibernate spring maven java
 

JSF <f:validateLongRange>Tag



It is utilized to check whether the neighborhood value of a component is inside a specific range or not. The esteem must be any numeric sort or String that can be changed over to a long.
Attribute Description
minimum It is used to set minimum length for the component.
maximum It is used to set maximum length for the component.

Validating an input tag Example

// index.xhtml

  1. <h:form id="user-form">  
  2. <h:outputLabel for="name">Provide Amount to Withdraw  </h:outputLabel><br/>  
  3. <h:inputText id="age" value="#{user.amount}" validatorMessage="You can Withdraw only between $100 and $5000">  
  4. <f:validateLongRange minimum="100" maximum="5000" />  
  5. </h:inputText><br/>  
  6. <h:commandButton value="OK" action="response.xhtml"></h:commandButton>  
  7. </h:form>  

// User.java

  1. import javax.faces.bean.ManagedBean;  
  2. import javax.faces.bean.RequestScoped;  
  3. @ManagedBean  
  4. @RequestScoped  
  5. public class User{  
  6. int amount;  
  7. public int getAmount() {  
  8. return amount;  
  9. }  
  10. public void setAmount(int amount) {  
  11. this.amount = amount;  
  12. }  
  13. }  






© Javacodegeeks © 2019 - 2019
All Right Reserved and you agree to have read and accepted our term and condition.

Python 3