File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF2.0 custom component development Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF2.0 custom component development" Watch "JSF2.0 custom component development" New topic

JSF2.0 custom component development

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Howdy Ranchers,

I am developing a custom component with working environment Jboss 5.1 and JSF2.0 and jsf-facelets-1.1.15.B1. But i am not able to get it working.

Following are the classes and xml entries:




<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<facelet-taglib xmlns=""

and java classes

import javax.faces.component.UIComponentBase;

public class FrameComponent extends UIComponentBase{

public String getFamily() {
return "iFrame";

public String getRendererType() {
return "javax.faces.Frame";


import javax.faces.view.facelets.ComponentConfig;
import javax.faces.view.facelets.ComponentHandler;

public class FrameHandler extends ComponentHandler{

public FrameHandler(ComponentConfig config) {
// @Override
// protected MetaRuleset createMetaRuleset(Class type) {
// return super.createMetaRuleset(type).alias("class", "styleClass");
// }


import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.FacesRenderer;
import javax.faces.render.Renderer;
public class FrameRenderer extends Renderer {

public void encodeBegin(FacesContext context,UIComponent component) throws IOException {

ResponseWriter writer = context.getResponseWriter();

writer.startElement("iframe", null);
writer.writeAttribute("src", component.getAttributes().get("src"), "src");
writer.writeAttribute("style", component.getAttributes().get("style"), "style");
writer.writeAttribute("frameborder", component.getAttributes().get("frameborder"), "frameborder");
writer.writeAttribute("scrolling", component.getAttributes().get("scrolling"), "scrolling");

public void encodeEnd(FacesContext context,UIComponent component) throws IOException {
ResponseWriter writer = context.getResponseWriter();

Also there is no entry in faces-config.xml

But whenever i am trying to load a page where this component is used i am getting error :
org.xml.sax.SAXParseException: Document root element "facelet-taglib", must match DOCTYPE root "null".

please help me out.

jQuery in Action, 3rd edition
subject: JSF2.0 custom component development
It's not a secret anymore!