0
我有一個帶有輸入文本的頁面我想要顯示其值,但始終顯示爲空。獲取輸入文本的值時出錯:null
下面是代碼
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot root = context.getViewRoot();
RichInputText inputText = (RichInputText) root.findComponent("it1");
String myParam = (String)inputText.getValue();
system.out.println("Input field content:" + myParam);
輸入域的內容:空
你的代碼看起來不錯,但你是否真的檢查過id是否是「it1」? –