【问题标题】:read input in primefaces notificationbar在 primefaces 通知栏中读取输入
【发布时间】:2012-12-13 15:13:01
【问题描述】:

我正在尝试读取放置在 p:notificationBar 中的 inputText,但我只得到 null 作为它的输入。 jsf代码是:

    <h:form>
    <p:notificationBar position="top" 
                       effect="slide" 
                       styleClass="top" 
                       id="notificationPanel"
                       widgetVar="bar" >
            <h3>Subscribe</h3>
            Add your email adress here
            <h:panelGrid columns="3" cellspacing="20">
                Email:
                <p:inputText value="#{detailsBean.email}" />
                <p:commandButton value="Submit" action="#{detailsBean.submitEmail}" onclick="bar.hide()"/>
            </h:panelGrid>
        </p:notificationBar>  
    </h:form>

【问题讨论】:

    标签: jsf jsf-2 primefaces


    【解决方案1】:

    &lt;p:notificationBar&gt; 的 HTML 表示将被重新定位到 HTML DOM 树中的所需位置,并且在您的特定情况下将不再以 HTML 形式结束。

    您需要将&lt;h:form&gt; 移动到&lt;p:notificationBar&gt; 内部。

    <p:notificationBar position="top" 
                       effect="slide" 
                       styleClass="top" 
                       id="notificationPanel"
                       widgetVar="bar" >
        <h:form>
            <h3>Subscribe</h3>
            Add your email adress here
            <h:panelGrid columns="3" cellspacing="20">
                Email:
                <p:inputText value="#{detailsBean.email}" />
                <p:commandButton value="Submit" action="#{detailsBean.submitEmail}" onclick="bar.hide()"/>
            </h:panelGrid>
        </h:form>
    </p:notificationBar>  
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-25
      • 1970-01-01
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多