//Use more compatible way.
UIComponent outputScript = facesContext.getApplication().
createComponent(facesContext, "javax.faces.Output", "javax.faces.resource.Script");
outputScript.getAttributes().put("name", resourceName);
outputScript.getAttributes().put("library", libraryName);
outputScript.encodeAll(facesContext);
}
else
{
//Fast shortcut, don't create component instance and do what HtmlScriptRenderer do.
Resource resource = facesContext.getApplication().getResourceHandler().createResource(resourceName, libraryName);