隨筆-348  評論-598  文章-0  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控件和后臺同類型的變量綁定,就可以在后臺直接操作了。

          ---------------------------------------------------------
          專注移動開發(fā)

          Android, Windows Mobile, iPhone, J2ME, BlackBerry, Symbian
          posted on 2008-10-17 13:51 TiGERTiAN 閱讀(1098) 評論(0)  編輯  收藏 所屬分類: JavaJSF
          主站蜘蛛池模板: 诸城市| 夏河县| 阳泉市| 南召县| 夏邑县| 客服| 历史| 孝义市| 永寿县| 崇文区| 保德县| 江阴市| 郁南县| 嘉鱼县| 巫溪县| 高密市| 集贤县| 香港| 弋阳县| 晋城| 壤塘县| 新余市| 东城区| 海丰县| 五原县| 岐山县| 常山县| 清水县| 嘉祥县| 得荣县| 繁昌县| 永善县| 永清县| 崇明县| 汝城县| 五指山市| 明星| 灯塔市| 中牟县| 始兴县| 武定县|