【问题标题】:Setting value to backend bean将值设置为后端 bean
【发布时间】:2016-10-25 13:22:13
【问题描述】:

可能有很多主题相同的主题,我几乎涵盖了所有问题,但无法找到解决问题的方法。

  1. 我有一个模板 - 比如 application.xhtml。

  2. 在我的 application.xhtml 中有一个叫做 application.transact 的东西,它指的是应用程序 bean 中的一个事务对象。

  3. 在事务对象中我有一个布尔字段同意。

  4. 在我的模板中我有一个面板

<h:panelGroup id="newApplication_agree" layout="block">
    <ui:param name="transact" value="#{application.transact}"/>
    <p:panel toggleable="true">
      <table>
        <tr>
          <td width="1%" align="left">
            <h:selectBooleanCheckbox id="agree" value="#{application.transact.agree}"
    required="true" requiredMessage="this is a mandatory field">
              <f:validator validatorId="omnifaces.RequiredCheckboxValidator" />
            </h:selectBooleanCheckbox>
          </td>
          <td width="95%" align="left" colspan="3"> 
            <h:outputText id="agreeText" value="I agree"/>
          </td>
        </tr>
      </table>
    </p:panel>
</h:panelGroup>

无论我尝试什么,该值都没有设置为 application.transact.agree

【问题讨论】:

  • 这是我在第 4 点中所说的面板。不知何故,我无法对代码提出质疑。
  • 你有错误吗?你的 bean 的范围是什么?
  • 您现在似乎需要将 xhtml 放入“html sn-p”中......只有这样我才能让它在这里工作。请创建一个minimal reproducible example

标签: jsf parameters jsf-2.2


【解决方案1】:

我想通了伙计们。我将其放置在无法访问事务对象的错误位置,因此出现错误。

感谢您的宝贵时间。

【讨论】:

    猜你喜欢
    • 2013-09-09
    • 2012-09-05
    • 1970-01-01
    • 1970-01-01
    • 2017-09-07
    • 2012-06-30
    • 2017-09-21
    • 2017-07-09
    • 1970-01-01
    相关资源
    最近更新 更多