http://feeds.feedburner.com/SpendYourTimeHere-Once

Current Affiares

Showing posts with label UTILS. Show all posts
Showing posts with label UTILS. Show all posts

Monday, August 13, 2012

How to find the bean name in java jsf?

How to find the bean name in java jsf?

// in java file

@SuppressWarnings("unchecked")
    public static <T> T findBean(String beanName) {
        FacesContext context = FacesContext.getCurrentInstance();
        return (T) context.getApplication().evaluateExpressionGet(context, "#{" + beanName + "}", Object.class);
    }

// and how to use
// use below line wr u want to find the bean name & their respective values

BeanFile beanFile = javafile.findBean("user");

How to convert the string to UPPER case letter in java

How to convert  the string to UPPER case letter in java?

// in java file

public static String convertStringToUpperCase(String str) {
        String strValue = "";
        if (str == null) {
            strValue = "NA";
        } else {
            strValue = str.trim().toUpperCase();
        }
        return strValue;
    }

// in set & get java file
private String brcode;

public String getBrcode() {
        return brcode;
    }

    public void setBrcode(String brcode) {
        this.brcode = javafile.convertStringToUpperCase(brcode);
    }



My Blog List

Popular Posts

All Rights Reserved To SYTHONCE. Ethereal theme. Powered by Blogger.