<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Open Garage</title>
	<atom:link href="http://opengarage.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://opengarage.wordpress.com</link>
	<description>Simple solutions for complex problems</description>
	<lastBuildDate>Tue, 16 Jun 2009 20:05:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='opengarage.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Open Garage</title>
		<link>http://opengarage.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://opengarage.wordpress.com/osd.xml" title="Open Garage" />
	<atom:link rel='hub' href='http://opengarage.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Adding another available attribute</title>
		<link>http://opengarage.wordpress.com/2008/10/15/adding-another-available-attribute/</link>
		<comments>http://opengarage.wordpress.com/2008/10/15/adding-another-available-attribute/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 20:04:00 +0000</pubDate>
		<dc:creator>Finbox</dc:creator>
				<category><![CDATA[JSF 1.2]]></category>
		<category><![CDATA[Custom Controls]]></category>
		<category><![CDATA[Jaca Server Faces]]></category>
		<category><![CDATA[JSF]]></category>

		<guid isPermaLink="false">http://opengarage.wordpress.com/2009/06/16/adding-another-available-attribute/</guid>
		<description><![CDATA[Now I will add another attribute available with UIComponentELTag which is rendered. This is a boolean attribute. Note that this attribute is a value express. This is depicted by the use of &#60;deferred-value&#62; tag in Listing 1. Listing 1 &#8211; helloworld.tld &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;taglib xsi:schemaLocation=&#34;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd&#34; xmlns=&#34;http://java.sun.com/xml/ns/javaee&#34; xmlns:xsi=&#34;http://www.w3.org/2001/XMLSchema-instance&#34; version=&#34;2.1&#34;&#62; &#60;description&#62;This is the JSP tag [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=107&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Now I will add another attribute available with UIComponentELTag which is rendered. This is a boolean attribute. Note that this attribute is a value express. This is depicted by the use of &lt;deferred-value&gt; tag in Listing 1.</p>
<p><strong><u>Listing 1 &#8211; helloworld.tld</u></strong></p>
<p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; </p>
<p>&lt;taglib    <br />xsi:schemaLocation=&quot;<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a> <a href="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd&quot;</a>    <br />xmlns=&quot;<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee&quot;</a>    <br />xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance&quot;</a>    <br />version=&quot;2.1&quot;&gt;     <br />&lt;description&gt;This is the JSP tag library for the custom components chapter.&lt;/description&gt;     <br />&lt;display-name&gt;simplefaces&lt;/display-name&gt;     <br />&lt;tlib-version&gt;1.0&lt;/tlib-version&gt;     <br />&lt;short-name&gt;sf&lt;/short-name&gt;     <br />&lt;uri&gt;<a href="http://opengarage.org/simplefaces">http://opengarage.org/simplefaces</a>&lt;/uri&gt;     <br />&lt;tag&gt;     <br />&lt;description&gt;Helloworld&lt;/description&gt;     <br />&lt;name&gt;helloworld&lt;/name&gt;     <br />&lt;tag-class&gt;org.opengarage.simplejsf.components.taglib.HtmlHelloWorldTag&lt;/tag-class&gt;     <br />&lt;body-content&gt;empty&lt;/body-content&gt;     <br />&lt;attribute&gt;     <br />&lt;description&gt;The client id of this component&lt;/description&gt;     <br />&lt;name&gt;id&lt;/name&gt;     <br />&lt;rtexprvalue&gt;true&lt;/rtexprvalue&gt;     <br />&lt;/attribute&gt; </p>
<p><strong>&lt;attribute&gt;      <br />&lt;description&gt;Control rendering of this component&lt;/description&gt;       <br />&lt;name&gt;rendered&lt;/name&gt;       <br />&lt;deferred-value&gt;       <br />&lt;type&gt;boolean&lt;/type&gt;       <br />&lt;/deferred-value&gt;       <br />&lt;/attribute&gt;</strong>    <br />&lt;/tag&gt;     <br />&lt;/taglib&gt;</p>
<p>Now that this attribute is added using it is very simple as shown in Listing 2</p>
<p><strong><u>Listing 2.</u></strong></p>
<p>&lt;%@ page contentType=&quot;text/html;charset=UTF-8&quot; language=&quot;java&quot; %&gt;    <br />&lt;%@ taglib prefix=&quot;f&quot; uri=&quot;<a href="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core&quot;</a> %&gt;     <br />&lt;%@ taglib prefix=&quot;h&quot; uri=&quot;<a href="http://java.sun.com/jsf/html">http://java.sun.com/jsf/html&quot;</a> %&gt;     <br />&lt;%@ taglib prefix=&quot;sf&quot; uri=&quot;<a href="http://opengarage.org/simplefaces">http://opengarage.org/simplefaces&quot;</a> %&gt; </p>
<p>&lt;f:view &gt;    <br />&lt;html&gt;     <br />&lt;head&gt;     <br />&lt;title&gt;hello&lt;/title&gt;     <br />&lt;/head&gt;     <br />&lt;body&gt;     <br />&lt;h2&gt;Custom Helloworld component&lt;/h2&gt;     <br />&lt;p&gt;     <br />&lt;sf:helloworld id=&quot;test&quot; <strong>rendered=&quot;false&quot;</strong>/&gt;     <br />&lt;/p&gt;     <br />&lt;/body&gt;     <br />&lt;/html&gt;     <br />&lt;/f:view&gt;</p>
<p>As shown in listing 2, setting the value of the attribute to &#8216;false&#8217; means this custom component is no longer visible. Check this by running the example.</p>
<br />Posted in JSF 1.2  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opengarage.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opengarage.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opengarage.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opengarage.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opengarage.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opengarage.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opengarage.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opengarage.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opengarage.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opengarage.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opengarage.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opengarage.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opengarage.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opengarage.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=107&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opengarage.wordpress.com/2008/10/15/adding-another-available-attribute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1099920669c8e0cf2a1701d2fb0c1285?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dhrubo</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding an attribute to the custom component</title>
		<link>http://opengarage.wordpress.com/2008/09/09/adding-an-attribute-to-the-custom-component/</link>
		<comments>http://opengarage.wordpress.com/2008/09/09/adding-an-attribute-to-the-custom-component/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 19:59:00 +0000</pubDate>
		<dc:creator>Finbox</dc:creator>
				<category><![CDATA[JSF 1.2]]></category>
		<category><![CDATA[Custom Controls]]></category>
		<category><![CDATA[Jaca Server Faces]]></category>
		<category><![CDATA[JSF]]></category>

		<guid isPermaLink="false">http://opengarage.wordpress.com/2009/06/16/adding-an-attribute-to-the-custom-component/</guid>
		<description><![CDATA[Well my custom component seems to be working fine with the web application let me now add an attribute. 1&#62; As the HtmlHelloWorldTag extends UIComponentELTag the id attribute is available. In order to turn it on just change the tld file as shown highlighted in Listing 1. Listing 1-helloworld.tld &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;taglib xsi:schemaLocation=&#34;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd&#34; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=103&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well my custom component seems to be working fine with the web application let me now add an attribute. </p>
<p>1&gt; As the HtmlHelloWorldTag extends UIComponentELTag the id attribute is available. In order to turn it on just change the tld file as shown highlighted in Listing 1.</p>
<p><strong><u>Listing 1-helloworld.tld</u></strong></p>
<p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; </p>
<p>&lt;taglib    <br />xsi:schemaLocation=&quot;<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a> <a href="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd&quot;</a>    <br />xmlns=&quot;<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee&quot;</a>    <br />xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance&quot;</a>    <br />version=&quot;2.1&quot;&gt;     <br />&lt;description&gt;This is the JSP tag library for the custom components chapter.&lt;/description&gt;     <br />&lt;display-name&gt;simplefaces&lt;/display-name&gt;     <br />&lt;tlib-version&gt;1.0&lt;/tlib-version&gt;     <br />&lt;short-name&gt;sf&lt;/short-name&gt;     <br />&lt;uri&gt;<a href="http://opengarage.org/simplefaces">http://opengarage.org/simplefaces</a>&lt;/uri&gt;     <br />&lt;tag&gt;     <br />&lt;description&gt;Helloworld&lt;/description&gt;     <br />&lt;name&gt;helloworld&lt;/name&gt;     <br />&lt;tag-class&gt;org.opengarage.simplejsf.components.taglib.HtmlHelloWorldTag&lt;/tag-class&gt;     <br />&lt;body-content&gt;empty&lt;/body-content&gt;     <br />&lt;attribute&gt;     <br />&lt;description&gt;The client id of this component&lt;/description&gt;     <br />&lt;name&gt;id&lt;/name&gt;     <br />&lt;rtexprvalue&gt;true&lt;/rtexprvalue&gt;     <br />&lt;/attribute&gt;    <br />&lt;/tag&gt;     <br />&lt;/taglib&gt;</p>
<p>2&gt; Now modifiy the webtiersample.jsp as shown in Listing 2.</p>
<p>&lt;%@ page contentType=&quot;text/html;charset=UTF-8&quot; language=&quot;java&quot; %&gt;    <br />&lt;%@ taglib prefix=&quot;f&quot; uri=&quot;<a href="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core&quot;</a> %&gt;     <br />&lt;%@ taglib prefix=&quot;h&quot; uri=&quot;<a href="http://java.sun.com/jsf/html">http://java.sun.com/jsf/html&quot;</a> %&gt;     <br />&lt;%@ taglib prefix=&quot;sf&quot; uri=&quot;<a href="http://opengarage.org/simplefaces">http://opengarage.org/simplefaces&quot;</a> %&gt; </p>
<p>&lt;f:view &gt;    <br />&lt;html&gt;     <br />&lt;head&gt;     <br />&lt;title&gt;hello&lt;/title&gt;     <br />&lt;/head&gt;     <br />&lt;body&gt;     <br />&lt;h2&gt;Custom Helloworld component&lt;/h2&gt;     <br />&lt;p&gt;     <br />&lt;sf:helloworld id=&quot;test&quot;/&gt;     <br />&lt;/p&gt;     <br />&lt;/body&gt;     <br />&lt;/html&gt;     <br />&lt;/f:view&gt;</p>
<p>Well as you can see above I have used the &quot;id&quot; attribute. You can refresh the browser now. Everything works fine except that the id does not appear (do view source for that). Well it works but the &quot;id&quot; has not been attached to our component. In the next post I will show how to do this. </p>
<p><strong>Note</strong> &#8211; <u>You may need to clear Tomcat temp work directory (on Blazon right click on server &#8211; &#8216;Clean Tomcat Work Directory&#8217; ) to see the changes.</u></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/opengarage.wordpress.com/103/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/opengarage.wordpress.com/103/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opengarage.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opengarage.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opengarage.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opengarage.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opengarage.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opengarage.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opengarage.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opengarage.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opengarage.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opengarage.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opengarage.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opengarage.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opengarage.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opengarage.wordpress.com/103/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=103&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opengarage.wordpress.com/2008/09/09/adding-an-attribute-to-the-custom-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1099920669c8e0cf2a1701d2fb0c1285?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dhrubo</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the attribute in Custom component</title>
		<link>http://opengarage.wordpress.com/2008/09/08/using-the-attribute-in-custom-component/</link>
		<comments>http://opengarage.wordpress.com/2008/09/08/using-the-attribute-in-custom-component/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 20:00:00 +0000</pubDate>
		<dc:creator>Finbox</dc:creator>
				<category><![CDATA[Spring framework]]></category>

		<guid isPermaLink="false">http://opengarage.wordpress.com/2009/06/08/using-the-attribute-in-custom-component/</guid>
		<description><![CDATA[In my last post I discussed how simple it is to enable the available attributes. However I am sure you were not convinced that it worked. Well I will clarify the doubts in this post. The modified UI component class is shown in Listing 1. I have highlighted the part that I have added. Listing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=105&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In my last post I discussed how simple it is to enable the available attributes. However I am sure you were not convinced that it worked. Well I will clarify the doubts in this post. The modified UI component class is shown in Listing 1. I have highlighted the part that I have added. </p>
<p><strong><u>Listing 1</u></strong></p>
<p>package org.opengarage.simplejsf.components.component; </p>
<p>import java.io.IOException; </p>
<p>import javax.faces.component.UIComponentBase;    <br />import javax.faces.context.FacesContext;     <br />import javax.faces.context.ResponseWriter; </p>
<p>/**    <br />* @author dhrubo     <br />*     <br />*/     <br />public class HtmlHelloWorld extends UIComponentBase { </p>
<p>/* (non-Javadoc)    <br />* @see javax.faces.component.UIComponent#getFamily()     <br />*/     <br />@Override     <br />public String getFamily() {     <br />return null;     <br />} </p>
<p>/* (non-Javadoc)    <br />* @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)     <br />*/     <br />@Override     <br />public void encodeBegin(FacesContext context) throws IOException {     <br />ResponseWriter writer = context.getResponseWriter();     <br /><strong>String id = (String) this.getAttributes().get(&quot;id&quot;);      <br />System.out.println(&quot;id==&quot;+id);       <br /></strong>writer.startElement(&quot;div&quot;, this);     <br /><strong>writer.writeAttribute(&quot;id&quot;, id, null);      <br /></strong>writer.writeAttribute(&quot;style&quot;, &quot;color : red&quot;, null);     <br />writer.writeText(&quot;HelloWorld! today is: &quot; + new java.util.Date(), null);     <br />writer.endElement(&quot;div&quot;); </p>
<p>}    <br />}</p>
<p>Now modify the webtiersample.jsp as shown in Listing 2.</p>
<p><strong><u>Listing 2</u></strong></p>
<p>&lt;%@ page contentType=&quot;text/html;charset=UTF-8&quot; language=&quot;java&quot; %&gt;    <br />&lt;%@ taglib prefix=&quot;f&quot; uri=&quot;<a href="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core&quot;</a> %&gt;     <br />&lt;%@ taglib prefix=&quot;h&quot; uri=&quot;<a href="http://java.sun.com/jsf/html">http://java.sun.com/jsf/html&quot;</a> %&gt;     <br />&lt;%@ taglib prefix=&quot;sf&quot; uri=&quot;<a href="http://opengarage.org/simplefaces">http://opengarage.org/simplefaces&quot;</a> %&gt; </p>
<p>&lt;f:view &gt;    <br />&lt;html&gt;     <br />&lt;head&gt;     <br />&lt;title&gt;hello&lt;/title&gt;     <br />&lt;/head&gt;     <br />&lt;body&gt;     <br />&lt;h2&gt;Custom Helloworld component&lt;/h2&gt;     <br />&lt;p&gt;     <br />&lt;sf:helloworld <strong>id=&quot;test&quot;</strong>/&gt;     <br />&lt;/p&gt;     <br />&lt;/body&gt;     <br />&lt;/html&gt;     <br />&lt;/f:view&gt;</p>
<p>Now you can browse to &#8211; <a href="http://localhost:8080/simpleweb/">http://localhost:8080/simpleweb/</a> and do a view source once the view is rendered on the screen. You will see this</p>
<pre>&lt;div id=&quot;test&quot; style=&quot;color : red&quot;&gt;HelloWorld! today is: </pre>
<pre>Mon Sep 08 22:02:26 IST 2008&lt;/div&gt;</pre>
<p>So I am sure you are now convinced <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/opengarage.wordpress.com/105/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/opengarage.wordpress.com/105/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opengarage.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opengarage.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opengarage.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opengarage.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opengarage.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opengarage.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opengarage.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opengarage.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opengarage.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opengarage.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opengarage.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opengarage.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opengarage.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opengarage.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=105&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opengarage.wordpress.com/2008/09/08/using-the-attribute-in-custom-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1099920669c8e0cf2a1701d2fb0c1285?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dhrubo</media:title>
		</media:content>
	</item>
		<item>
		<title>Putting to test custom JSF component</title>
		<link>http://opengarage.wordpress.com/2008/09/07/putting-to-test-custom-jsf-component/</link>
		<comments>http://opengarage.wordpress.com/2008/09/07/putting-to-test-custom-jsf-component/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 19:39:00 +0000</pubDate>
		<dc:creator>Finbox</dc:creator>
				<category><![CDATA[JSF 1.2]]></category>
		<category><![CDATA[Custom Controls]]></category>
		<category><![CDATA[Jaca Server Faces]]></category>
		<category><![CDATA[JSF]]></category>

		<guid isPermaLink="false">http://opengarage.wordpress.com/2009/06/16/putting-to-test-custom-jsf-component/</guid>
		<description><![CDATA[Now that I have developed the custom JSF component, its time to put it into use and test it as well. 1&#62; Once again launch your Blazon ezJEE IDE if you have already closed it after reading the first post. 2&#62; Create a Dynamic web project &#8211; my project is simpleweb 3&#62; Add the following [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=101&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Now that I have developed the custom JSF component, its time to put it into use and test it as well. </p>
<p>1&gt; Once again launch your Blazon ezJEE IDE if you have already closed it after reading the first post.</p>
<p>2&gt; Create a Dynamic web project &#8211; my project is <strong>simpleweb</strong></p>
<p>3&gt; Add the following jar files to your WEB-INF/lib</p>
<ol>
<li>jsf-api.jar </li>
<li>jsp-impl.jar </li>
<li>jstl-1.1.0.jar </li>
<li>simplejsf.jar </li>
</ol>
<p>As mentioned in the earlier post I am using JSF 1.2. The simejsf.jar is the one that contains the custom JSF component which was exported at the end of my previous post.</p>
<p>4&gt; Modify your web.xml to add support for Faces servlet as shown in Listing 1 below:</p>
<p>Listing 1</p>
<pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;?</span>xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;<span style="color:#0000ff;">?&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">web</span>-<span style="color:#ff0000;">app</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">xsi</span>=<span style="color:#0000ff;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#ff0000;">xmlns</span>=<span style="color:#0000ff;">&quot;http://java.sun.com/xml/ns/javaee&quot;</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">web</span>=<span style="color:#0000ff;">&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#ff0000;">xsi</span>:<span style="color:#ff0000;">schemaLocation</span>=<span style="color:#0000ff;">&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#ff0000;">id</span>=<span style="color:#0000ff;">&quot;WebApp_ID&quot;</span> <span style="color:#ff0000;">version</span>=<span style="color:#0000ff;">&quot;2.5&quot;</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">display</span>-<span style="color:#ff0000;">name</span><span style="color:#0000ff;">&gt;</span>simpleweb<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">display</span>-name<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">servlet</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">servlet</span>-<span style="color:#ff0000;">name</span><span style="color:#0000ff;">&gt;</span>FacesServlet<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">servlet</span>-name<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">servlet</span>-<span style="color:#ff0000;">class</span><span style="color:#0000ff;">&gt;</span>javax.faces.webapp.FacesServlet<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">servlet</span>-class<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">servlet</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">servlet</span>-<span style="color:#ff0000;">mapping</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">servlet</span>-<span style="color:#ff0000;">name</span><span style="color:#0000ff;">&gt;</span>FacesServlet<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">servlet</span>-name<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">url</span>-<span style="color:#ff0000;">pattern</span><span style="color:#0000ff;">&gt;</span>*.jsf<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">url</span>-pattern<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">servlet</span>-mapping<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">welcome</span>-<span style="color:#ff0000;">file</span>-<span style="color:#ff0000;">list</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">welcome</span>-<span style="color:#ff0000;">file</span><span style="color:#0000ff;">&gt;</span>index.jsp<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">welcome</span>-file<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">welcome</span>-file-list<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">web</span>-app<span style="color:#0000ff;">&gt;</span></pre>
</pre>
<p>5&gt; Create the JSP file using the custom tag developed earlier</p>
<p>Listing 2-webtiersample.jsp</p>
<pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span>%@ page contentType=&quot;text/html;charset=UTF-8&quot; language=&quot;java&quot; %<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span>%@ taglib prefix=&quot;f&quot; uri=&quot;http://java.sun.com/jsf/core&quot; %<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span>%@ taglib prefix=&quot;h&quot; uri=&quot;http://java.sun.com/jsf/html&quot; %<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span>%@ taglib prefix=&quot;sf&quot; uri=&quot;http://opengarage.org/simplefaces&quot; %<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">f</span>:<span style="color:#800000;">view</span> <span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">html</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">head</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">title</span><span style="color:#0000ff;">&gt;</span>hello<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">title</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">head</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">body</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">h2</span><span style="color:#0000ff;">&gt;</span>Custom Helloworld component<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">h2</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">p</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">sf</span>:<span style="color:#800000;">helloworld</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">p</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">body</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">html</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">f</span>:<span style="color:#800000;">view</span><span style="color:#0000ff;">&gt;</span></pre>
</pre>
<p>6&gt; Create the welcome jsp file &#8211; index.jsp as shown in Listing 3.</p>
<p>Listing 3-index.jsp</p>
<pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">html</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">head</span><span style="color:#0000ff;">&gt;</span><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">head</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">body</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">jsp</span>:<span style="color:#800000;">forward</span> <span style="color:#ff0000;">page</span>=<span style="color:#0000ff;">&quot;webtiersample.jsf&quot;</span> <span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">body</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">html</span><span style="color:#0000ff;">&gt;</span></pre>
</pre>
<p>7&gt; Now create a new server configuration using the server view. I am using Tomcat 6.</p>
<p>8&gt; Launch your favorite browser (mine is Firefox 3), and type &#8211; <a href="http://localhost:8080/simpleweb">http://localhost:8080/simpleweb</a></p>
<p>to see the tag in action.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/opengarage.wordpress.com/101/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/opengarage.wordpress.com/101/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opengarage.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opengarage.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opengarage.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opengarage.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opengarage.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opengarage.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opengarage.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opengarage.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opengarage.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opengarage.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opengarage.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opengarage.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opengarage.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opengarage.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=101&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opengarage.wordpress.com/2008/09/07/putting-to-test-custom-jsf-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1099920669c8e0cf2a1701d2fb0c1285?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dhrubo</media:title>
		</media:content>
	</item>
		<item>
		<title>First Custom JSF 1.2 component</title>
		<link>http://opengarage.wordpress.com/2008/09/06/first-custom-jsf-1-2-component/</link>
		<comments>http://opengarage.wordpress.com/2008/09/06/first-custom-jsf-1-2-component/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 19:04:00 +0000</pubDate>
		<dc:creator>Finbox</dc:creator>
				<category><![CDATA[JSF 1.2]]></category>
		<category><![CDATA[Custom Controls]]></category>
		<category><![CDATA[Jaca Server Faces]]></category>
		<category><![CDATA[JSF]]></category>

		<guid isPermaLink="false">http://opengarage.wordpress.com/2008/09/06/first-custom-jsf-1-2-component/</guid>
		<description><![CDATA[1&#62; Launch Eclipse IDE and create a Java project.&#160; 2&#62; Create a Java Project 3&#62; Add Java Build Path dependencies el-api.jar el-ri.jar jsf-api.jar jsf-impl.jar jsp-api.jar The JSF API and IMPL jars are available for download at &#8211; https://javaserverfaces.dev.java.net/ Note for this tutorial I am using &#8211; mojarra-1.2_09-b02-FCS-binary release 4&#62; Create a folder META-INF to place [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=99&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>1&gt; Launch Eclipse IDE and create a Java project.&#160; <br />2&gt; Create a Java Project    <br />3&gt; Add Java Build Path dependencies</p>
<ul>
<li>el-api.jar </li>
<li>el-ri.jar </li>
<li>jsf-api.jar </li>
<li>jsf-impl.jar </li>
<li>jsp-api.jar</li>
</ul>
<p>The JSF API and IMPL jars are available for download at &#8211; https://javaserverfaces.dev.java.net/   <br />Note for this tutorial I am using &#8211; mojarra-1.2_09-b02-FCS-binary release</p>
<p>4&gt; Create a folder META-INF to place your configuration files &#8211; tld file and faces-config    </p>
<p>5&gt; Create the component class as shown in Listing 1 below.   </p>
<p>Listing 1 – HtmlHelloWorld.java</p>
<pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">package</span> org.opengarage.simplejsf.components.component;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">import</span> java.io.IOException;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">import</span> javax.faces.component.UIComponentBase;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">import</span> javax.faces.context.FacesContext;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">import</span> javax.faces.context.ResponseWriter;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> HtmlHelloWorld <span style="color:#0000ff;">extends</span> UIComponentBase {
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	@Override
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">public</span> String getFamily() {
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">return</span> <span style="color:#0000ff;">null</span>;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	}
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	@Override
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> encodeBegin(FacesContext context) <span style="color:#0000ff;">throws</span> IOException {
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		ResponseWriter writer = context.getResponseWriter();
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		writer.startElement(&quot;<span style="color:#8b0000;">div</span>&quot;, <span style="color:#0000ff;">this</span>);
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		writer.writeAttribute(&quot;<span style="color:#8b0000;">style</span>&quot;, &quot;<span style="color:#8b0000;">color : red</span>&quot;, <span style="color:#0000ff;">null</span>);
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		writer.writeText(&quot;<span style="color:#8b0000;">HelloWorld! today is: </span>&quot; + <span style="color:#0000ff;">new</span> java.util.Date(), <span style="color:#0000ff;">null</span>);
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		writer.endElement(&quot;<span style="color:#8b0000;">div</span>&quot;);
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	}
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">}</pre>
</pre>
<p>6&gt; Create the faces-config.xml file in the META-INF folder as shown in Listing 2</p>
<p>Listing 2</p>
<pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;?</span>xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;<span style="color:#0000ff;">?&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">faces</span>-<span style="color:#ff0000;">config</span> <span style="color:#ff0000;">version</span>=<span style="color:#0000ff;">&quot;1.2&quot;</span> <span style="color:#ff0000;">xmlns</span>=<span style="color:#0000ff;">&quot;http://java.sun.com/xml/ns/javaee&quot;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">xi</span>=<span style="color:#0000ff;">&quot;http://www.w3.org/2001/XInclude&quot;</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">xsi</span>=<span style="color:#0000ff;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#ff0000;">xsi</span>:<span style="color:#ff0000;">schemaLocation</span>=<span style="color:#0000ff;">&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd&quot;</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">component</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">component</span>-<span style="color:#ff0000;">type</span><span style="color:#0000ff;">&gt;</span>HtmlHelloWorld<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">component</span>-type<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">component</span>-<span style="color:#ff0000;">class</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">			org.opengarage.simplejsf.components.component.HtmlHelloWorld<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">component</span>-class<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">component</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">faces</span>-config<span style="color:#0000ff;">&gt;</span></pre>
<p></pre>
<p>7&gt; Create the tag lib class as shown in Listing 3</p>
<p>
  <br />Listing 3</p>
<pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">package</span> org.opengarage.simplejsf.components.taglib;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">import</span> javax.faces.webapp.UIComponentELTag;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> HtmlHelloWorldTag <span style="color:#0000ff;">extends</span> UIComponentELTag {
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	@Override
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">public</span> String getComponentType() {
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#008000;">// Associates tag with UI component registered in faces-config.xml</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">return</span> &quot;<span style="color:#8b0000;">HtmlHelloWorld</span>&quot;;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	}
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	@Overridepublic
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	String getRendererType() {
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#008000;">// TODO Auto-generated method stub</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">return</span> <span style="color:#0000ff;">null</span>;
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	}
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">}</pre>
</pre>
<p>8&gt; Create the tld (META-INF/helloworld.tld) as shown in Listing 4</p>
<p>Listing 4</p>
<pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;?</span>xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;<span style="color:#0000ff;">?&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">taglib</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#ff0000;">xsi</span>:<span style="color:#ff0000;">schemaLocation</span>=<span style="color:#0000ff;">&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd&quot;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#ff0000;">xmlns</span>=<span style="color:#0000ff;">&quot;http://java.sun.com/xml/ns/javaee&quot;</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">xsi</span>=<span style="color:#0000ff;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#ff0000;">version</span>=<span style="color:#0000ff;">&quot;2.1&quot;</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">description</span><span style="color:#0000ff;">&gt;</span>This is the JSP tag library for the custom components chapter.<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">description</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">display</span>-<span style="color:#ff0000;">name</span><span style="color:#0000ff;">&gt;</span>simplefaces<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">display</span>-name<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">tlib</span>-<span style="color:#ff0000;">version</span><span style="color:#0000ff;">&gt;</span>1.0<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">tlib</span>-version<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">short</span>-<span style="color:#ff0000;">name</span><span style="color:#0000ff;">&gt;</span>sf<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">short</span>-name<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">uri</span><span style="color:#0000ff;">&gt;</span>http://opengarage.org/simplefaces<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">uri</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">tag</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">description</span><span style="color:#0000ff;">&gt;</span>Helloworld<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">description</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">name</span><span style="color:#0000ff;">&gt;</span>helloworld<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">name</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">tag</span>-<span style="color:#ff0000;">class</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">			org.opengarage.simplejsf.components.taglib.HtmlHelloWorldTag<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">tag</span>-class<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">body</span>-<span style="color:#ff0000;">content</span><span style="color:#0000ff;">&gt;</span>empty<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">body</span>-content<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">attribute</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">			<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">description</span><span style="color:#0000ff;">&gt;</span>Is this component rendered?<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">description</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">			<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">name</span><span style="color:#0000ff;">&gt;</span>rendered<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">name</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">			<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">deferred</span>-<span style="color:#ff0000;">value</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">				<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">type</span><span style="color:#0000ff;">&gt;</span>boolean<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">type</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">			<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">deferred</span>-value<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">		<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">attribute</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;">	<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">tag</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:10px;width:100%;font-family:consolas,&#39;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">taglib</span><span style="color:#0000ff;">&gt;</span></pre>
</pre>
<p>Now that all the relevant classes and configuration files are ready, you will need to build this project and export it as a jar file. So my first JSF custom component distribution is ready. In the next post I will put this newly developed component to use.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/opengarage.wordpress.com/99/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/opengarage.wordpress.com/99/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/opengarage.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/opengarage.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/opengarage.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/opengarage.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/opengarage.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/opengarage.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/opengarage.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/opengarage.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/opengarage.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/opengarage.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/opengarage.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/opengarage.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/opengarage.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/opengarage.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=opengarage.wordpress.com&amp;blog=7491676&amp;post=99&amp;subd=opengarage&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://opengarage.wordpress.com/2008/09/06/first-custom-jsf-1-2-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1099920669c8e0cf2a1701d2fb0c1285?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dhrubo</media:title>
		</media:content>
	</item>
	</channel>
</rss>
