I created a special jsf tag (I'm not sure if this is correct, I could have missed something easily, so I added the code below).
Now I try to use this tag, but I get an error message:
error on line 28 in column 49: gc namespace prefix on ganttchart is undefined
So here is the xhtml page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:gc="http://myganttchart.org">
<body>
<ui:composition template="/masterpage.xhtml">
<ui:define name="title">Gantt chart test</ui:define>
<ui:define name="content">
<f:view>
<gc:ganttchart width="300" height="100" rendered="true"/>
...
</f:view>
</ui:define>
</ui:composition>
</body>
</html>
And here is the tldfile (it is placed in WEB-INF/):
<taglib xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
<tlib-version>
1.0
</tlib-version>
<short-name>
oext
</short-name>
<uri>
http://myganttchart.org
</uri>
<tag>
<name>ganttchart</name>
<tag-class>usermanagement.support.ganttchart.GanttChartTag</tag-class>
<body-content>empty</body-content>
<attribute>
<name>binding</name>
<deferred-value>
<type>javax.faces.component.UIComponent</type>
</deferred-value>
</attribute>
...
</tag>
</tablib>
Here is the piece of code tag-class:
public class GanttChartTag extends UIComponentELTag {
private ValueExpression width;
private ValueExpression height;
private ValueExpression styleClass;
public String getComponentType () {
return "org.myganttchart";
}
public String getRendererType () {
return null;
}
...
}
Correspondent block from faces-config:
<component>
<component-type>org.myganttchart</component-type>
<component-class>usermanagement.support.ganttchart.UIGanttChart</component-class>
</component>
And the last part of if UIGanttChart:
public class UIGanttChart extends UIOutput {
public UIGanttChart() {
setRendererType (null);
}
public void encodeBegin(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter ();
writer.startElement("img", this);
writer.writeAttribute("src", "no-img", "source");
writer.writeAttribute("width", getAttributes ().get ("width"), "width");
writer.writeAttribute("height", getAttributes ().get ("height"), "height");
writer.writeAttribute("class", ".someclass", "styleClass");
writer.endElement("img");
}
}
So what have I missed? Any ideas on how to debug or where there might be a problem are welcome.