Quando vou chamar esta tag da minha página JSP, recebo um NullPointerException. É como se a tag não conseguisse achar meu renderer. Alguém conseguiria achar o erro?
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<component>
<component-type>BoldOutput</component-type>
<component-class>javax.faces.component.UIOutput</component-class>
<component-extension>
<component-family>Bold</component-family>
<renderer-type>BoldOutput</renderer-type>
</component-extension>
</component>
<render-kit>
<renderer>
<component-family>Bold</component-family>
<renderer-type>BoldOutput</renderer-type>
<renderer-class>teste.BoldOutputRenderer</renderer-class>
</renderer>
</render-kit>
</faces-config>
BoldOutputRenderer.java
package teste;
import java.io.IOException;
import javax.faces.component.*;
import javax.faces.context.*;
import javax.faces.render.Renderer;
/**
*
* @author ranophoenix
*/
public class BoldOutputRenderer extends Renderer{
public void encodeBegin(FacesContext facesContext, UIComponent uIComponent) throws java.io.IOException {
if (facesContext == null)
throw new NullPointerException("Faces Context is Null");
if (!uIComponent.isRendered()){
return;
}
ResponseWriter writer = facesContext.getResponseWriter();
Object curvalue = ((UIOutput) uIComponent).getValue();
writer.write("<b>");
if (curvalue != null)
writer.write(curvalue.toString());
writer.write("</b>");
}
public void encodeEnd(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uIComponent) throws java.io.IOException {
//super.encodeEnd(facesContext, uIComponent);
}
public void encodeChildren(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uIComponent) throws java.io.IOException {
//super.encodeChildren(facesContext, uIComponent);
}
public void decode(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uIComponent) {
//super.decode(facesContext, uIComponent);
}
public String convertClientId(javax.faces.context.FacesContext facesContext, String str) {
String retValue;
retValue = super.convertClientId(facesContext, str);
return retValue;
}
}
BoldOutputTag.java
package teste;
import javax.faces.webapp.UIComponentTag;
import javax.faces.component.*;
import javax.faces.context.*;
/**
*
* @author ranophoenix
*/
public class BoldOutputTag extends UIComponentTag {
private String value="";
public String getValue(){
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getComponentType() {
return ("BoldOutput");
}
public String getRendererType() {
return ("BoldOutput");
}
/*
protected void encodeBegin() throws java.io.IOException {
ResponseWriter writer = FacesContext.getCurrentInstance().getResponseWriter();
writer.write("<b>");
writer.write(value);
writer.write("</b>");
}
*/
}
Penso que erro está na localização do Renderer, pois quando retorno null em getRendererType() da classe BoldOutputTag e descomento as linhas do método encodeBegin() a tag funciona corretamente. Alguém consegue perceber o erro?