Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Concern for Error Primefaces 4.0 to capture the value of the selectOneMenu ?  RSS feed

 
Hernando Huaman
Greenhorn
Posts: 4
Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi community I have a question, I have a form where I have a layout complex with primefaces 4 happen to have in the north area have a menubar (there I've placed a form, I'm not sure if this well), select an option to new activity raises me a popup where I work-out loads in a combo, what happens is I get an error in the value of the selectOneMenu, but I give the event as if capturing the value of this combo, but worried me, I show my code.



Image:

In code java:



I get this error, which I believe is the layout:

 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have only a superficial understanding here, which is what you get when you ask for help from a forum where people don't get paid, but I got the impression that you have an imperfect understanding of how forms work. So I'll explain.

Like most "h" namespace tags in JSF, the h:form maps onto a raw HTML tag: FORM. The FORM tag cannot be nested, and like all well-formed HTML, cannot overlap other tags. In other words no constricts of the form a b /a /b, only a b /b a.

A FORM contains controls. Except in the case of AJAX, submitting a FORM submits all of the control values within that form and only the values within that form. Furthermore, in JSF, any attempt to use a JSF form control without embedding it in a form will have unpredictable results. Finally, the JSF h:form adds meta-data to the form submit, so a JSF control must be embedded within an h:form, not a raw HTML form if it's going to work properly.

You can have one big form on a page, but when you tile a page into headers with common menus and stuff like that, it's more practical to put the menubar in one form and the page content in another form. It reduces not only the amount of data submitted, but it also avoids issues where you want to select a new page via menu but don't have valid data on the current page - since JSF will only process actions where each and every control in the submitted form has a value value.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!