posts - 5,  comments - 7,  trackbacks - 0
          第一種方法:
          JSF頁面中的代碼:
          <h:form id="messageForm">
          <h:outputText id="outputMessage"/>
          <h:commandButton value="Get Message"
          actionListener
          ="#{testForm.sendMessage}"/>
          </h:form>
          后臺程序:
          public void sendMessage(ActionEvent e)
          {
          FacesContext context 
          = FacesContext.getCurrentInstance();
          UIViewRoot view 
          = context.getViewRoot();
          HtmlOutputText output 
          =
          (HtmlOutputText)view.findComponent(
          "messageForm:outputMessage");
          output.setStyle(
          "color:blue");
          output.setValue(
          "Who's the Mann?");
          }
          之后,當點擊Get Message的時候頁面就會在outputMessage的地方輸出 Who's the Mann?
          第二種方法:
          <h:inputText value="#{registrationForm.comments}"
          binding
          ="#{registrationForm.commentsInput}"/>
          commentsInput是RegistrationForm中的一個HtmlInputText類型的一個變量,通過binding屬性將前臺UI控件和后臺同類型的變量綁定,就可以在后臺直接操作了。
          posted on 2008-11-23 00:38 Vincent-chen 閱讀(183) 評論(0)  編輯  收藏 所屬分類: JSF
          主站蜘蛛池模板: 山西省| 梅河口市| 桦甸市| 师宗县| 张家界市| 钟山县| 昌平区| 会同县| 准格尔旗| 金平| 安阳市| 兴文县| 芒康县| 哈巴河县| 东丽区| 诏安县| 翁牛特旗| 临猗县| 香港 | 巫山县| 日照市| 牟定县| 遵义县| 邹平县| 徐闻县| 淮北市| 镇原县| 江陵县| 阿拉善盟| 白沙| 京山县| 循化| 商洛市| 淮安市| 华阴市| 冀州市| 盐亭县| 山阳县| 海淀区| 高邑县| 绥中县|