According to the portlet specification, elements such as <head>, <title>, and <body> may not be output to the response by a portlet.
Because of this, the FacesBridge must prevent the Faces runtime from writing <body>...</body> to the response when it invokes the renderer for <h:body/>. Instead, the FacesBridge must ensure that a <div>...</div> is written and the value of the "id" attribute must be the clientId of the UIViewRoot.
The FacesBridge must also support the following use-case:
When the commandButton is clicked, this will cause a partial-response similar to the following to be generated by the FacesRuntime:
The FacesBridge must ensure that only the <div>...</div> is replaced in the client rather than the entire <body>...</body>.
The manner in which the FacesBridge fulfills this requirement is an implementation detail. One possibility is for the FacesBridge to provide a custom jsf.js resource. Another might be for the FacesBridge to introduce a custom ResponseWriter that monitors calls to ResponseWriter.startElement(String name, UIComponent component) and ResponseWriter.writeAttribute(String name, Object value, String property) in order to transform value of the id attribute from "javax.faces.ViewRoot" to the id of the <div>...</div>.
- Two portlets exist on the portal page: PortletA, PortletB
- PortletB has has two forms: FormA, FormB
- Submit the second form with <f:ajax execute="@form" render="@all" />
- Verify that the DOM was only updated for PortletB and that both forms in PortletB have a hidden field with "javax.faces.ViewState" as part of the name attribute.