views:

36

answers:

1

There is a top-level template in my project and it defines several sub-templates nested in a form:

<h:form>
   <ui:insert name="header"/>
   <ui:insert name="leftbar"/>
   <ui:insert name="maincontent"/>
</h:form>

It's not my idea actually to build application in this way. I see both its advantages and disadvantages.

The biggest problem I've met is necessity of 2 forms on 1 page: first with default enctype and second for uploading files. The second biggest problem is validating unnecessary fields (but it can be relatively easily solved by disabling validation on those fields with jstl c:if).

I'm using JSF and Facelets currently but the described design is possible with any templating framework.

So, what I wanted to ask: how do you think is it worth to use this wrapper-form? Is is a common practice?

+2  A: 

It certainly is not. You're now using one "super-form" for all actions in the page. This is not the common practice. Every related group of input elements should be placed in its own form. You don't want to validate/submit your contact form in the main content if you submit the search form in the header.

BalusC
@BalusC: I have the same feeling actually.
Roman
I'm in agreement. Uber-form is bad.
Naganalf