How to execute another <h:form> using <f:ajax>?

自古美人都是妖i 提交于 2019-12-13 02:58:21

问题


I've noticed that this doesn't work for me and I'm wondering if it's just not possible:

<h:form id="one" prependid="false" >
  <h:commandButton>
    <f:ajax execute=":two">
  </h:commandButton>
</h:form>

<h:form id="two" prependid="false">
  ... content ...
</h:form>

Whenever I click the button above ,I can see that the values on form two are not executed as expected. Is this the normal JSF behavior?
To 'trick' it, I usually insert a hidden button in form two and trigger it using JavaScript code when the button in form one is clicked. But that's a 'trick' and makes me work extra when I'm not sure I have to.

I should mention the rendering another form is possible.

Could the prependid attribute be causing problems?

Thanks in Advance!

UPDATE Adding more information that might be relevant - adding the prependid="false" to the forms as it is used in the actual code.


回答1:


No, that's not possible with <f:ajax>. It just submits the parent form. The execute merely tells JSF which components it has to process based on the submitted data, not which request parameters the client side have to send. The button has really to go in the form where it belongs.



来源:https://stackoverflow.com/questions/8501310/how-to-execute-another-hform-using-fajax

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!