Changing to JSF2 brought some basic changes to the way layout.xhtml files need to be written. The following steps are at least nescessary to update a layout to JSF2:
- the <head /> element must be changed into a <h:head />
- The new namespace URL for xmlns:c is http://java.sun.com/jsp/jstl/core (jsp/ added)
- Elements that get reloaded by AJAX have to be real JSF components and not just facelets markup. That means that at least the divs with the ids “content” and “page” have to be changed into <os:div id=”content” /> and <os:div id=”page” />. Don’t forget to also change the class attribute into a styeClass attribute if there is one.
- All <ui:fragment /> tags should be removed since they’re no longer needed for AJAX updates.
- <div id=”contextPath”> … </div> also has a class=”contextPath” now. id=”contextPath” means “this is the OpenSAGA domain context path” component, the class “contextPath” only sets the visual presentation of it. This distinction can be useful when delivering cached content.
- the main form has a fixed id now. <os:mainForm id=”osForm” enctype=”multipart/form-data”>
In general, JSF2 is much more picky about IDs. Which means e.g. that you can’t define two alternate versions of the same component with the same id, selected by <c:if />s. For this reason, the top-menu variant of the OpenSAGA theme is currently broken and will be fixed soon in trunk.