-
1. Re: problem with resource loading in CR1 release
klhoste2 Dec 6, 2011 5:47 AM (in response to healeyb)For my part, I tried the folowing configuration and it works in a simple application:
<context-param>
<param-name>org.richfaces.resourceMapping.enabled</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.resourceMapping.compressedStages</param-name>
<param-value>All</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.resourceMapping.packedStages</param-name>
<param-value>All</param-value>
</context-param>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>
However, I'm still having issues (JavaScript errors) which depend on the components declaration order.
If I put a JSF component first, jsf.js will be loaded before packed.js (RichFaces library) and there is no error.
But if I put a RichFaces component first, jsf.js is loaded after and the page loading generates many JavaScript errors (jsf is undefined, RichFaces.ui is undefined).
I'm going to create a new thread for this and a Jira issue.
-
2. Re: problem with resource loading in CR1 release
klhoste2 Dec 6, 2011 6:40 AM (in response to klhoste2)Finally, I added a comment to the issue RF-11764.
To complete the description of the issue, here is the code of the working page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <f:view xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <h:head> <title>Test</title> </h:head> <h:body> <h:form> <a4j:commandButton value="Button"/> <rich:toolbar binding="#{toolbar.toolBar}"></rich:toolbar> </h:form> </h:body> </f:view> </html>
The #{toolbar.toolBar} getter creates a simple toolbar:
public UIToolbar getToolBar() { if(toolBar == null) { toolBar = new UIToolbar(); UIDropDownMenu ddm = new UIDropDownMenu(); UIMenuItem item1 = new UIMenuItem(); item1.setLabel("Item 1"); UIMenuItem item2 = new UIMenuItem(); item2.setLabel("Item 2"); ddm.setLabel("Menu 1"); ddm.getChildren().add(item1); ddm.getChildren().add(item2); toolBar.getChildren().add(ddm); } return toolBar; }
Here is the head part of the generated page:
<head> <link type="text/css" rel="stylesheet" href="/testJSF/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.1.0.20111111-CR1/PackedCompressed/DEFAULT/skinning.css" /> <script type="text/javascript" src="/testJSF/javax.faces.resource/jsf.js.xhtml?ln=javax.faces"> </script> <script type="text/javascript" src="/testJSF/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.1.0.20111111-CR1/PackedCompressed/packed/packed.js"> </script> <title>Test</title> </head>
There is no JS errors.
Now, if add remove the a4j:commandButton on line 13, the generated head part becomes the following:
<head> <link type="text/css" rel="stylesheet" href="/testJSF/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.1.0.20111111-CR1/PackedCompressed/DEFAULT/skinning.css" /> <title>Test</title> </head>
The Toolbar is badly rendered, and this produces the following JavaScript errors:
RichFaces is not defined [Stopper sur une erreur] <table border="0" cellpadding="0" cell...iv><script type="text/javascript">new RichFaces is not defined [Stopper sur une erreur] <table border="0" cellpadding="0" cell...iv><script type="text/javascript">new RichFaces is not defined [Stopper sur une erreur] RichFaces.ui.Menu(...87677944472842" autocomplete="off" /> toolbarHandlers is not defined [Stopper sur une erreur] RichFaces.ui.Menu(...87677944472842" autocomplete="off" />