JSF forms when submit

核能气质少年 提交于 2019-12-12 06:36:24

问题


If we have several forms like below and when i finally press submit button, it should send all the values from "froms1 to forms3" to the server. Is it something possible? I am using primefaces.

<h:form id="forms1">
 <inputText .........
 </h:form>
......
<h:form id="forms2">
 ......
</h:form>
.......
<h:form id="forms3">
.....
</h:form>

<p:commandButton value="submit" action="#{bean.action}" onSubmit="this.forms1,this.forms2,this.forms3" partialSubmit="true" />

回答1:


it is not a good idea to submit multi ple form but you can submit by following code..

<p:commandButton title="Submit" value="Submit" action="#{bean.action}" process="form1,form2,form3">

this may work 4 you...




回答2:


You may be able to put some hacky solution together to submit 3 forms with one button, but it would be best to just use 1 form with 1 submit button inside the form.

If you're using multiple forms to get some separation with the way things look, try using fieldsets instead. Primefaces even has a fieldset component <p:fieldset></p:fieldset>



来源:https://stackoverflow.com/questions/11656218/jsf-forms-when-submit

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