1 16 17 package org.apache.struts.faces.renderer; 18 19 20 import java.io.IOException ; 21 22 import javax.faces.component.UIComponent; 23 import javax.faces.context.FacesContext; 24 import javax.faces.context.ResponseWriter; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 30 36 37 public class StylesheetRenderer extends AbstractRenderer { 38 39 40 42 43 46 private static Log log = LogFactory.getLog(StylesheetRenderer.class); 47 48 49 51 52 64 public void encodeEnd(FacesContext context, UIComponent component) 65 throws IOException { 66 67 if ((context == null) || (component == null)) { 68 throw new NullPointerException (); 69 } 70 71 ResponseWriter writer = context.getResponseWriter(); 72 writer.startElement("link", component); 73 writer.writeAttribute("rel", "stylesheet", null); 74 writer.writeAttribute("type", "text/css", null); 75 writer.writeURIAttribute 76 ("href", 77 context.getExternalContext().getRequestContextPath() + 78 (String ) component.getAttributes().get("path"), "path"); 79 writer.endElement("link"); 80 writer.writeText("\n", null); 81 82 } 83 84 85 86 88 89 } 90 | Popular Tags |