Skip to content

Instantly share code, notes, and snippets.

@lfryc
Created September 29, 2011 19:02
Show Gist options
  • Save lfryc/1251612 to your computer and use it in GitHub Desktop.
Save lfryc/1251612 to your computer and use it in GitHub Desktop.
private UIComponent createComponentResource(FacesContext ctx, ResourceDependency dep) {
Expressions exprs = expressionsMap.get(dep);
Application app = ctx.getApplication();
String resname = exprs.getName(ctx);
UIComponent c = ctx.getApplication().createComponent("javax.faces.Output");
c.setRendererType(app.getResourceHandler().getRendererTypeForResourceName(resname));
Map<String,Object> attrs = c.getAttributes();
attrs.put("name", resname);
if (exprs.library != null) {
attrs.put("library", exprs.getLibrary(ctx));
}
if (exprs.target != null) {
attrs.put("target", exprs.getTarget(ctx));
}
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment