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");
// 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");
No comments:
Post a Comment