convert To Int from JSF Html Input Hidden - Java JSF

Java examples for JSF:HtmlInputHidden

Description

convert To Int from JSF Html Input Hidden

Demo Code


import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.faces.component.html.HtmlInputHidden;

public class Main{
    public static Integer convertToInt(HtmlInputHidden hi) {
        String str = null;/*from   w w  w . ja v  a  2  s.c  o m*/
        if (hi != null) {
            str = (String) hi.getValue();
        }
        if (str != null && !str.trim().equals("")) {
            return Integer.parseInt(str);
        }
        return null;
    }
}

Related Tutorials