我有以下问题:从一个按钮调用一个java方法,这个方法将在同一页面中具有inputText的当前值,你可以这样做吗?
1.创建一个托管bean.2.define你的方法使用这个代码::
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot root = facesContext.getViewRoot();
RichInputText inputText = (RichInputText)root.findComponent("it1");
String val=inputText.getValue();
where it1 is id for your input text
Run Code Online (Sandbox Code Playgroud)
3.从按钮属性窗口中选择按钮的动作侦听器.4.调用您的托管bean和方法