JSF 2.0 自定义组件 不执行
MonkZ 2011-03-27 11:19:53 我搭建了一个JSF2.0+SPRING3.0.5的环境,JSF使用myfaces2.0.4,其它正常,
问题:按照网上的自定义组件方案开发一个自定义组件,不知道为什么,网页上直接输出,不走自定义组件的类,
我的自定义组件类,很简单,继承UIComponentBase
@FacesComponent(value = "MCCOMHelloWorld")
public class MCCOMHelloWorld extends UIComponentBase {
/**
*
*/
@Override
public String getFamily() {
return null;
}
@Override
public void encodeAll(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", this);
writer.writeAttribute("style", "color:red", null);
writer.writeText("Hello JSF2.0", null);
writer.endElement("div");
}
}
<tag>
<tag-name>hello</tag-name>
<component>
<component-type>MCCOMHelloWorld</component-type>
</component>
</tag>
我用的是jboss tools ,将namespace包括后,组件都能提示,真是郁闷为啥不执行,
谢谢各位大牛!
下图是从火狐firebug截出来的
<tt:leftmenu menulist="[mc.pf.pub.entity.Pf_SysFunNodeDO@1fa97ad, mc.pf.pub.entity.Pf_SysFunNodeDO@fbea20, mc.pf.pub.entity.Pf_SysFunNodeDO@c817e7, mc.pf.pub.entity.Pf_SysFunNodeDO@994959, mc.pf.pub.entity.Pf_SysFunNodeDO@19ea18d]"></tt:leftmenu>直接把标签输出了,而且把我的数据这样打出来,我晕