【发布时间】:2013-06-29 17:51:37
【问题描述】:
h:inputText 在具有多种形式的最新 JSF2.2 中不起作用。 我有 2 个表格
form1 有: 一个命令按钮和一个输入文本
form2 有: 一个输入文本和一个输出标签
点击form1中的命令按钮,我正在渲染form2(输出标签和输入文本)。
但只有输出标签以正确的值正确呈现(相应的 getter 方法被调用并显示值),但输入文本没有调用相应的 getter 方法,因此显示为 null。
注意: 只有当我们使用多个表单时,我们才会注意到这个问题,在单个表单中它工作正常。 它在 JSF2.0 中也能正常工作
使用的版本: JSF api - 2.2 (com.sun.faces) JSF impl - 2.2 (com.sun.faces)
如果有人有办法解决这个问题,请告诉我。
表单没有嵌套,两个 bean 都在 View 范围内。
<h:form id="form1">
<a4j:commandLink id="actionEdit" title="Click" action="#{bean.action}"
render="paymentInstructionDetail" styleClass="iconLarge edit" />
</h:form>
<h:form id="form2">
<a4j:outputPanel ajaxRendered="true" id="paymentInstructionDetail">
<h:inputText value="#{bean1.amount}" id="sample"/>
<h:outputLabel value="#{bean1.amount}" id="sampleLabel"/>
</a4j:outputPanel>
</h:form>
在form1中完成操作后,form2输出标签正确显示值(调用getter方法)但inputtext不显示值(未调用getter方法)
嗨,john,为了测试上面的问题在没有 Richfaces 的情况下是否正常工作,我创建了一个独立项目并创建了一个如下所示的 xhtml
<h:body>
<h2>This is start.xhtml</h2>
<h:form>
<h:commandButton action="#{myBean.testAction}" value="Payment" >
<f:ajax render="sample"></f:ajax>
</h:commandButton>
</h:form>
<h:form id="test12" prependId="false">
<h:inputText value="#{myBean.orderQty}" id="sample"/>
</h:form>
</h:body>
但是我得到了未知的样本 ID,有什么方法可以检查多个表格吗?
【问题讨论】:
-
这两个表单是嵌套的吗?什么是 bean 范围?请注意,您只能在表单外“渲染”,不能在表单外“处理”。代码 sn-p 可以提供帮助;)
-
嗨,约翰,我已经更新了上述查询中的详细信息
标签: jsf-2.2