Java 怎么获取JSF值绑定

2019年8月13日22:04:45 评论 44

1.简介

Java 怎么获取JSF值绑定?——请看下文。

2.代码

/**
 * 版权所有 编程十万个怎么办(www.tah1986.com)
 */

import javax.faces.el.ValueBinding;
import javax.faces.application.ApplicationFactory;
import javax.faces.application.Application;
import javax.faces.FactoryFinder;
import javax.faces.context.FacesContext;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;

public class Main{
    public static void main(String[] argv) throws Exception{
        String valueRef = "tah1986.com";
        System.out.println(getValueBinding(valueRef));
    }
    
    private static ValueBinding getValueBinding(String valueRef) {
        ApplicationFactory factory = (ApplicationFactory) FactoryFinder
                .getFactory(FactoryFinder.APPLICATION_FACTORY);
        Application application = factory.getApplication();
        return application.createValueBinding(valueRef);
    }
}

 

3.总结

示例代码演示了 Java 怎么获取JSF值绑定,具体步骤参见示例代码。

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: