What is the best way of using `<h:form>` element in JSF 2?
Is it a good idea to create facelets with a single <h:form>
as a wrapper around all other components like this:
<body>
<h:form>
... various inputs, commandbuttons etc. ...
</h:form>
</body>
or keeping related stuff in seperate forms:
<body>
<h:form id="f1">
... related inputs, commandbuttons etc. & ajax updates to f2开发者_运维技巧 ...
</h:form>
<h:form id="f2">
... related inputs, commandbuttons etc. ...
</h:form>
</body>
What are the pros/cons and possible use cases for these two different styles?
Thinking about semantic, I would not use the first method. There's no need that all the generated HTML be wrapped up into form tags. Besides, the second method turns the code to a more legible one.
About the ajax updates, you can easily update n elements, e.g. all the forms if you need it.
精彩评论