The three limitations in the jsf.js JavaScript code are:
1. The <?xml version="1.0" encoding="UTF-8"?> and <!DOCTYPE> markers is assumed to be valid to keep in the response because jsf.js assumes a servlet environment in which the rendered JSF view takes up the entire DOM in the userAgent/browser.
The workaround for #1 is to simply strip out the offending markers.
2. During "partial" updates in which the javax.faces.ViewRoot is being replaced in the DOM (which is basically a full update of the view -- not really partial), jsf.js attempts to replace everything inside the <body>...</body> elements, which of course is a servlet environment assumption. Instead, it should be the outermost <div> tag rendered by the bridge's {@link BodyRendererBridgeImpl} that should be replaced in theDOM.
The workaround for #2 is to substitute the id value of "javax.faces.ViewRoot" with the id of the outermost <div> tag rendered by the bridge's {@link BodyRendererBridgeImpl}.
3. Also in the the case of a "partial" update of javax.faces.ViewRoot, jsf.js attempts to dynamically create the javax.faces.ViewState hidden input field if it is not found in the form. The JavaScript code will successfully do this provided it is permitted to replace everything inside the <body>...</body> elements, but since we can't let that happen in a portlet environment, the hidden field does not get created.
The workaround for #3 is to inject the javax.faces.ViewState hidden field into the response if it is not already there.
@author Neil Griffin
|
|