<?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/"
	>

<channel>
	<title>Blyts - Blog</title>
	<atom:link href="http://blyts.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blyts.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 17 Dec 2009 18:57:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ext JS</title>
		<link>http://blyts.com/blog/?p=11</link>
		<comments>http://blyts.com/blog/?p=11#comments</comments>
		<pubDate>Fri, 01 Aug 2008 17:10:32 +0000</pubDate>
		<dc:creator>Mariano Colombo</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.synaptic-it.com/blog/?p=11</guid>
		<description><![CDATA[Ext JS is a cross-browser JavaScript library for building rich internet applications. It is really easy to configure and use, having a lot of independent components such as Tables, DatePickers, Forms, Trees, Tabs and many others.We can also configure any theme we like and have complete control of the design of our web site. Ext [...]]]></description>
			<content:encoded><![CDATA[<p>Ext JS is a cross-browser JavaScript library for building rich internet applications. It is really easy to configure and use, having a lot of independent components such as Tables, DatePickers, Forms, Trees, Tabs and many others.We can also configure any theme we like and have complete control of the design of our web site. Ext JS, together with OpenLazlo and Flex frameworks, is the real evolution to Rich Internet Applications.<br />
<span id="more-11"></span><br />
<strong>What advantages does Ext JS offer?</strong></p>
<ul>
<li> High performance, customizable UI widgets</li>
<li> Well designed and extensible Component model</li>
<li> An intuitive, easy to use API</li>
<li> Commercial and Open Source licenses available</li>
<li> Browser Compatibility</li>
</ul>
<p><strong>Synaptic IT </strong> has successfully made use of this framework for building it´s latest product, <strong>sagent</strong>. Ext JS has been really easy to adjust to the application and has freed as of having to design all the look and feel of the web page (such as CSS, styles, etc.), paging and ordering among other things.We invite you to see a <a href="http://www.synaptic-it.com/portfolio/sAgent.html">demo video</a> of the site to see Ext JS in full operation or a deeper explanation <a href="http://www.synaptic-it.com/products.html">here</a> .For further information about Ext JS, visit its official <a href="http://www.extjs.com">Web Site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blyts.com/blog/?feed=rss2&amp;p=11</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Generics</title>
		<link>http://blyts.com/blog/?p=10</link>
		<comments>http://blyts.com/blog/?p=10#comments</comments>
		<pubDate>Wed, 12 Mar 2008 16:25:21 +0000</pubDate>
		<dc:creator>Leandro De Brasi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[generics]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.synaptic-it.com/blog/?p=10</guid>
		<description><![CDATA[Generics are a facility of generic programming that was added to the Java programming language in 2004 as part of Java 5.
The feature of Generics in Java allows applications to create classes and objects that can operate on any defined types. Programmers can now make use of the generics feature for a much better code. [...]]]></description>
			<content:encoded><![CDATA[<p>Generics are a facility of generic programming that was added to the Java programming language in 2004 as part of Java 5.</p>
<p>The feature of Generics in Java allows applications to create classes and objects that can operate on any defined types. Programmers can now make use of the generics feature for a much better code. There is no need for un-necessary casting when dealing with Objects in a Collection.</p>
<p>Generics make a Java program well formed &#8211; enabling the compiler to perform enough type checks based on the static type information provided and to avoid unexpected type errors that could occur at runtime.<br />
<span id="more-10"></span><br />
Then we will see in a simple example, as generics enriches our code.</p>
<p>Java before generics:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">List</span> dictionary <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
dictionary.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;A&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
dictionary.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;B&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> s <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span>dictionary.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span>dictionary.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Java with generics:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> dictionary <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
dictionary.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;A&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
dictionary.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;B&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> s <span style="color: #339933;">=</span> dictionary.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> dictionary.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Without generics, the type parameters are omitted, but you must explicitly cast whenever an element is extracted from list.</p>
<p><strong>Generic Class</strong></p>
<p>In a generic class, type parameters(T and U) appear in the header that declares the class, but not in the constructor:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Pair<span style="color: #339933;">&lt;</span>t, U<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> T first<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> U second<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> Pair<span style="color: #009900;">&#40;</span>T first, U second<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">first</span> <span style="color: #339933;">=</span> first<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">second</span> <span style="color: #339933;">=</span> second<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> T getFirst<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> first<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> U getSecond<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> second<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>However, actual type parameters are passed to the constructor whenever it is invoked:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">Pair<span style="color: #339933;">&lt;</span>string, Integer<span style="color: #339933;">&gt;</span> pair <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Pair<span style="color: #339933;">&lt;</span>string, Integer<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;one&quot;</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> s <span style="color: #339933;">=</span> pair.<span style="color: #006633;">getFirst</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">Integer</span> i <span style="color: #339933;">=</span> pair.<span style="color: #006633;">getSecond</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>Generic Methods</strong></p>
<p>Here is a method that accepts an array of any type and converts it to a list:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ListUtil <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>t<span style="color: #339933;">&gt;</span> List<span style="color: #339933;">&lt;</span>t<span style="color: #339933;">&gt;</span> toList<span style="color: #009900;">&#40;</span>T<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> arr<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		List<span style="color: #339933;">&lt;</span>t<span style="color: #339933;">&gt;</span> list <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>t<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>T element <span style="color: #339933;">:</span> arr<span style="color: #009900;">&#41;</span> list.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> list<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The static method toList convert an array of type T[] on list of type List&lt;T&gt;. The method may be invoking as fallows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">List<span style="color: #339933;">&lt;</span>integer<span style="color: #339933;">&gt;</span> ints <span style="color: #339933;">=</span> ListUtil.<span style="color: #006633;">toList</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Integer</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
List<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span> dictionary <span style="color: #339933;">=</span> ListUtil.<span style="color: #006633;">toList</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;A&quot;</span>, <span style="color: #0000ff;">&quot;B&quot;</span>, <span style="color: #0000ff;">&quot;C&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>Wildcards</strong></p>
<p>Sometimes we would like lists to behave more like arrays, in that we want to accept not only a list with elements of a given type, but also a list with elements of any subtype of a given type. For this purpose, we use wildcards.</p>
<p>To specify the upper bound of a generic element, the extends keyword is used, which indicates that the generic type is a subtype of the bounding class. Thus it must either extend the class, or implement the interface of the bounding class. So List&lt;? extends Number&gt; means that the given list contains objects of some unknown type which extends the Number class. For example, the list could be List&lt;Float&gt;, List&lt;Integer&gt; or List&lt;Number&gt;.</p>
<p>To specify the lower bound of a generic element, the super keyword is used, which indicates that the generic type is a supertype of the bounding class. So List&lt;? super Number&gt; could be List&lt;Number&gt; or List&lt;Object&gt;. Reading from the list returns objects of type Object. Any element of type Number can be added to the list, since it is guaranteed to be a valid type to store in the list.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> Collection<span style="color: #339933;">&lt;</span>e<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>
	...
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> addAll<span style="color: #009900;">&#40;</span>Collection<span style="color: #339933;">&lt;?</span> <span style="color: #000000; font-weight: bold;">extends</span> E<span style="color: #339933;">&gt;</span> c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	...
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In the example, we create an empty list of numbers, and add to it first a list of integers and then a list of doubles:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">List<span style="color: #339933;">&lt;</span>number<span style="color: #339933;">&gt;</span> nums <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>number<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
List<span style="color: #339933;">&lt;</span>integer<span style="color: #339933;">&gt;</span> ints <span style="color: #339933;">=</span> <span style="color: #003399;">Arrays</span>.<span style="color: #006633;">asList</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
List<span style="color: #339933;">&lt;</span>double<span style="color: #339933;">&gt;</span> dbls <span style="color: #339933;">=</span> <span style="color: #003399;">Arrays</span>.<span style="color: #006633;">asList</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4.64</span>, <span style="color: #cc66cc;">8.11</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
nums.<span style="color: #006633;">addAll</span><span style="color: #009900;">&#40;</span>ints<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
nums.<span style="color: #006633;">addAll</span><span style="color: #009900;">&#40;</span>dbls<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>Multiple Bounds</strong></p>
<p>In rare situations, it may be desirable to have multiple bounds, and we show how to do so here.<br />
In the next example, we use three interfaces: Human, Martian and Speaker.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">...
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>s <span style="color: #000000; font-weight: bold;">extends</span> Human <span style="color: #339933;">&amp;</span> Speaker,
			T <span style="color: #000000; font-weight: bold;">extends</span> Martian <span style="color: #339933;">&amp;</span> Speaker<span style="color: #339933;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">void</span> transform<span style="color: #009900;">&#40;</span>S hs, T ms<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
...</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blyts.com/blog/?feed=rss2&amp;p=10</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SiteMesh, muy simple pero muy poderoso</title>
		<link>http://blyts.com/blog/?p=9</link>
		<comments>http://blyts.com/blog/?p=9#comments</comments>
		<pubDate>Thu, 06 Mar 2008 11:57:24 +0000</pubDate>
		<dc:creator>Mariano Colombo</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.synaptic-it.com/blog/?p=9</guid>
		<description><![CDATA[
SiteMesh es un framework de decoración y layout para páginas web, que apunta a la creación de grandes sitios que contienen una gran cantidad de páginas, lo cuales requieren un consistente &#8220;look and feel&#8221;, navegación y layout.

Descripción
Sin dudas, una de las cosas más llamativas de SiteMesh es la simpleza que tiene para configurarlo y para [...]]]></description>
			<content:encoded><![CDATA[<p><lang_es></p>
<p>SiteMesh es un framework de decoración y layout para páginas web, que apunta a la creación de grandes sitios que contienen una gran cantidad de páginas, lo cuales requieren un consistente &#8220;look and feel&#8221;, navegación y layout.
</p>
<p><strong>Descripción</strong></p>
<p>Sin dudas, una de las cosas más llamativas de SiteMesh es la simpleza que tiene para configurarlo y para usarlo. Uno podría pensar en Tiles para struts, o Faceletes para JSF (<a href="http://www.synaptic-it.com/blog/?p=8">Ver Post</a> sobre este tema); pero SiteMesh se independiza de cualquier Framework, lo que lo hace muy poderoso y, sin duda, algo para tener en cuenta a la hora de decorar nuestro sitio.
</p>
<p><strong>¿Cómo trabaja?</strong></p>
<p>Es en este aspecto en donde se puede ver lo mejor de este framework. Simplemente se crea una página Layout donde se define en qué lugar se insertará el cointenido y listo. Con definir un tag &#8220;body&#8221; en cualquier página e incluir ahi los datos, SiteMesh hará el resto y tendremos nuestro sitio consistente.
</p>
<p>
<strong>Configuración y ejemplo</strong>
</p>
<p>Configurar y ejecutar SiteMesh será la tarea más simple que tendremos que hacer en todo el desarrollo.
<p/>
<p>1 &#8211; <strong>Descarguen e instalen todos los archivos necesarios a su classpath</strong>.  Deberán descargar el archivo sitemesh.jar. Dirigirse a la <a href="http://www.opensymphony.com/sitemesh/download.html">página oficial de SiteMesh</a> para bajarlo.
</p>
<p>2 -<strong> Configurar el archivo decorators.xml. </strong> Abrir el directorio WebRoot/WEB-INF/ de nuestro proyecto. Ahí crear un archivo XML, decorators.xml, e insertar el siguiente contenido:
</p>
<p></lang_es></p>
<p><lang_en></p>
<p>SiteMesh is a layout and decoration Framework for web pages, thought for the creation of large sites which manage a lot of pages, and need a goof &#8220;look and feel&#8221;, navegation and layout.
</p>
<p><strong>Description</strong></p>
<p>Without questions, one of the best features of SiteMesh is how easy is to configure it and use it. You could think of Tiles for struts, or Faceletes for JSF (<a href="http://www.synaptic-it.com/blog/?p=8">See Post</a> about this subject); but SiteMesh is independent of any Framework, which makes it quite powerfull, something to pay attention to when decorating our site.
</p>
<p><strong>How does it work?</strong></p>
<p>This is where you will see the best of this framework. Just create a Layout page where you define where to insert the content and you are done. By defining a &#8220;body&#8221; tag on any page and including the content there, SiteMesh will do the rest and we will have a consistent web site.
</p>
<p>
<strong>Configuration and example</strong>
</p>
<p>Configuring and executing SiteMesh will be the easiest task that we will have to do during the complete development process.
<p/>
<p>1 &#8211; <strong>Download and install all the necessary files into your classpath</strong>.  You will have to download sitemesh.jar. Go to the <a href="http://www.opensymphony.com/sitemesh/download.html">SiteMesh official web site</a> to do this.
</p>
<p>2 -<strong>Configure a decorators.xml file. </strong> Open the WebRoot/WEB-INF/ directory of our proyect. Create there a XML file, decorators.xml, and insert the following content:
</p>
<p></lang_en></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;decorators</span> <span style="color: #000066;">defaultdir</span>=<span style="color: #ff0000;">&quot;/decorators&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
     <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/login.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;decorator</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;layout&quot;</span> <span style="color: #000066;">page</span>=<span style="color: #ff0000;">&quot;layout.jsp&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  	  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/decorator<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/decorators<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><lang_en><br />
Just as simple as that. In the WebRoot/decorators directory, we will have all the decorators we define, in this case we have created only one, layout.jsp.<br />
We define it with the &#8220;decorator&#8221; tag  and by specifying the &#8220;/*&#8221; &#8220;pattern&#8221;, we tell SiteMesh to apply it to all the pages of the application.<br />
But we may not want to decorate all the pages (for example the login it is accustomed to have a complete different design from the rest of the pages), therefore, that page that we do not want to decorate we add it to the &#8220;excludes&#8221; and we are done.</p>
<p>3 &#8211; <strong>Define a decorator.</strong> Create a layout.jsp file in the WebRoot/decorators directory.</p>
<p></lang_en></p>
<p><lang_es><br />
Tan simple como eso. En el directorio WebRoot/decorators tendremos todos nuestros decorators, en este caso tenemos uno solo, layout.jsp.<br />
Lo definimos con el tag &#8220;decorator&#8221; y al definir el &#8220;pattern&#8221; &#8220;/*&#8221; le decimos a SiteMesh que se lo aplique a todas las páginas de la aplicación.<br />
Pero puede ser que no querramos decorar todas las páginas (por ejemplo el login suele tener un diseño completamente diferente al resto de las páginas), por lo tanto esa página que no queremos decorar la agregamos a la lista de &#8220;excludes&#8221; y listo.</p>
<p>3 &#8211; <strong>Definir un decorator.</strong> Crear un archivo layout.jsp en la el directorio WebRoot/decorators.</p>
<p></lang_es></p>
<p>layout.jsp</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;%@ taglib uri=&quot;http://www.opensymphony.com/sitemesh/decorator&quot; prefix=&quot;decorator&quot; %&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
	&lt;head&gt;
&nbsp;
	&lt;title&gt;&lt;decorator:title default=&quot;SiteMesh&quot; /&gt;&lt;/title&gt;
	&lt;decorator:head /&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;&lt;%=request.getContextPath() %&gt;/styles/styles.css&quot;/&gt;
	&lt;script language=&quot;javascript&quot; src=&quot;&lt;%=request.getContextPath() %&gt;/js/menu.js&quot;&gt;&lt;/script&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;div id=&quot;mainLayout&quot;&gt;
			&lt;%@ include file=&quot;header.jsp&quot;%&gt;
			&lt;decorator:body/&gt;
			&lt;%@ include file=&quot;footer.jsp&quot;%&gt;
		&lt;/div&gt;
	&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p><lang_es><br />
En el decorator tendremos que agregar la url para poder usar los tags de SiteMesh. Después es simplemente definir nuestros estilos y el html para después definir el tag &#8220;decorator:body&#8221;. Este tag insetará en ese lugar el contenido del tag &#8220;body&#8221; de todos nuestros jsp´s.</p>
<p>4 &#8211; <strong>Crear una página.</strong> Crear un archivo de prueba para aplicar SiteMesh, por ejemplo test.jsp.</p>
<p></lang_es></p>
<p><lang_en><br />
In the decorator we will have to add the url in order to use SiteMesh´s tags. After that, we just have to define our styles and the htlm code so we can define the &#8220;decorator:body&#8221; tag. This tag will insert in that place the content of the &#8220;body&#8221; tag of all our jsp´s.</p>
<p>4 &#8211; <strong>Create a page.</strong> Create a file to test SiteMesh, for example test.jsp.</p>
<p></lang_en></p>
<p>test.jsp</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&nbsp;
&lt;body&gt;
	SITEMESH APP
&lt;/body&gt;</pre></td></tr></table></div>

<p><lang_es><br />
Nuestro decorator insertará el contenido del tag &#8220;body&#8221; dentro del &#8220;decorator:body&#8221; layout.jsp y listo!</p>
<p>
Para más información dirigirse al <a href="http://www.opensymphony.com/sitemesh/">sitio oficial</a> de SiteMesh.
</p>
<p></lang_es><br />
<lang_en><br />
Our decorator will insert the content of the &#8220;body&#8221; tag into the &#8220;decorator:body&#8221; tag on the layout.jsp and that´s all!</p>
<p>
For further information go to SiteMesh´s <a href="http://www.opensymphony.com/sitemesh/">official site</a>.
</p>
<p></lang_en></p>
]]></content:encoded>
			<wfw:commentRss>http://blyts.com/blog/?feed=rss2&amp;p=9</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facelets</title>
		<link>http://blyts.com/blog/?p=8</link>
		<comments>http://blyts.com/blog/?p=8#comments</comments>
		<pubDate>Sun, 20 Jan 2008 15:08:00 +0000</pubDate>
		<dc:creator>Mariano Colombo</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.synaptic-it.com/blog/?p=8</guid>
		<description><![CDATA[
Facelets is a design/layout framework really easy to use and configure. Unfortunately, the lack of good tutorials over the internet, gabe me the idea to write this post to explain how to configure it and use it.
If you are building a JSF application, then Facelets is the perfect match for your layout configuration (although Facelets [...]]]></description>
			<content:encoded><![CDATA[<p><lang_en><br />
Facelets is a design/layout framework really easy to use and configure. Unfortunately, the lack of good tutorials over the internet, gabe me the idea to write this post to explain how to configure it and use it.</p>
<p>If you are building a JSF application, then Facelets is the perfect match for your layout configuration (although Facelets is independent of the languge and can be used almost   anywhere). Facelets is to JSF what Tiles is to Struts.</p>
<p><strong>Facelets properties</strong></p>
<ul>
<li>Easy components composition.</li>
<li>Logic labels creation.</li>
<li>Expression functions.</li>
<li>Friendly development for the graphic designero.</li>
<li>Component libraries creation.</li>
</ul>
<p>Basically you will have to add some configuration to your web.xml file,  modify you .jsp extentions to .xhtml (or .xjsp), create the layout and learn how to use it.</p>
<p>1 &#8211; <strong>Download and install all the necesary files into your claspath</strong>.  You wil have to download the jsf-facelets.jar. Refer to <a href="https://facelets.dev.java.net/">Faces Developer Center</a> to download it.</p>
<p>2 -<strong> Configure the web.xml. </strong> The first parameter tells Facelets which suffix will your pages have, and the second will let you see a console debug. Add these lines to your web.xml:<br />
</lang_en><br />
<lang_es></p>
<p>Facelets es un framework de diseño de páginas muy facil de usar y configurar. La falta de buenos tutoriales en internet, me dio la idea para escribir este post y explicar cómo configurarlo y usarlo.</p>
<p>Si estás contruyendo una aplicación con JSF, entonces Facelets es el agregado ideal para la configuración del &#8220;layout&#8221; (aunque Facelets es independiente del lenuguaje y puede ser usado en cualquier tipo de aplicación). Facelets es para JSF lo que Tiles es para Struts.</p>
<p><strong>Propiedades de Facelets</strong></p>
<ul>
<li>Trabajo basado en plantillas.</li>
<li>Fácil composición de componentes.</li>
<li>Creación de etiquetas lógicas a la medida.</li>
<li>Funciones para expresiones.</li>
<li>Desarrollo amigable para el diseñador gráfico.</li>
<li>Creación de librerías de componentes.</li>
</ul>
<p>Básicamente, se deberá agregar configuración al archivo web.xml,  modificar sus extensiones .jsp a .xhtml (or .xjsp), crear el &#8220;layout&#8221; y aprender cómo usarlo.</p>
<p>1 &#8211; <strong>Descarguen e installen todos los archivos necesarios a su classpath</strong>.  Deberán descargar el archivo jsf-facelets.jar. Dirigirse a <a href="https://facelets.dev.java.net/">Centro de desarrollo de JSF</a> para bajarlo.</p>
<p>2 -<strong> Configurar el archivo web.xml. </strong> El primer paámetro le dice a Facelets qué sufijo tendrán las páginas, y el segundo va a permitir ver el debug en la consola. Agregar estas líneas al web.xml:</p>
<p></lang_es></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javax.faces.DEFAULT_SUFFIX<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>.xhtml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>facelets.DEVELOPMENT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><lang_en><br />
3 &#8211; <strong>Define a layout.</strong> Create a layout.xhtml and the included pages of the layout (footer.xhtml, header.xhtml and navigation.xhtml, for example).<br />
</lang_en></p>
<p><lang_es><br />
3 &#8211; <strong>Definir un &#8220;layout&#8221;.</strong> Crear un archivo layout.xhtml y las páginas que serán incluidas (por ejemplo footer.xhtml, header.xhtml and navigation.xhtml).</p>
<p></lang_es></p>
<p>layout.xhtml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:ui</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/facelets&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:include</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;header.xhtml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:include</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;navigation.xhtml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:insert</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;body&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                     Default Content
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui:insert<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:include</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;footer.xhtml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><lang_en><br />
Then difine the pages that are in the layout: footer.xhtml, header.xhtml and navigation.xhtml. I will put one of these as an example.<br />
</lang_en></p>
<p><lang_es><br />
Después definir las páginas que están en el layout: footer.xhtml, header.xhtml and navigation.xhtml. Voy a poner una de las mismas como ejemplo.</p>
<p></lang_es></p>
<p>header.xhtml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:ui</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/facelets&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:h</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/html&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:f</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/core&quot;</span> <span style="color: #000066;">xml:lang</span>=<span style="color: #ff0000;">&quot;en&quot;</span> <span style="color: #000066;">lang</span>=<span style="color: #ff0000;">&quot;en&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
			HEADER
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><lang_en><br />
4 &#8211; <strong>Rename files</strong>. Rename any file you haven’t in your Navigation Rules in the faces-congif.xml file to “.xhtml”.</p>
<p>5 &#8211; <strong>Use your configuration.</strong> Now all the configurarion is done, you have to try it. The only difference now with your old JSF files is that you don`t longer use the <strong>f:view</strong> to begin your JSF code. You will have to use <strong>ui:composition</strong> to tell Facelets wich layout this page will apply to and <strong>ui:define name=”body”</strong> to insert in your template the code inside the tag.<br />
</lang_en></p>
<p><lang_es><br />
4 &#8211; <strong>Renombrar archivos</strong>. Renombrar todos los archivos en las Navigation Rules en el archivo faces-congif.xml a “.xhtml”.</p>
<p>5 &#8211; <strong>Usar la confiuguración.</strong> Ahora que la configuración está terminada, hay que probarla. La única diferencia con los archivos viejos de JSF es que ahora no hay que usar mas el tag <strong>f:view</strong> al empezar a escribir código JSF. Ahora hay que aplicar <strong>ui:composition</strong> para decirle a Facelets a qué layout se aplicará la página y <strong>ui:define name=”body”</strong> para instertar en el template el código dentro del tag.<br />
</lang_es></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:ui</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/facelets&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:h</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/html&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:f</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/jsf/core&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:composition</span> <span style="color: #000066;">template</span>=<span style="color: #ff0000;">&quot;layout.xhtml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:define</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;body&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:panelGrid</span> <span style="color: #000066;">columns</span>=<span style="color: #ff0000;">&quot;2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:outputLabel</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;User Name:&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:outputLabel</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{UserBean.userName}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/h:outputLabel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:panelGrid<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Back to list&quot;</span></span>
<span style="color: #009900;">							<span style="color: #000066;">rendered</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">&quot;#{UserBean.listUsers}&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h:form<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui:define<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui:composition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><lang_en><br />
By defining <strong>ui:define name=&#8221;body&#8221;</strong>, we tell Facelets to insert in the tag named &#8220;body&#8221; of the layout page all the code of the tag. Notice that the <strong>f:view </strong>is gone and replaced by the <strong>ui:composition</strong> tag.<br />
</lang_en></p>
<p><lang_es><br />
Definiendo <strong>ui:define name=&#8221;body&#8221;</strong>, le decimos a Facelets que inserte en el tag llamado &#8220;body&#8221; de la página del layout, todo el código del tag. Observar que <strong>f:view </strong>ya no está mas y fue reemplazado por el tag <strong>ui:composition</strong>.<br />
</lang_es></p>
]]></content:encoded>
			<wfw:commentRss>http://blyts.com/blog/?feed=rss2&amp;p=8</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Java Annotations</title>
		<link>http://blyts.com/blog/?p=7</link>
		<comments>http://blyts.com/blog/?p=7#comments</comments>
		<pubDate>Thu, 10 Jan 2008 14:45:57 +0000</pubDate>
		<dc:creator>Mariano Colombo</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.synaptic-it.com/blog/?p=7</guid>
		<description><![CDATA[Una de las tantas facilidades que trae la nueva JDK (versión 5) son las llamadas Annotations. Son como meta-tags que se agregan al código y se aplican a declaraciones de paquetes, tipos, contructores, métodos, atributos, parámetros y variables. Como resultado, tendremos una fácil manera de indicar si los métodos dependen de otros, si son incompletos, [...]]]></description>
			<content:encoded><![CDATA[<p><lang_es>Una de las tantas facilidades que trae la nueva JDK (versión 5) son las llamadas Annotations. Son como meta-tags que se agregan al código y se aplican a declaraciones de paquetes, tipos, contructores, métodos, atributos, parámetros y variables. Como resultado, tendremos una fácil manera de indicar si los métodos dependen de otros, si son incompletos, si las clases hacen referencia a otras, etc.</p>
<p>Desarrollar en base a annotations nos permite evitar código sucio, ya que el mismo se puede generar automáticamente  mediante las annotations en el código fuente. Esto conlleva a programación declarativa, donde el programador dice qué deberia hacerse y las herramientas simplemente emiten el código para hacerlo.</p>
<p><strong>Java Persistant Api</strong></p>
<p>Una de las API que trae la nueva JDK, es la api de JPA, para persistencia con bases de datos basada en annotations. La misma es muy fácil de usar y voy a citar algunos claros ejemplos de los tipos de mapeos que existen, ya que particularmente no suelo encontrar buenos ejemplos en internet.<br />
El modelo aquí expuesto es muy simple: Artículo y Lista de Precios son muchos a muchos, conectados por una tabla que une a las otras 2. Por otro lado, artículo tiene asociado un grupo y un transporte.<br />
</lang_es><br />
<lang_en><br />
One of the many features that brings us the new JDK (version 5) are Annotations. Annotations are like meta-tags that you can add to your code and apply them to package declarations, type declarations, constructors, methods, fields, parameters, and variables. As a result, you will have helpful ways to indicate whether your methods are dependent on other methods, whether they are incomplete, whether your classes have references to other classes, and so on.</p>
<p>Annotation-based development lets us avoid writing boilerplate code under many circumstances by enabling tools to generate it from annotations in the source code. This leads to a declarative programming style where the programmer says what should be done and tools emit the code to do it.</p>
<p><strong>Java Persistant Api</strong></p>
<p>JPA is one of the best innovations of this new release. Designed for database persistence, it is based on annotations, and can be implemented with other known frameworks (such as Toplink and Hibernate). It is really easy to use and I am going to expose some examples of the different mappings, because I usually cannot find good examples over the internet.<br />
The model is quite simple: Article and PriceList are many to many, connected by a middle table. On the other hand, article has a group and a transport associated.<br />
</lang_en></p>
<p><strong>Many To Many</strong></p>
<p><lang_es>Artículo</lang_es><br />
<lang_en>Article</lang_en></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">&nbsp;
@ManyToMany<span style="color: #009900;">&#40;</span>fetch <span style="color: #339933;">=</span> FetchType.<span style="color: #006633;">LAZY</span>, cascade <span style="color: #339933;">=</span> CascadeType.<span style="color: #006633;">ALL</span><span style="color: #009900;">&#41;</span>
@JoinTable<span style="color: #009900;">&#40;</span> name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;article_list&quot;</span>,
 	    joinColumns <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> @JoinColumn<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;article_id&quot;</span>, unique <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span>,
 	    inverseJoinColumns <span style="color: #339933;">=</span> @JoinColumn<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;list_id&quot;</span> <span style="color: #009900;">&#41;</span>
 	    <span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">private</span> Set<span style="color: #339933;">&lt;</span>priceList<span style="color: #339933;">&gt;</span> priceLists<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><lang_es>ListaPrecios</lang_es><br />
<lang_en>PriceList</lang_en></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">@ManyToMany<span style="color: #009900;">&#40;</span> mappedBy<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;priceLists&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">private</span> Set<span style="color: #339933;">&lt;</span>article<span style="color: #339933;">&gt;</span> articles<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>ManyToOne</strong></p>
<p><lang_es>Articulo</lang_es><br />
<lang_en>Article</lang_en></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>10
11
12
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">@ManyToOne<span style="color: #009900;">&#40;</span>fetch <span style="color: #339933;">=</span> FetchType.<span style="color: #006633;">LAZY</span>,cascade <span style="color: #339933;">=</span> CascadeType.<span style="color: #006633;">ALL</span><span style="color: #009900;">&#41;</span>
@JoinColumn<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;gruou_id&quot;</span>, nullable <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">private</span> Grouo group<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><lang_es>Grupo</lang_es><br />
<lang_en>Group</lang_en></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>10
11
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">@OneToMany<span style="color: #009900;">&#40;</span>fetch <span style="color: #339933;">=</span> FetchType.<span style="color: #006633;">LAZY</span>, mappedBy <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;group&quot;</span>, cascade<span style="color: #339933;">=</span>CascadeType.<span style="color: #006633;">ALL</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">private</span> Set<span style="color: #339933;">&lt;</span>article<span style="color: #339933;">&gt;</span> articles<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>OneToOne</strong></p>
<p><lang_es>Articulo</lang_es><br />
<lang_en>Article</lang_en></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>15
16
17
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">@OneToOne<span style="color: #009900;">&#40;</span>fetch <span style="color: #339933;">=</span> FetchType.<span style="color: #006633;">LAZY</span>,cascade <span style="color: #339933;">=</span> CascadeType.<span style="color: #006633;">ALL</span><span style="color: #009900;">&#41;</span>
@JoinColumn<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;transport_id&quot;</span>, nullable <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">private</span> Transport transport<span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blyts.com/blog/?feed=rss2&amp;p=7</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello Android</title>
		<link>http://blyts.com/blog/?p=6</link>
		<comments>http://blyts.com/blog/?p=6#comments</comments>
		<pubDate>Tue, 08 Jan 2008 19:47:52 +0000</pubDate>
		<dc:creator>Mariano Colombo</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.synaptic-it.com/blog/?p=6</guid>
		<description><![CDATA[Android, is the new free platform for mobile phones created by Google and the Open Hand Set Alliance (NVIDIA, Intel, Texas Instruments, Synaptics, Marvell,  Motorola, Samsung, TMO, Sprint, LG, HTC, Telefónica, KDDI y DOCOMO from Japan and China Mobile Comm).

What advantages does Android offer?

Android&#8217;s core is built basing on Linux&#8217;s kernel with a complete [...]]]></description>
			<content:encoded><![CDATA[<p>Android, is the new free platform for mobile phones created by Google and the <a href="http://www.openhandsetalliance.com/">Open Hand Set Alliance</a> (NVIDIA, Intel, Texas Instruments, Synaptics, Marvell,  Motorola, Samsung, TMO, Sprint, LG, HTC, Telefónica, KDDI y DOCOMO from Japan and China Mobile Comm).<br />
<span id="more-6"></span><br />
<strong>What advantages does Android offer?<br />
</strong></p>
<p>Android&#8217;s core is built basing on Linux&#8217;s kernel with a complete new code, to take full advantage of the mobel device. Furthermore, is GPL.</p>
<p>Android will work without making distinction between propetary and third applications, meaning that all of them will be created the same, without having to be induced to an established design. If wished, the home screen could be removed, the disc changed or you will be able to select some aplications as favourites to see the pictures. Nothing of which it has been seen until now in which refers to mobile applications.</p>
<p><strong>Android challenge </strong></p>
<p>Actually, Google started a challenge where the best Android&#8217;s applications will be awarded. It will provide 10 millones dollars in awards, being the first one of 25 thousand dollars. There is time to register until March 3. For further information, go to the <a href="http://code.google.com/android/adc.html">official page</a> of the challenge.</p>
]]></content:encoded>
			<wfw:commentRss>http://blyts.com/blog/?feed=rss2&amp;p=6</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSON in J2ME</title>
		<link>http://blyts.com/blog/?p=4</link>
		<comments>http://blyts.com/blog/?p=4#comments</comments>
		<pubDate>Mon, 07 Jan 2008 03:56:56 +0000</pubDate>
		<dc:creator>Leandro De Brasi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[j2me]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.synaptic-it.com/blog/?p=4</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://blyts.com/blog/?feed=rss2&amp;p=4</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
