-
1. Load JQuery From CDN
sparrowhawk Mar 6, 2011 11:33 AM (in response to sparrowhawk)I'm using 4.0.0.20110209-M6 btw. Thanks!
-
2. Load JQuery From CDN
henk53 Mar 6, 2011 5:53 PM (in response to sparrowhawk)I would absolutely *LOVE* to be able to easily configure this in RichFaces.
-
3. Re: Load JQuery From CDN
boy18nj Mar 6, 2011 10:19 PM (in response to sparrowhawk)If you don't use any jquery component, then you can assume the one that comes packed
with richfaces is suppressed.
To include your own special jquery version, follow the below logic:
To include a script resource, use the outputScript tag:
<h:outputScript name="jQuery_personal.js" library="javascript" target="head" />
If the target attribute is head or body, the script is appended to the "head" or "body"
facet of the root component, which means that it appears at the end of the head
or body in the generated HTML. If there is no target element, the script is
inserted in the current location.
-
4. Re: Load JQuery From CDN
sparrowhawk Mar 7, 2011 7:33 AM (in response to boy18nj)Sorry, maybe I wasn't totally clear. I do want to use a jQuery component (client side validation in this case -- <rich:validator />). I don't want to use the jQuery bundled w/ Richfaces for several reasons, but I do want to use the components. What I'd like to be able to do is suppress the version bundled w/ Richfaces and include my own reference to a CDN jQuery, as in:
https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js
This way I can use a compressed copy (the version is Richfaces is totally uncompressed) with fast resolution for clients (Google's ssl negotiation is sick and the sites I work on are served 100% over ssl). Make sense?
-
5. Load JQuery From CDN
nbelaevski Mar 7, 2011 9:08 AM (in response to sparrowhawk)Hi,
Add the following into web.xml:
<context-param>
<param-name>org.richfaces.staticResourceLocation</param-name>
<param-value>#{resourceLocation}</param-value>
</context-param>
And create META-INF/richfaces/static-resource-mappings.properties resource in classpath:
jquery.js=https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js
-
6. Load JQuery From CDN
sparrowhawk Mar 7, 2011 9:18 AM (in response to nbelaevski)sick. thank you! trying this out now.
-
7. Load JQuery From CDN
sparrowhawk Mar 7, 2011 9:39 AM (in response to nbelaevski)I tried those instructions verbatim and it doesn't seem to work. Is #{resourceLocation} illustrative -- as in should it actually be replaced with the path to the properites file -- META-INF/richfaces/static-resource-mappings.properties ?
-
8. Load JQuery From CDN
nbelaevski Mar 7, 2011 9:48 AM (in response to sparrowhawk)No, not illustrative. Should be added as is.
-
9. Load JQuery From CDN
sparrowhawk Mar 7, 2011 9:52 AM (in response to sparrowhawk)My bad. Got it working -- sorry for the double/triple posts.
So this is pretty slick. I suppose that any of the other static resources (richfaces.js etc.) could be distributed via CDN and referenced the same way. Richfaces rocks. Thank you so much!
-
10. Load JQuery From CDN
nbelaevski Mar 7, 2011 10:07 AM (in response to sparrowhawk)David,
Actually this is what we use for GAE (Google app Engine) integration. There is Maven resources plugin that generates pack of resources for component images, CSS and scripts that can be then deployed to CDN.
-
11. Re: Load JQuery From CDN
lfryc Feb 27, 2012 8:23 AM (in response to sparrowhawk)Since RichFaces 4.2, you can use Resource Mapping feature to load resources from CDN, refer to Resource Mapping feature documentation, this particular example is provided there.