0

My page has Ajax show/hide functionality. During the initial page load my bean methods that are inside a non rendered <f:subview> or <h:panelGroup> are not called. When re-render the @form using Ajax, my bean methods are getting called although the relevant subviews are not rendered. Is this what should happen? (I am using JSF 2.2)

Ioannis Deligiannis
  • 2,679
  • 5
  • 25
  • 48

1 Answers1

0

This is the expected behaviour as per my comment above. Unfortunately it comes with some ugly behaviour.

If you an object that is doing anything when using the list, it will work fine on your first request. Even if you have taken your precautions say by loading something with f:event this will not save you on the following AJAX request.

Example: If you use JPA with each bean managed for the scope of the request and that bean has a lazy collection that is not rendered this will cause the following:

Request 1: Non-rendered components will not be touched i.e. Lazy collections will not initialize

Request 2(Ajax): JSF will try to restore the full view calling your non-loaded lazy collection resulting to an exception.

Ioannis Deligiannis
  • 2,679
  • 5
  • 25
  • 48