Strange problems with Richfaces 3.2.2 Snapshot
jan.ziegler Jul 22, 2008 12:26 PMHi there,
I have some problems with the latest richfaces 3.2.2 snapshot which are in my opinion better adressed to the developer than user community.
First of all my environment:
Tomcat 6.0.16
MyFaces 1.2.3
Facelets 1.1.15 Snapshot
Tomahawk 1.1.17 Snapshot
Richfaces 3.2.2 Snapshot
Everthing was fine with the early 3.2.2 Snapshots and before. But I need to use one of the latest snapshots because jQuery 1.2.6 (which is necessary for me) is included only in that versions. Right now I have the following problems:
1) If a use any a4j-component and do not wrap it in an <a4j:region>, the ajax call is not executed correctly (ajaxrequest=null in the request, empty response).
This is a simple example which sets a beans value via ajax on click of a commandLink and reRenders the output of the beans value:
<h:form> ... <!-- WORKING (-> wrapped in region) --> <a4j:region> <h:outputText id="output" value="#{ajaxBean.text}" /> <a4j:commandLink reRender="output" value="click me!"> <f:setPropertyActionListener target="#{ajaxBean.text}" value="you clicked the button" /> </a4j:commandLink> </a4j:region> <!-- NOT WORKING ANYMORE! --> <h:outputText id="output" value="#{ajaxBean.text}" /> <a4j:commandLink reRender="output" value="click me!"> <f:setPropertyActionListener target="#{ajaxBean.text}" value="you clicked the button" /> </a4j:commandLink> ... </h:form>
I always thought that an <a4j:region> is not mandatory and therefor the viewroot is the default region - has this changed?
2) I have a custom JSF component which has a renderer that includes some javascipt files programmatically by using HtmlLoadScript.
This was no problem with the early snapshots of 3.2.2 and before but now it's not working anymore. Nothing gets included!
Here's how I use HtmlLoadScript in the renderer's code:
public void encodeBegin(FacesContext fc, UIComponent component) { ... UIResource loadScript = new HtmlLoadScript(); loadScript.setId(fc.getViewRoot().createUniqueId()); loadScript.setSrc("resource:///org/richfaces/renderkit/html/scripts/jquery/jquery.js"); // or any other js component.getChildren().add(loadScript); ... }
The same problem is with css including by HtmlLoadStyle.
If I use <a4j:script> or <a4j:style> directly on the xhtml-page there's no problem. but I want the component or better the component's renderer to handle this.
I realized on thing - maybe this helps for debugging: the javascript and css files are included by the way explained above when I do a "reRender" with my custom component triggert by some ajax action. Then everthing is fine and the ajax reponse contains the javascipt and css references but it's not a solution to first reRender each component of course.
So any suggestions or comments are welcome,
thanks
Jan Z.