【发布时间】:2009-06-24 11:14:50
【问题描述】:
如果两个输入字段绑定到同一个会话范围的 Backing Bean 属性,JSF 中是否有定义的行为。
这是我的代码 sn-p
<h:form id="myForm">
<h:inputText id="field1" value="#{TheBackingBean.theProperty}" />
<h:inputText id="field2" value="#{TheBackingBean.theProperty}" />
<h:commandButton id="continueButton" action="#{TheBackingBean.doSomething}" />
</h:form>
我的问题:如果 field1 和 field2 接收到不同的值,什么将绑定到支持 bean 属性?这甚至允许吗?
我知道这是一个粗略的场景。我的动机是,我们为我们的应用程序运行了 htmlunit 测试。在我们的 JSF 应用程序中,我们希望使用一个很酷的 ajaxified 自定义组件。这与 htmlunit 不能很好地协同工作。所以我的想法是,我只是放入一个绑定到相同属性的隐藏字段。然后单元测试填充隐藏字段而不是“真实”的东西。
问候
【问题讨论】:
标签: jsf