h:inputtext无法在JSF2.2中使用多种形式 [英] h:inputtext not working with multiple forms in JSF2.2

查看:73
本文介绍了h:inputtext无法在JSF2.2中使用多种形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

h:inputText在具有多种形式的最新JSF2.2中不起作用. 我有2种表格

h:inputText is not working in the latest JSF2.2 with multiple forms. I have 2 forms

form1具有: 一个命令按钮和一个输入文本

form1 have: one command button and one input text

form2具有: 一个输入文字和一个输出标签

form2 has: one input text and one output label

在form1中单击命令按钮时,我正在渲染form2(输出标签和输入文本).

on click of command button in form1, i am rendering the form2(both outputlabel and input text).

但是只有输出标签正确地呈现了正确的值(调用了相应的getter方法并显示了值),但是输入文本没有调用相应的getter方法,因此显示为空.

but only output label is rendered properly with correct values (corresponding getter method gets called and value is displaying) but the input text is not calling the corresponding getter method hence showing null.

注意: 只有在我们使用多种形式,并且在一种形式内正常工作的情况下,我们才注意到此问题. 在JSF2.0中也能正常工作

Note: we noticed this issue only if we use multiple forms, within single form its working fine. also it worked fine in JSF2.0

使用的版本: JSF API-2.2(com.sun.faces) JSF展示-2.2(com.sun.faces)

Version used: JSF api - 2.2 (com.sun.faces) JSF impl - 2.2 (com.sun.faces)

让我知道是否有人可以解决此问题.

let me know if anyone have solution to handle this.

窗体不嵌套,并且两个bean都在View范围内.

the forms are not nested and both the beans are in View scope.

<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的outputlabel正确显示了值(调用了getter方法),但是inputtext没有显示了值(未调用getter方法)

after the action is completed in form1, the form2 outputlabel is displaying the value properly(getter method is called) but the inputtext is not displaying the value (getter method is not getting called)

约翰,要测试上面的问题在没有Richfaces的情况下能否正常工作,我创建了一个独立的项目,并按如下所示创建了一个xhtml

Hi john, to test whether the above issue is working fine without richfaces, i created a standalone project and create a xhtml as below

<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,有什么办法可以检查多种表格吗?

but i am getting unknown id for sample, is there any way to check with multiple forms?

推荐答案

我对Richfaces(a4j)不熟悉,但是请尝试以下操作:

I am not familiar with richfaces (a4j), but try the following:

-如果您不使用form prependId=false,则应将您的(其他形式)ID称为:render=":form2:paymentInstructionDetail" styleClass="iconLarge edit" />

-If you don't use form prependId=false, then you should refer to your (other form) id's as: render=":form2:paymentInstructionDetail" styleClass="iconLarge edit" />

在另一个说明上: -我认为richfaces还没有准备好JSF2.2,因此请预见问题 -实际上,JSF 2.2本身就有很多错误

On another note: -I don't think that richfaces is JSF2.2 ready yet, so expect problems -Actually, JSF 2.2 has quite a few bugs of it's own

这篇关于h:inputtext无法在JSF2.2中使用多种形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆