JSF2-Integer Converter Demo

 The Integer converter in JSF2 is used to convert a text value into integer value. This is my managed bean, here I have declared one Integer variable and I have created accessor method for that variable.
package com.pointerunits;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped

public class Converter {
 private Integer intNumber;
 public Converter() {
  
 }
 public Integer getIntNumber() {
  return intNumber;
 }
 public void setIntNumber(Integer intNumber) {
  this.intNumber = intNumber;
 } 
}

 This is my xhtml page, Here I have created one input text filed and converted that field value into integer using integer converter. If converter can't able to convert then it't will display the error message.

   
  
  

  
  

  
 

 You can download an entire application from github.

Comments