<?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>Edem Morny's Tech Blog &#187; Richfaces</title>
	<atom:link href="http://edemmorny.wordpress.com/tag/richfaces/feed/" rel="self" type="application/rss+xml" />
	<link>http://edemmorny.wordpress.com</link>
	<description>There's a fine line between walking and flying. It's called imagination.</description>
	<lastBuildDate>Tue, 22 Dec 2009 18:05:25 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='edemmorny.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/4ea55a85c39179bf099e4e3b297b60f2?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Edem Morny's Tech Blog &#187; Richfaces</title>
		<link>http://edemmorny.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://edemmorny.wordpress.com/osd.xml" title="Edem Morny&#8217;s Tech Blog" />
		<item>
		<title>Book Review: Packt&#8217;s JBoss Richfaces 3.3</title>
		<link>http://edemmorny.wordpress.com/2009/12/22/book-review-packts-jboss-richfaces-3-3/</link>
		<comments>http://edemmorny.wordpress.com/2009/12/22/book-review-packts-jboss-richfaces-3-3/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 17:45:45 +0000</pubDate>
		<dc:creator>Edem Morny</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Seam]]></category>
		<category><![CDATA[Richfaces]]></category>

		<guid isPermaLink="false">http://edemmorny.wordpress.com/2009/12/22/book-review-packts-jboss-richfaces-3-3/</guid>
		<description><![CDATA[
Summary
Very good book on what is arguably the most popular JSF component library. Covers the less well used but very important ajax features of Richfaces, including the use of ajax regions, containers as well as the plug-n-skin features.
Details
To all intents and purposes, this book is not for a beginner JSF developer, because it assumes familiarity [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edemmorny.wordpress.com&blog=2250651&post=117&subd=edemmorny&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		H3 { margin-bottom: 0.08in } 		H3.western { font-family: "Liberation Sans", sans-serif } 		H3.ctl { font-family: "Lohit Hindi" } --></p>
<h3>Summary</h3>
<p>Very good book on what is arguably the most popular JSF component library. Covers the less well used but very important ajax features of Richfaces, including the use of ajax regions, containers as well as the plug-n-skin features.</p>
<h3>Details</h3>
<p>To all intents and purposes, this book is not for a beginner JSF developer, because it assumes familiarity with JSF 1.2. It starts off by delving into the history of the Richfaces component framework, which in eons past was just Ajax4jsf. It gives a short introduction (which is expounded later) on the ajax capabilities, the component set and skinability features of Richfaces for Rich Internet Application development.</p>
<p>It then sets off showing you step by step, how to create a simple JSF application that takes advantage of Richfaces as it&#8217;s JSF components library. It presents the seam-gen tool, a nifty tool for creating skeletons jsf projects based on the JBoss Seam project. Following the instructions on seam-gen enables you to create a quick prototype to start playing around with. This is then followed by instructions on how to manually create a project which is not Seam based, for fans of other frameworks which also integrate JSF, or for the pure JSF purists. This also includes configuring facelets support, and finally a look at how the IDEs provide support for development using the Richfaces component set.</p>
<p>The rest of the book, chapter by chapter, then focuses on using Richfaces components in building an interactive, intuitive and rich UI for your JSF application.</p>
<p>The following chapter delves into creating a JSF application using seam-gen (which I felt was repetitive, given that they&#8217;d actually created one in the preceding chapter), with additional parameters for defining the persistence model (entities) that were to be used in the application. It is worth noting from here forward almost all the examples now make use of the Seam framework&#8217;s programming model, something which could be a problem for those who are not Seam adherents. Also, with the stated assumption that this book is targeted at people with a basic knowledge of JSF, there didn&#8217;t seem to be the need to go over the basics of templating with Facelets and defining managed beans in a faces-config.xml file.</p>
<p>The next two chapters then introduce us to the intricate details of what the application is actually supposed to look like in terms of UI and functionality. The reader is taken through creating a database and generating entities from these, as well as creating a login page. I felt that these two chapters were the weakest chapters of the book, seeing as they dwelt more on entities, JPA and entities generation and Seam&#8217;s identity and login management than it did on the particular component framework in question – Richfaces. This may be explained by the fact that Richfaces enables the user to hook into Hibernate Validator for DRY enforcement on the domain model, the user could have been spared the parts on how to create the database, etc as well as Seam&#8217;s login management features.</p>
<p>Subsequently, the next chapter gives some very good insight on skinning, and implementing a means for the user to dynamically change skins. It explains the Richfaces&#8217;s use of XCSS, a powerful xml based means of describing CSS properties, as well as how to use some of the default Plug-n-Skin examples.</p>
<p>Chapter 6 then takes us deep into a real ajax experience, showing us the lesser explored but very important features provided by the rich:dataTable and rich:column components, as well as the appropriate use of the datascroller component for displaying tabular data. It also talks extensively about other data iteration components like the DataGrid and the DataList. Additionally, it goes into detail on the appropriate use of ajax placeholders, especially on using Richfaces outputPanel in achieving really ajax based changes to UI after changes are made to content, instead of just using JSF&#8217;s rendered attribute only.</p>
<p>The next chapter then deals with using the RichEditor as well as how to implement Drag&#8217;n'Drop support in your application. Finally an in-depth score is done on using the Richfaces FileUpload component.</p>
<p>Chapter 8 and 9 deal into more detail with skinning support in Richfaces, including how to create your own Plug&#8217;n'Skin skins, which can be quite easy if you follow the author&#8217;s guidance.</p>
<p>Chapter 10 dwells on advanced ajax capabilities such as Poll, Push as well as the partial update of data iteration components in the UI.</p>
<p>Of course, this book would not have been complete without discussing the Richfaces Component Development Kit (CDK). From creating a maven project using Richfaces&#8217;s CDK archetypes, to creating your own user defined components and registering them with the application, this chapter covers it all.</p>
<p>It ends with an appendix giving a short description of all the components currently provided by the Richfaces team.</p>
<h3>What I like about this book.</h3>
<p>This book contains a lot of information about how to really take advantage of the ajax capabilities provided by the Richfaces framework, and makes important mention of very valuable points to look out for when ajaxifying your application. I highly commend the indepth knowledge of Richfaces placeholders and the use of attributes like <em>ajaxSingle</em> and <em>process</em>, which gives your JSF application a true ajax feel.</p>
<h3>What I don&#8217;t like about this book.</h3>
<p>I&#8217;m an avowed fan of JBoss Seam, but I&#8217;d have preferred the book didn&#8217;t delve so deeply into Seam to make it&#8217;s point. As i mentioned before, some chapters dealt more with Seam than with Richfaces, and those may actually be quite annoying to someone who is developing with say Spring Web Flow.</p>
<p>Packt Publishing has attempted to pull off a book that provides an indepth look at the 3.3 version of  the popular JSF component library, Richfaces. In a lot of ways, I believe they have managed to do just that, give or take a few points.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/edemmorny.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/edemmorny.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/edemmorny.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/edemmorny.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/edemmorny.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/edemmorny.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/edemmorny.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/edemmorny.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/edemmorny.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/edemmorny.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edemmorny.wordpress.com&blog=2250651&post=117&subd=edemmorny&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://edemmorny.wordpress.com/2009/12/22/book-review-packts-jboss-richfaces-3-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a863ee057fa55a68fef8fbf1a4d0d53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Edem</media:title>
		</media:content>
	</item>
		<item>
		<title>DZone Releases Richfaces and Seam UI RefCardz</title>
		<link>http://edemmorny.wordpress.com/2009/03/10/dzone-releases-richfaces-and-seam-ui-refcardz/</link>
		<comments>http://edemmorny.wordpress.com/2009/03/10/dzone-releases-richfaces-and-seam-ui-refcardz/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 09:27:49 +0000</pubDate>
		<dc:creator>Edem Morny</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Seam]]></category>
		<category><![CDATA[Richfaces]]></category>

		<guid isPermaLink="false">http://edemmorny.wordpress.com/2009/03/10/dzone-releases-richfaces-and-seam-ui-refcardz/</guid>
		<description><![CDATA[As part of DZone&#8217;s aim of informing the developer, especially Java developers of their choices in tools and technologies to be productive in their fields, it regularly publishes RefCardz. These are concise, straight to the point publications highlighting appropriate uses of different technologies. They have been very insightful to me.
In recent weeks, I&#8217;ve participated in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edemmorny.wordpress.com&blog=2250651&post=80&subd=edemmorny&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As part of <a href="http://www.dzone.com/links/index.html" target="_blank">DZone&#8217;s</a> aim of informing the developer, especially Java developers of their choices in tools and technologies to be productive in their fields, it regularly publishes RefCardz. These are concise, straight to the point publications highlighting appropriate uses of different technologies. They have been very insightful to me.</p>
<p>In recent weeks, I&#8217;ve participated in reviewing the publication of <a href="http://refcardz.dzone.com/refcardz/seam-ui" target="_blank">Seam UI</a> RefCard from Jacob Orshalick, the author of the just released <a href="http://www.amazon.com/Seam-Framework-Experience-Evolution-JBoss/dp/0137129394/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1236677038&amp;sr=8-1" target="_blank">Seam Framework: Experience the Evolution of Java EE</a> and a committer on the Seam project. It contains some useful information on some of the best practices for managing and configuraing your Seam application&#8217;s UI. Just grap a copy here.</p>
<p>And just yesterday, a RefCard on <a href="http://refcardz.dzone.com/refcardz/richfaces" target="_blank">Richfaces</a> was published from the horse&#8217;s own mouth &#8211; Excadel. This publication features Nick Belaevski, Ilya Shaikovsky, Jay Balunas and <a href="http://mkblog.exadel.com/" target="_blank">Max Katz</a> &#8211; author of the well acclaimed <a href="http://www.amazon.com/Practical-RichFaces-Max-Katz/dp/1430210559/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1236677212&amp;sr=1-1" target="_blank">Practical Richfaces</a>.</p>
<p>These give fans of Seam and Richfaces enough food for thought for the next few months. Enjoy chewing on them as I have.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=3faa6557-1418-4b77-9e5e-9aa81958b41e" alt="" /></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/edemmorny.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/edemmorny.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/edemmorny.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/edemmorny.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/edemmorny.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/edemmorny.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/edemmorny.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/edemmorny.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/edemmorny.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/edemmorny.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edemmorny.wordpress.com&blog=2250651&post=80&subd=edemmorny&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://edemmorny.wordpress.com/2009/03/10/dzone-releases-richfaces-and-seam-ui-refcardz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a863ee057fa55a68fef8fbf1a4d0d53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Edem</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=3faa6557-1418-4b77-9e5e-9aa81958b41e" medium="image" />
	</item>
		<item>
		<title>RichFaces plugin Released for NetBeans 6.1</title>
		<link>http://edemmorny.wordpress.com/2008/05/19/richfaces-plugin-released-for-netbeans-61/</link>
		<comments>http://edemmorny.wordpress.com/2008/05/19/richfaces-plugin-released-for-netbeans-61/#comments</comments>
		<pubDate>Mon, 19 May 2008 09:45:14 +0000</pubDate>
		<dc:creator>Edem Morny</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[Seam]]></category>
		<category><![CDATA[Richfaces]]></category>

		<guid isPermaLink="false">http://edemmorny.wordpress.com/?p=55</guid>
		<description><![CDATA[&#60; Seam PDF Rendering
Last week Geertjan Wielanga released a plugin he&#8217;d been working on for RichFaces tag support in NetBeans. I gave it a shot and its not bad.
Its meant to provide tag support as well as drag and drop of RichFaces controls on the palette. Interestingly this support is meant for both jsps and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edemmorny.wordpress.com&blog=2250651&post=55&subd=edemmorny&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://edemmorny.wordpress.com/2008/03/31/seam-pdf-rendering-and-jpa-native-queries/">&lt; Seam PDF Rendering</a></p>
<p>Last week <a href="http://blogs.sun.com/geertjan/">Geertjan</a> Wielanga released a <a href="https://nbrichfacessupport.dev.java.net/index.html">plugin</a> he&#8217;d been working on for RichFaces tag support in NetBeans. I gave it a shot and its not bad.</p>
<p>Its meant to provide tag support as well as drag and drop of RichFaces controls on the palette. Interestingly this support is meant for both jsps and facelets. But seriously speaking, how many people are using RichFaces on jsps instead of on Facelets? Since this plugin only works with NetBeans 6.1 and the facelets support plugin does not work with 6.1, I really wonder what use it is to me and to a significant number of others.</p>
<p>This is really causing me to worry for Sun. Anyone doing anything new in JSF is not going with JSPs if they really know what is best for them, but rather with Facelets. If Sun really wants JSF to catch up (alongside using NetBeans as their preferred JSF development tool) then they should provide us developers with at least some of what JBoss Tools provides &#8211; visual editing. I&#8217;ve been waiting for Sun&#8217;s Visual JSF to now support Facelets, cos there&#8217;s no way I&#8217;m sticking with Rave. I think a lot of people share this sentiment and it is the reason why everyone is praising Seam for the good work its doing.</p>
<p>If Sun has seen it fit to bring Jacob Hookom onto the JSF 2 EG as a sign of respect for what Facelets stands for, then it should stop sitting on the sidewalk with Facelets support in NetBeans and get some decent support for it (and I mean not just tag support). Most of us NetBeans fans are in a love hate relationship with it because of such political (in)decisions. Sun should continue taking developers seriously and see how to improve on it&#8217;s technologies with already proven ones instead of trying to stuff things down our throats that we don&#8217;t want to swallow.</p>
<hr />
28th May 2008</p>
<p>Ah. I just came across a release of the Facelets support for NetBeans 6.0 rebuilt to work with NetBeans 6.1. Good job by <a href="http://ifnu.artivisi.com">http://ifnu.artivisi.com</a>. <a href="http://project-template.googlecode.com/files/nbfaceletssupport-6.1.zip">Here</a> is the download. And thanks to Po-Ting Wu for the <a href="http://blogs.sun.com/poting/entry/build_and_install_facelets_support">rebuild instructions</a>.</p>
<p>Thanks also to Geertjan for the work on Richfaces support. JSF development will get better and easier!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/edemmorny.wordpress.com/55/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/edemmorny.wordpress.com/55/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/edemmorny.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/edemmorny.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/edemmorny.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/edemmorny.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/edemmorny.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/edemmorny.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/edemmorny.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/edemmorny.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/edemmorny.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/edemmorny.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edemmorny.wordpress.com&blog=2250651&post=55&subd=edemmorny&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://edemmorny.wordpress.com/2008/05/19/richfaces-plugin-released-for-netbeans-61/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a863ee057fa55a68fef8fbf1a4d0d53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Edem</media:title>
		</media:content>
	</item>
		<item>
		<title>AJAX Magic With JSF DataTables in Seam 2.0</title>
		<link>http://edemmorny.wordpress.com/2008/03/04/ajax-magic-with-datatables-in-seam-20/</link>
		<comments>http://edemmorny.wordpress.com/2008/03/04/ajax-magic-with-datatables-in-seam-20/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 09:03:21 +0000</pubDate>
		<dc:creator>Edem Morny</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Seam]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[DataModel]]></category>
		<category><![CDATA[DataModelSelection]]></category>
		<category><![CDATA[DataTable]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[Richfaces]]></category>

		<guid isPermaLink="false">http://edemmorny.wordpress.com/?p=41</guid>
		<description><![CDATA[&#60;Seam 2.0 on Tomcat &#8230; &#124; Seam Portlet Bridge Released &#62;
RichFaces 3.1.3.GA came with a some new controls, and the &#60;rich:listShuttle/&#62; was of some interest to me. However, for a particular use case I found it not sufficient for my needs, and had to roll out my own version of it with a little bit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edemmorny.wordpress.com&blog=2250651&post=41&subd=edemmorny&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://edemmorny.wordpress.com/2008/02/02/setup-of-seam-20-applications-for-tomcat-60/">&lt;Seam 2.0 on Tomcat &#8230;</a> | <a href="http://edemmorny.wordpress.com/2008/03/04/seam-jboss-portlet-bridge-realeased/">Seam Portlet Bridge Released &gt;</a><br />
RichFaces 3.1.3.GA came with a some new controls, and the &lt;rich:listShuttle/&gt; was of some interest to me. However, for a particular use case I found it not sufficient for my needs, and had to roll out my own version of it with a little bit of Ajax to add.</p>
<p class="MsoNormal">Let me use this simple scenario to display what I needed to do. Assuming you were keeping a shopping cart. After users select an item they want to buy, you want them to specify the quantity of that item following which their total charge is calculated for them on the fly. This I thought of doing using two DataTables just like the &lt;rich:listShuttle/&gt; appears but on a sleeker (or is it cruder?) level.</p>
<p class="MsoNormal">I defined an interface with a simple set of methods which I felt would do the trick called InPlaceEditing.</p>
<p class="MsoNormal">public interface InPlaceEditing {</p>
<p class="MsoNormal"><span>    </span>void editSelection();</p>
<p class="MsoNormal"><span>    </span>void addSelection();</p>
<p class="MsoNormal"><span>    </span>void removeSelection();</p>
<p class="MsoNormal"><span>    </span>void cancelSelection();</p>
<p class="MsoNormal">}</p>
<p class="MsoNormal">Here is my”shopper” Seam component which implements the interface. Notice the use of 2 DataModels “products” and “selectedItems” and their corresponding DataModelSelections. This is to enable me select from one table to another.</p>
<p class="MsoNormal">@Name(&#8220;shopper&#8221;)</p>
<p class="MsoNormal">@Scope(ScopeType.CONVERSATION)</p>
<p class="MsoNormal">public class Shopper implements java.io.Serializable, InPlaceEditing {</p>
<p class="MsoNormal"><span>    </span>private boolean edit;</p>
<p class="MsoNormal"><span>    </span>@In</p>
<p class="MsoNormal"><span>    </span>EntityManager entityManager;</p>
<p class="MsoNormal"><span>    </span>@In</p>
<p class="MsoNormal"><span>    </span>FacesMessages facesMessages;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span>    </span>@DataModel</p>
<p class="MsoNormal"><span>    </span>List&lt;Product&gt; products;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span>    </span>@DataModelSelection(&#8220;products&#8221;)</p>
<p class="MsoNormal"><span>    </span>private Product product;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span>    </span>@DataModel</p>
<p class="MsoNormal"><span>    </span>private List&lt;CartItem&gt; selectedItems;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span>    </span>@DataModelSelection(&#8220;selectedItems&#8221;)</p>
<p class="MsoNormal"><span>    </span>private CartItem selectedItem;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span>    </span>@Out(required = false)</p>
<p class="MsoNormal"><span>    </span>private CartItem cartItem;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span>    </span>private BigDecimal total = new BigDecimal(0.0);</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span>    </span>private static int count = 0;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span>    </span>@Begin(flushMode=FlushModeType.MANUAL)</p>
<p class="MsoNormal"><span>    </span>public void beginShopping() {</p>
<p class="MsoNormal"><span>        </span>products = entityManager.createQuery(&#8220;Select p from Product p&#8221;).getResultList();</p>
<p class="MsoNormal"><span>        </span>selectedItems = new ArrayList&lt;CartItem&gt;();</p>
<p class="MsoNormal"><span>    </span>}</p>
<p class="MsoNormal">The beginShopping() method starts a conversation and FlushMode is set to MANUAL. This means that all changes made to entities will be made persistent only if I call flush() on entityManager. Seam defaults to AUTO which means all changes to all managed entities are merged into the persistence context after every Seam action call. Trust me, for the purposes of this trick, you DON&#8217;T want automatic persistence context merging! Anyway this action populates the “products” DataModel with products already entered into the database. The result is the table below.</p>
<p class="MsoNormal">&lt;a:outputPanel id=&#8221;productPanel&#8221;&gt;</p>
<p class="MsoNormal"><span>                    </span>&lt;rich:dataTable value=&#8221;#{products}&#8221; var=&#8221;product&#8221;&gt;</p>
<p class="MsoNormal"><span>                        </span>&lt;h:column&gt;</p>
<p class="MsoNormal"><span>                            </span>&lt;f:facet name=&#8221;header&#8221;&gt;Product&lt;/f:facet&gt;</p>
<p class="MsoNormal"><span>                 </span><span>           </span>&lt;a:commandLink value=&#8221;#{product.name}&#8221; actionListener=&#8221;#{shopper.editSelection}&#8221; reRender=&#8221;editPanel&#8221;/&gt;</p>
<p class="MsoNormal"><span>                        </span>&lt;/h:column&gt;</p>
<p class="MsoNormal"><span>                        </span>&lt;h:column&gt;</p>
<p class="MsoNormal"><span>                            </span>&lt;f:facet name=&#8221;header&#8221;&gt;Price&lt;/f:facet&gt;</p>
<p class="MsoNormal"><span>  </span><span>                          </span>#{product.price}</p>
<p class="MsoNormal"><span>                        </span>&lt;/h:column&gt;<span>                    </span></p>
<p class="MsoNormal"><span>                        </span>&lt;h:column&gt;</p>
<p class="MsoNormal"><span>                            </span>&lt;f:facet name=&#8221;header&#8221;&gt;Stock&lt;/f:facet&gt;</p>
<p class="MsoNormal"><span>                            </span>#{product.stock}</p>
<p class="MsoNormal"><span>          </span><span>              </span>&lt;/h:column&gt;</p>
<p class="MsoNormal"><span>                    </span>&lt;/rich:dataTable&gt;</p>
<p class="MsoNormal"><span>                </span>&lt;/a:outputPanel&gt;</p>
<p class="MsoNormal"> <a href="http://edemmorny.files.wordpress.com/2008/03/shopping_product_edit.jpg" title="Displayed editing panel"><img src="http://edemmorny.files.wordpress.com/2008/03/shopping_product_edit.thumbnail.jpg" alt="Displayed editing panel" /></a></p>
<p class="MsoNormal">A look at the section of the shop.xhtml facelet shows an &lt;a:commandLink/&gt; &#8211; an Ajaxified version of the &lt;h:commandButon/&gt;. This supplies our “shopper” component with the selected product through the “product” data model selection through Ajax. Also take note of the “reRender” and &lt;a:outputPanel/&gt; tags, which specify which areas of our page should be Ajax refreshed after certain actions are called.<span>  </span>In the editSelection() action a new CartItem (a join entity between a product and a shopping cart) containing the selected product is created and outjected.</p>
<p class="MsoNormal"><span> </span>public void editSelection() {</p>
<p class="MsoNormal"><span>        </span>if (edit == false) {</p>
<p class="MsoNormal"><span>            </span>cartItem = new CartItem();</p>
<p class="MsoNormal"><span>          </span><span>  </span>cartItem.setId(count++);</p>
<p class="MsoNormal"><span>            </span>cartItem.setProduct(product);</p>
<p class="MsoNormal"><span>            </span>cartItem.setSelected(true);</p>
<p class="MsoNormal"><span>            </span>return;</p>
<p class="MsoNormal"><span>        </span>}</p>
<p class="MsoNormal"><span>        </span>cartItem = selectedItem;</p>
<p class="MsoNormal"><span>        </span>cartItem.setSelected(true);</p>
<p class="MsoNormal"><span>        </span>edit = true;</p>
<p class="MsoNormal"><span>    </span>}</p>
<p class="MsoNormal">I want to use the same action to represent selecting a new product (from “products”) and editing an already existing CartItem (from “selectedItems”). This is achieved with a private “edit” boolan field, which by default is false.<span>  </span>Also since proper behaviour of DataModel and DataModelSelections depends on a properly implemented equals() method (i.e. instance uniqueness) I assigned artificial ids with the static “count” to each CartItem. Note that without setting flushMode to MANUAL, doing this will cause exceptions to be thrown down the lane somewhere. Finally setting the CartItem&#8217;s “selected” field to true enables the rendering of the panel in which the quantity of that product will be entered.</p>
<p class="MsoNormal"> <a href="http://edemmorny.files.wordpress.com/2008/03/shopping_product_edit.jpg" title="Displayed editing panel"><img src="http://edemmorny.files.wordpress.com/2008/03/shopping_product_edit.thumbnail.jpg" alt="Displayed editing panel" /></a></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a href="http://edemmorny.files.wordpress.com/2008/03/shopping_product1_edit.jpg" title="DataTable with configured product"><img src="http://edemmorny.files.wordpress.com/2008/03/shopping_product1_edit.thumbnail.jpg" alt="DataTable with configured product" /></a></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Once the quantity is specified, the addSelection() action is called. Because of the boolean “edit” we are able to determine if this is a new product selection or one from the existing list and respond appropriately, calculating the total cost of the users purchases so far and modifying the corresponding DataModels appropriately. In the case of an edit, the old computed cost of a product is deducted from the total, and re-computed and added to the total. To guarantee that the change in costs will reflect properly, the edited “cartItem” is removed and re-inserted in to the “selectedItems” DataModel.</p>
<p class="MsoNormal">It is also very easy to remove an already configured CartItem, again with the combination of &lt;a:commandLink/&gt; and the “selectedItem” DataModelSelection.</p>
<p class="MsoNormal">public void removeSelection() {<span>    </span></p>
<p class="MsoNormal"><span>        </span>total.subtract(selectedItem.getCost());</p>
<p class="MsoNormal"><span>      </span><span>  </span>selectedItems.remove(selectedItem);</p>
<p class="MsoNormal"><span>    </span>}</p>
<p class="MsoNormal">Finally, the user may save their selection. This involves the creation of a new Cart object, which is persisted to get an ID and associated with the CartItems in the “selectedItems” DataModel. Note here that the fake Ids I generated for the CartItems will cause maximum trouble in the database, and so I set them to null to force the persistence context to generate proper Ids for them. Don&#8217;t forget the all important “entityManager.flush()” to make all changes permanent.</p>
<p class="MsoNormal"> <a href="http://edemmorny.files.wordpress.com/2008/03/shopping_product3_edit.jpg" title="Completed Shopping"><img src="http://edemmorny.files.wordpress.com/2008/03/shopping_product3_edit.thumbnail.jpg" alt="Completed Shopping" /></a></p>
<p class="MsoNormal">Finally I raise an<span>  </span>event (“shopper.events.CartEdit”) which is being observed by the “shopList” Seam<span>  </span>component&#8217;s list() action causing the “carts” DataModel to be refreshed with fresh data.</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span>    </span>@Factory(&#8220;carts&#8221;)</p>
<p class="MsoNormal"><span>    </span>@Observer(&#8220;shopper.events.CartEdited&#8221;)</p>
<p class="MsoNormal"><span>    </span>public void list(){</p>
<p class="MsoNormal"><span>        </span>Contexts.getSessionContext().set(&#8220;carts&#8221;, null);</p>
<p class="MsoNormal"><span>        </span>carts = entityManager.createQuery(&#8220;Select c from Cart c&#8221;).getResultList();<span>        </span></p>
<p class="MsoNormal"><span>    </span>}</p>
<p class="MsoNormal"> <a href="http://edemmorny.files.wordpress.com/2008/03/home2_edit.jpg" title="Carts DataTable displaying products selected"><img src="http://edemmorny.files.wordpress.com/2008/03/home2_edit.thumbnail.jpg" alt="Carts DataTable displaying products selected" /></a></p>
<p class="MsoNormal">The Job Is Done. This is use of Ajax and DataTables is quite simplistic, but I&#8217;ve used it in some really tight corners for some advance stuff. One scenario that I can see with this example is the requirement to remove a product from the list of products once selected and configured, or to put it back once it has been removed from the configured ones. Another will be how to edit an already persisted cart to remove or add products to that cart. I&#8217;ve just laid the foundation. With some tricks of your own, you should be able to achieve some serious magic.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/edemmorny.wordpress.com/41/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/edemmorny.wordpress.com/41/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/edemmorny.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/edemmorny.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/edemmorny.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/edemmorny.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/edemmorny.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/edemmorny.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/edemmorny.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/edemmorny.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/edemmorny.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/edemmorny.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=edemmorny.wordpress.com&blog=2250651&post=41&subd=edemmorny&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://edemmorny.wordpress.com/2008/03/04/ajax-magic-with-datatables-in-seam-20/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a863ee057fa55a68fef8fbf1a4d0d53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Edem</media:title>
		</media:content>

		<media:content url="http://edemmorny.files.wordpress.com/2008/03/shopping_product_edit.thumbnail.jpg" medium="image">
			<media:title type="html">Displayed editing panel</media:title>
		</media:content>

		<media:content url="http://edemmorny.files.wordpress.com/2008/03/shopping_product_edit.thumbnail.jpg" medium="image">
			<media:title type="html">Displayed editing panel</media:title>
		</media:content>

		<media:content url="http://edemmorny.files.wordpress.com/2008/03/shopping_product1_edit.thumbnail.jpg" medium="image">
			<media:title type="html">DataTable with configured product</media:title>
		</media:content>

		<media:content url="http://edemmorny.files.wordpress.com/2008/03/shopping_product3_edit.thumbnail.jpg" medium="image">
			<media:title type="html">Completed Shopping</media:title>
		</media:content>

		<media:content url="http://edemmorny.files.wordpress.com/2008/03/home2_edit.thumbnail.jpg" medium="image">
			<media:title type="html">Carts DataTable displaying products selected</media:title>
		</media:content>
	</item>
	</channel>
</rss>