在JSF中,分裂< h:form> s有什么好处吗? [英] In JSF, Is there any benefit to splitting <h:form>s?

查看:108
本文介绍了在JSF中,分裂< h:form> s有什么好处吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一般的最佳实践问题。

假设我在同一页面上有一个搜索框和一个网页表单。
拆分< h:form> 是否有好处,以便他们各自拥有?
或将它们全部放在同一个< h:form>

Say I have a search box and a web form on the same page. Is there any benefit to splitting the <h:form> so they each get their own? Or put them all in the same <h:form>?

推荐答案

是的,肯定每个表单都需要在它自己的< h:form> 中。

Yes, definitely each form needs to go in its own <h:form>.


  • 您对其他表单的数据不感兴趣。这也节省了带宽并提高了速度。

  • 它可能会不必要地触发其他表单上的验证器。这对 UX 不利。

  • You're not interested in the data of the other form. This also saves bandwidth and improves speed.
  • It would potentially unnecessarily trigger validators on the other form. This is bad for UX.

请注意,您不能嵌套表单。根据HTML规范,这是不允许的,因此在JSF中也是如此,因为它基本上所做的就是生成一堆HTML。

Note that you cannot nest forms. This is disallowed as per HTML spec, so also in JSF as all it basically does is generating a bunch of HTML.

这篇关于在JSF中,分裂&lt; h:form&gt; s有什么好处吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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