Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Number of <h:form > tags on a page

Posts: 23
Eclipse IDE Tomcat Server Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having a problem that only one of the <h:commandButton> tags fire when I have two <h:form> tags on the page. Is it allowed to have more than one <h:form> tag on the page. The Html from two forms is rendered, however the action="backing bean" isn't fired. I could use some help here.
Using JSF 2.0 with MyFaces and hibernate 3.2

Saloon Keeper
Posts: 24812
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can have as many h:form elements on a page as you can endure. I do this all the time.

The rules are the same as for straight HTML forms:

1. FORMs cannot be nested nor can they overlap.

2. ONLY the data in the form that contains the SUBMIT button (or other control) that fired off the request will be posted back to the server.

And for JSF:

3. If ANY control value on the submitted form fails validation, NONE of the backing bean properties will get updated AND the action method and/or listeners will not be fired. When in doubt, add an h:messages tag to your page to display any possible "validation failed" messages.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic