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

  • niv bible download for android tablet
  • 4111806966
  • music downloads android australia
  • download it girl for android
  • english marathi dictionary free download android mobile
  • download filter shekan mobile android
  • download and open zip files on android
  • htc android driver download windows 7
  • 8547598877
  • verizon android market download
  • where do the downloads go on android
  • download android 4 o
  • six guns android apk
  • android fA?r htc hd mini download
  • samsung omnia 2 i8000 android download
  • defender 2 android download
  • download game gt racing for android free
  • fifa 12 android download free apk
  • nfs na androida download za free
  • android x plane apk download
  • where is download history on android
  • download android os for acer f900
  • android market says download starting
  • office app android download
  • android for omnia 2 free download
  • application free music download android
  • skies of glory reloaded android download
  • zombieville usa 2 android download apk
  • free download office per android
  • skype na tablet z androidem download
  • mid android applications free download
  • android bullet temp root download
  • 2032318273
  • snes emulator free download android
  • documents to go android apk free download
  • samsung ace android applications free download
  • my boy free android download
  • android market clear download history
  • rom htc touch hd android
  • virtua tennis 4 android download free
  • ip calculator for android download
  • download apps games android free
  • opera mini 5 free download for android
  • free doom game download for android
  • android roms download htc hd2
  • android jogos download free
  • 1163083108
  • eclipse sdk for android download
  • hp printer driver for android phone
  • download polaris office for android phone
  • android facebook download photos
  • wrestling games download for android
  • download game android da crack
  • android app download video stream
  • cara download games di android
  • android os free download for tablet
  • site2sms android app download
  • download emulator android untuk pc
  • akinator android download deutsch free
  • pro evolution soccer 2011 full download android
  • download files from url android
  • 50 shades of grey android download free
  • tap tap revenge 3 android download free
  • android manager for alcatel download
  • bloons td 4 android app download
  • real vnc viewer android free download
  • super bluetooth hack android download
  • android download manager user agent
  • android tower defense games free download
  • google chat for android download
  • download android source code using git
  • download de aplicativos para tablet android gratis
  • adobe reader android free download software
  • 234642359
  • samsung android software download for galaxy y
  • oxford dictionary app download for android
  • download al quran untuk android gratis
  • longman dictionary android download
  • google android tablet firmware download
  • papago for android malaysia map download
  • google agenda for android download
  • android market evo download
  • android drag racing hack download
  • android apk applications downloads
  • 4446606382
  • android apps google maps download
  • how to stop downloads on android tablet
  • free download youtube downloader for android mobile
  • android live wallpaper apps download
  • my piano android apk download
  • siri per android in italiano download
  • real football 2010 android download
  • 10 billion downloads android 10 cents
  • download android cupcake rom
  • android screen locker download
  • nook download to android
  • free download mkv player for android mobile
  • android hd games direct download
  • android app mp3 download pro
  • aplikasi download lagu di hp android
  • best free android downloads
  • android source code download
  • download rom nintendo 64 android
  • 4044395992
  • situs download aplikasi android gratis
  • android mobile movie free download
  • android 3d action games download
  • magazin play android market download
  • download entire dropbox folder android
  • 9mm android sd data download
  • advanced task killer pro download android
  • 2192164648
  • podcast download to android
  • android app talking tom free download
  • traffic rush android app download
  • 8068090439
  • easy video downloader for android
  • tekken 6 download for android
  • android 25 billion downloads sale
  • photo studio pro free download for android
  • zombie eye live wallpaper android download
  • dog wars android app download
  • android developer's cookbook ebook download
  • adobe flash player android tablet download
  • android downloaden voor htc hd2
  • any web video downloader for android
  • photo editor app download for android
  • android need for speed download
  • download screenshot app for android free
  • red bull x fighters android download
  • 9837299599
  • aplikasi buat download film di android
  • can i download android operating system
  • apk android download site
  • download divx player for android tablet
  • tune me pro android free download
  • download sd card speed test for android
  • download android market app for htc evo
  • atube downloader for android
  • quem quer ser milionario android free download
  • android 4 motorola xoom download
  • 2 player reactor android download free
  • plants vs zombies android download free apk
  • blackberry messenger app for android free download
  • epad android software free download
  • jogos android download gratis no pc
  • ipl games download for android
  • android url video downloader
  • download ebook reader for android apk
  • briscola per android gratis download
  • failed download on android
  • youtube player android free download
  • android theme download
  • google movie studio android download
  • tempat download aplikasi android selain play store
  • download latest version of applanet for android
  • download bad piggies hd android
  • download screenshot for android apk
  • free download aplikasi kamera tembus pandang android
  • apps android kostenlos downloaden
  • my bmw remote android apk
  • music download sites for android
  • best antivirus for android phones free download
  • english myanmar dictionary download for android
  • 2175322432
  • best app android market downloading music
  • android apps download auf pc
  • 3d map download for android
  • free download blacklist software for android
  • melhores aplicativos android para baixar videos
  • android tablet apps download pc
  • latest android version download free
  • breaking dawn movie download for android
  • can't download from android market
  • video downloader application for android
  • chrono trigger android apk espaAol
  • android market is not downloading apps
  • mobile9 download aplikasi android
  • jogos para celular gratis download android
  • download song pop android app
  • quicktime download para android
  • mobile tv android download free
  • download aplikasi bbm untuk android free
  • android market download latest
  • armored strike android apk download
  • android launcher 3d style download
  • applicazioni android da scaricare su pc
  • download android market for nook tablet
  • google play to download android apps
  • download chinese android market here
  • google authenticator android download
  • plants vs zombies download free for android
  • download foxfi app for android
  • android market htc desire download
  • 1287761572
  • download firefox for android
  • hp touchpad android cyanogenmod download
  • cara download game android secara gratis
  • android games free download center
  • winds of steel android free download
  • pro android 4 book download
  • 6412993596
  • epub reader android free download
  • android phone will not download picture messages
  • download android nokia n810
  • android ice cream sandwich os download
  • call manager pro android download
  • eclipse ide for android development free download
  • dj hero mobile android apk download
  • pepsi man game download for android
  • pes 2010 para android download gratis
  • application download for android phone
  • android evo 4g driver download
  • download android for nokia c3 00
  • android audio manager pro download
  • code google android wifi tether downloads list
  • top 10 android apps to download
  • nba pro basketball 2010 android free download
  • android to download
  • android games x8 download
  • mobile9 android apps free download
  • game pes 2012 free download for android
  • android game cracked download
  • download turbofly 3d for android free
  • download android app manager apk
  • documents to go android tablet free download
  • android market updates download unsuccessful
  • download appbrain app market for android
  • android market for sony tablet download
  • download ebook for android mobile
  • application locker download for android
  • android market app download for phone
  • best android games free download list
  • google chrome android download unsuccessful
  • free kjv bible download android
  • 9mm android free download apk
  • assassin's creed revelations android apk download
  • youtube music downloader app android
  • android market for xoom download
  • android usb drivers download for windows 7
  • dropbox android download location
  • download ebook android programming tutorials 3rd edition
  • android problem downloading holdsworth
  • 9mm free download android
  • 2361218186
  • asphalt 7 hd free download android
  • apps illegal downloaden android
  • download an android app
  • download tv for android phone
  • android apps fA?r playbook download
  • bios para gameboid android download
  • aplikacjA na androida download free
  • jogos para motorola xt300 android download
  • download failed android browser
  • android open source code download
  • download games prince of persia for android
  • how to download wmv files on android
  • app free download android
  • 4013425296
  • hp touchpad android cm9 download
  • game hunter android app free download
  • jelly bean android galaxy s3 verizon
  • android games 320x480 download
  • android gingerbread htc desire hd download
  • download the latest android market app
  • android sdk free download for windows 8
  • android dropbox app download folder
  • android sdk windows xp free download
  • android market download for pandigital novel
  • android phones download pictures
  • android football manager game download
  • android auto install downloaded apk
  • gameboy color emulator android download
  • chrome browser android apk download
  • download game pes untuk android gratis
  • rock band 3 free download for android
  • shift worker app for android download
  • fl studio android beta download
  • download android lockscreen for iphone 3gs
  • download imvu 2go on android
  • flight control android download free
  • download atilt 3d labyrinth para android
  • free android app download websites
  • can't download apps from android market
  • defender game for android free download
  • air display android download
  • samsung usb drivers android download
  • cant download games on android
  • download android apps for sony ericsson vivaz
  • download game data splinter cell conviction android
  • android os download for virtualbox
  • gps tracker free download android
  • 9084791180
  • 7868529575
  • download was unsuccessful android evo
  • free download after focus pro for android
  • death worm android apk download
  • hvga 320x480 android games free download
  • 9906328092
  • teamviewer 7 download per android
  • android network toolkit platinum apk download
  • application installer for android download
  • 2581052636
  • gameboid gba emulator android download
  • asphalt 7 android download 4shared
  • android firmware download for corby 2
  • download software bbm untuk android
  • android theme nokia 5230 download
  • xperia arc s android games download
  • android could not be downloaded error 941
  • google chrome android beta download apk
  • download yahoo messenger android tablet
  • camera fun pro android
  • download all dropbox to android
  • android tablet where do downloads go
  • download adobe reader for android phone
  • 3107625870
  • iphone interface for android download
  • lg android usb device treiber download
  • aldiko ebook android download
  • android apk downloads free
  • gmail android download picture
  • android super mario apk download
  • better android better keyboard app download
  • android jelly bean download for galaxy note
  • pes 2012 android game free download
  • german dictionary android download
  • download app from android market using pc
  • aplikasi download bbm untuk android
  • eclipse android app example download
  • android antivirus software download
  • guitar solo android full version download
  • virtual dj android app download
  • cnet youtube downloader for android
  • texas hold'em poker 2 android free download
  • rovio angry birds download for android
  • zedge app for android
  • android google maps offline doesn't download
  • navigace pro android zdarma download
  • java download per android
  • android download mode verlassen
  • android voice dialing software download
  • download aplikasi tema untuk android
  • tom cat 2 free download android
  • android aplikacje download za darmo
  • android download to sd card default
  • pro opengl es for android download
  • android htc clock widget download
  • best android music download app 2012
  • amazon app download for android
  • how to download podcast onto android
  • download cho den android
  • download itunes on android phone
  • s3c6410 android adb driver download
  • emulador gba para android download
  • bad company 2 android download
  • download roll a joint apk android
  • android for raspberry pi download
  • android market movies download or stream
  • android picture download app
  • android adults games free download
  • download raging thunder 3 for android
  • android market download for xperia x10 mini
  • new android system download
  • beat making software for android tablet
  • android google contacts apk download
  • android apk download folder
  • download ted videos android
  • bro kodex android download
  • free download font ttf for android
  • adt android development tools download
  • cooking academy 2 android free download
  • night vision cam for android free download
  • download apps on android for free
  • avi player android download
  • download agingbooth para android
  • epub mobi for android
  • android apps download freeware
  • air playit android download
  • android bible app download
  • android picture message stuck on downloading
  • free android applications for download
  • big city adventure android download
  • cs guns android download
  • download google hangout for android
  • the whip app android download
  • pdanet 32 bit download android
  • pokemon emerald emulator download for android
  • flash player android download free
  • avd android virtual device download
  • message software android
  • app download de musica para android
  • android platform for pc free download
  • android rom download pokemon
  • eclipse java download android
  • settlers of catan for android free download
  • download aplikasi alat musik untuk android
  • best music download android apps 2011
  • navigace pro android free download
  • download full version android games
  • doodle jump full game free android
  • download pacote roms snes android
  • crack wifi android free download
  • google voice android app download apk
  • fight game heroes android apk
  • doom 3 download for android
  • download phan mem diet virus cho android
  • bejeweled 2 android apk download
  • download de musica para android
  • 4191357756
  • android update os updater download
  • 2go download for samsung android
  • android adt zip download
  • free video download manager for android
  • download android source without git
  • youtube video download software for android
  • android emulator download for windows 8
  • ang biblia tagalog free download for android
  • live tv download for android
  • learn to fly free download android
  • quake 2 android pak0 download
  • talking tom 2 android download to pc
  • android market download problems
  • jetpack game download android
  • android gps example code download
  • good music downloader app for android
  • emulador gba download android
  • psx games download for android
  • google maps android navigation uk download
  • spb shell 3d free download android crack
  • android usb drivers download xp
  • 7860896835
  • android swype keyboard apk download