0

I am having some trouble with <ui:composition> in an xhtml page(main.xhtml). Both Main.xhtml and ui:composition are using seperate viewscoped beans (mainbean, compositebean) for binding properties. There is a <h:commandbutton> inside ui:composition page;

  1. When i click this command button, prerender method of compositebean get invoked but the action method was not been invoked. But when the mainbean was set to sessionscoped bean, it worked. Why this behaviour?

  2. src attribute of <ui:composition> was dynamically binding from a viewscoped managed bean property: <ui:include src="#{mainbean.linkURL}" id="composite"/> . But when I hardcoded the src attribute of ui:composition, <h:commandbutton> invoked the action method correctly: <ui:include src="composite.xhtml"/>.

  3. If not specified the javax.faces.STATE_SAVING_METHOD in web.xml, which will be the default state saving mechanism?
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Vivek Mohan
  • 8,078
  • 8
  • 31
  • 49

1 Answers1

2

1 and 2 are answered by the fact that <ui:include> is a taghandler, not an UI component. This is further elaborated in JSTL in JSF2 Facelets... makes sense? In a nutshell: taghandlers run during view build time, while UI components run during view render time. This is further completely unrelated to <ui:composition> and friends.

3 is answered in chapter 11.1.3 of JSF specification. Here's a copypaste:

  • javax.faces.STATE_SAVING_METHOD -- The location where state information is saved. Valid values are “server” (typically saved in HttpSession) and “client (typically saved as a hidden field in the subsequent form submit). If not specified, the default value “server” must be used.
Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555