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
          主站蜘蛛池模板: 兴义市| 平罗县| 蒙阴县| 通许县| 达拉特旗| 郸城县| 克山县| 奈曼旗| 大洼县| 咸丰县| 克什克腾旗| 石景山区| 林芝县| 克拉玛依市| 尤溪县| 利津县| 崇阳县| 额尔古纳市| 如皋市| 敦化市| 财经| 汶川县| 新乡市| 娄烦县| 屏边| 恩施市| 秦皇岛市| 香港 | 仙居县| 隆昌县| 东兴市| 家居| 安义县| 多伦县| 基隆市| 蒙阴县| 兴文县| 疏附县| 仪征市| 兴化市| 新建县|