Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c01/h14/mnt/37629/domains/ on line 36

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c01/h14/mnt/37629/domains/ on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c01/h14/mnt/37629/domains/ on line 540
Evolutionary Dawn » Custom JSF Component 1.2

Evolutionary Dawn

June 11, 2009

Custom JSF Component 1.2

Filed under: Uncategorized — admin @ 12:25 pm

Since I had a hard time finding a complete solution anywhere online I decided that I would post a simple how-to for a JSF Custom component.

The problem that this component seeks to address is that the <f:verbatim> tag does not work properly in a <ui:repeat> tag.

This presented a issue to me because I have RAW HTML stored in my data model to be used in my simple blog application.

1. The most confusing thing about JSF Custom components.  YOU NEED 3 SEPERATE CLASSES TO IMPLEMENT A CUSTOM COMPONENT.

Alot of other tutorials will teach you there is a method in which you can use only two classes to accomplish the task, although this is true the most straight forward approach is to use 3 classes to implement your component.

The are as follows:

  1.  The component class (For this tutorial: HTMLVerbatimComponent) This class is technically where the “DATA” resisdes
  2. The tag class (For this tutorial: HTMLVerbatimTag) This class is the ADAPTER piece between the “JSF Page” and the DATA Model “Your component”
  3. The renderer class (For this tutorial: HTMLVerbatimRenderer) This class is response for the actual rendering of the HTML or OUTPUT.

The component class:

package com.mdb.web.jsf.component;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
import javax.el.ValueExpression;
public class HTMLVerbatimComponent extends UIComponentBase {
    public HTMLVerbatimComponent() { }
    //Properties you want exposed as tag values must be exposed using getters/setters
    private String value;
    public String getValue() {
        if(value != null)
            return value;
        //If the value has not already been set interpret the Expression language and get resulting object
        Object value = this.getValueExpressionValue("value");
        return value != null ? (String)value : null;
    public void setValue(String value) { this.value = value;}
    //Honestly I am not sure what this method does besides link the component to the config files
    public String getFamily() {
        return "com.mdb.web.jsf.component.HTMLVerbatim";
    //Method allows component state to be stored
    public Object saveState(FacesContext context) {
        return new Object[] { super.saveState(context), value};
    //Method allows component state to be restored
    public void restoreState(FacesContext context, Object object) {
        Object state[] = (Object[]) object;
        super.restoreState(context, state[0]);
        value = (String)state[1];
    //Helper method to simplify getters/setters
    //This helps the JSF Component use Expression Language
    private Object getValueExpressionValue(String name) {
        ValueExpression ve = super.getValueExpression(name);
        return ve.getValue(FacesContext.getCurrentInstance().getELContext());

The tag class:

package com.mdb.web.jsf.component;
import javax.faces.webapp.UIComponentELTag;
import javax.faces.component.UIComponent;
import javax.el.ValueExpression;
public class HTMLVerbatimTag extends UIComponentELTag {
    //Temporary holder property hence if I put
    //&lt;tag:htmlVerbatim value="#{SomeBackingBean.htmlText}"/&gt;
    //information is stored in this object until the data is pushed into the component in setProperties method
    private ValueExpression value = null;
    public HTMLVerbatimTag() {}
    public ValueExpression getValue() { return this.value;}
    public void setValue(ValueExpression value) { this.value = value;}
    //This is where the action happens
    //Data is taken from the tag on the JSF Page and placed into the Component
    protected void setProperties(UIComponent component) {
        HTMLVerbatimComponent verbatimComponent = (HTMLVerbatimComponent)component;
        if(value != null) {
            verbatimComponent.setValueExpression("value", value);
    //Method links this tag object to the component in config files
    public String getComponentType() { return "com.mdb.web.jsf.component.HTMLVerbatim"; }
    //Method links this tag object to the renderer in config files
    public String getRendererType() { return "com.mdb.web.jsf.component.HTMLVerbatim";}

The renderer class:

package com.mdb.web.jsf.component;import javax.faces.render.Renderer;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
public class HTMLVerbatimRenderer extends Renderer {public HTMLVerbatimRenderer() {}
    //Render your HTML HERE
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        HTMLVerbatimComponent verbatimComponent = (HTMLVerbatimComponent)component;
        ResponseWriter writer = context.getResponseWriter();

Now you must make some changes to your configuration files and I make the big assumption you are using Facelets.

Create a file in your WEB-INF directory called: custom.taglib.xml

Add the following content (Edit accordingly for your own component and domain):

  "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"

Edit your faces-config.xml and add the following content(Edit accordingly for your own component and domain):

<faces-config version="1.2">

Edit your web.xml and add the following content:


Now you should be able to use your new component/tag simply by adding a namespace to your JSF Page as such:


then using the tag as such:

<custom:htmlverbatim value="#{SomeBackingBean.htmlText}">

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress

  • alexis petite dresses
  • wife takes black cick for hubby
  • Helen mirren nude videos
  • candice michelle naked galleries
  • black girl nude free
  • sex scenes from any movie
  • anal sex pre cum
  • lesbian boobs at tube
  • pictures of hot chicks in thongs
  • original vivica oral cellpone sextape
  • free pictures of anal rimming
  • cute lesbian anal
  • ms video group japan
  • free tube upskirt videos
  • V factory dem hot girls
  • free amateur plump videos
  • cowgirl sherriff sex
  • fisting lesbians ass fisting lessons
  • forced wife sexual stories
  • Nude actresses video
  • quality pictures asian
  • star fuck me
  • asian aicts movie
  • bikini girls fishing
  • free art galleries
  • teen sucking video
  • Xxx hot girls
  • free pictures african godesses ass
  • model fuck xxx
  • hot teen first time fucked movies
  • asian teen kitty star
  • femdom girls free pictures
  • extreme fuck tube
  • tiny asian pussies big black cocks
  • japanese pleasure girls
  • sex video man licks tit
  • Nude pictures of prejean
  • couples sex vidoes
  • amateur facial galleries
  • massive fat ass picture
  • women fuck young guys
  • sexy fantasy girls riding dragons
  • slutload teens gang bang
  • video search enginge
  • forum sex anal
  • euro girl naked
  • teenage girls and boys
  • real flashing teens
  • thailand sexy girls pictures
  • girls anal shots
  • pink pussy black monster
  • naughty girl party in erie pa
  • super girl meets black
  • teen candid amateur homemade sex
  • dominant mature wives ass
  • College the movie sex
  • teen dick size
  • Russian girls fighting
  • badongo amateur videos
  • boys naked spanish young
  • mature milfs fat sex pics
  • bikini teen girls
  • tiny naked teens
  • men eating pussy xxx
  • galleries of brutal shemale deepthroating
  • slut collage girls video
  • free bikini solo masturbation
  • busty redhead star pics
  • horny girls with big boobs
  • black girl having sex on camera
  • university of washington oral sex
  • alsscan model littlecaprice pussy
  • Ugly hot girls
  • Hot black lesbians
  • enigma video girls
  • sexy ass in panties
  • fake celebrity sex video carol brady
  • sexy mature bbw
  • boobs pics gallery
  • holic school girls xxx pics
  • lb girl group fuck hard
  • girl gitting her pussy pissed in
  • video blowjob choke force
  • teen nudism gallery
  • sex movies young young girls
  • teen pyschology and sex
  • hair length petite
  • yound teen ebony
  • black men fuck asian girl
  • pics of bikini
  • hott sex girls
  • black dvd
  • free vibrator orgasm
  • three amateur stripper pics
  • japanese girls gallery thumb
  • topless bar pictures
  • asian massage girl w
  • girls crapping galleries
  • old fat granny threesome vids
  • hot bikini lesbian
  • pussy pump fat
  • flintstones group sex
  • jessica simpson dirty girl pics
  • fffm videos
  • Nude girls with big butts
  • shemale fuck old man videos
  • Black man fucking girls
  • interracial lesbian movies outdoors asses
  • mavs girls fitness beauties
  • Man fucked in ass
  • Big australian boobs
  • hot pakistani babes pics
  • mature looking for sexfun in basingstoke
  • best shemale cum swallow movies
  • busty nonude teen bikini
  • Sex disney movies
  • amateur skirt sex
  • teen videops
  • stream couples video
  • Homemade lesbian videos
  • free teen cumshot picture gallery
  • latino anal sex thumbs
  • naked hard dick pics free
  • free school girl sex video
  • sexy hairy pussy blondes
  • young and old lesbian lesbian tube
  • ameture college teen sex
  • interracial cum shot free pics
  • amateur stripping vids free
  • free bimbo sex galleries
  • blowjob party xhamster
  • free japanese girls movies
  • striping babes pics
  • Milf anal gallery
  • miriam gonzalez topless pics
  • ebony sleep sex
  • thick dick in her tight butt
  • adorable korean blowjob
  • big sexy mature ladies
  • lesbian mature full free videos
  • is anal sex for men
  • itty bitty teeny tiny pussy
  • hypnotize sex confession wife
  • bollywood celebrity xxx big tits gallery
  • free canadian movies
  • sex fuck hardcore
  • grandma having sex with young boy
  • petite young teenagers
  • pierced pussy lips pierced tattooed
  • amateur druged teen gang
  • Big black sexy tits
  • free latina teen ass videos
  • mature lesbian seduces schoolgirl
  • katie morgan butt sex
  • photos of naked girls vaginas clitori
  • footballers wives snooker table sex
  • swingers convention galleries
  • asain pool sex movie
  • sexy wife training video
  • Teen hitchhiker video
  • unstable flashing video screen
  • teen girls mean girls
  • homemade interracial thumbs
  • sexy nude teen erotic
  • free sex video emo
  • Rambha sex videos
  • cyberskin pussy video
  • video girls dancing naked nude panties
  • free dy fuck me
  • young babe teenage pussy
  • Nude girls giving head
  • amateur photo et sexe
  • hot blonde fucking huge black cock
  • compilation videos innocent girls
  • Lesbian hindi movies
  • faith throat job video
  • teen girl webcam pics
  • mature lesbian galleries
  • japanese teen girl orgy
  • pussy eating sex club contest pics
  • Sailor moon sex scene
  • black heaven movie
  • sex indan girl
  • whatch free videos
  • Porn nude movie
  • lesbian ass fisting tube
  • girls shocked at huge tits
  • handjob mature women clothed s
  • dave naked yahoo webcam
  • hirny young wives
  • naked my wife s sister cock
  • beautiful black young girls
  • naked star pics
  • celeb fucking pink pussy
  • girls having sex while tied up