<?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>demetrio.it blog</title>
	<atom:link href="http://blog.demetrio.it/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.demetrio.it</link>
	<description>nessun limite all'immaginazione</description>
	<lastBuildDate>Thu, 15 Jul 2010 15:42:55 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JSF 2.0 Cookbook: book review!</title>
		<link>http://blog.demetrio.it/2010/07/15/jsf-2-0-cookbook-book-review/</link>
		<comments>http://blog.demetrio.it/2010/07/15/jsf-2-0-cookbook-book-review/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 15:41:55 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[book review]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[JSF 2.0 Cookbook]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=216</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Hello,<br />
Packt Publishing asked me to review the book <a href="https://www.packtpub.com/jsf-2-0-cookbook/book" target="_blank">JSF 2.0 Cookbook</a>. I&#8217;ll post a detailed review after I finish reading it.</p>
<p>In the meantime go and have a look to what the book is offering:</p>
<p><a href="https://www.packtpub.com/jsf-2-0-cookbook/book" target="_blank"><img style="border: none;" src="http://blog.demetrio.it/wp-content/uploads/JSF_2.0-243x300.jpg" alt="" /></a></p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/07/15/jsf-2-0-cookbook-book-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPad: first day thoughts</title>
		<link>http://blog.demetrio.it/2010/05/30/ipad-first-day-thoughts/</link>
		<comments>http://blog.demetrio.it/2010/05/30/ipad-first-day-thoughts/#comments</comments>
		<pubDate>Sun, 30 May 2010 17:47:28 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[iPad]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/2010/05/30/ipad-first-day-thoughts/</guid>
		<description><![CDATA[I had to do it, I had to write a piece from the iPad by using Wordpress for iPad.
So far i think this is a very nice machine and the statements saying it will change the world of the computing are true for me as well. Also with few apps (but they are increasing day [...]]]></description>
			<content:encoded><![CDATA[<p>I had to do it, I had to write a piece from the iPad by using Wordpress for iPad.</p>
<p>So far i think this is a very nice machine and the statements saying it will change the world of the computing are true for me as well. Also with few apps (but they are increasing day by day) I think that the 90% of the laptop users will find everything they need for their private use: browser (surfing, Facebook, webmail, Twitter, etc.), mail client, office software (I&#8217;ll talk about this point later), chats, photo,  video, music.</p>
<p>The majority of the people will use a subset of the feature listed above and they will not have to worry about where saving (and finding) their files, viruses, disk fragmentation, etc..</p>
<p>Obviously power users will find it a bit reductive but they will be able to use it at it&#8217;s best as well.</p>
<p>In 1 year there will be as many good application as we need and hopefully the iPhone OS will grow up adding new features.</p>
<p>The future of &#8220;private customers&#8221; laptops is IMHO in this simple-to-use table devices, professional will use them as well but they will always need a laptop (at least for the next 2-3 years, then things can change a lot so it&#8217;s difficult to say).</p>
<p>By now I&#8217;ve found a very big problem (for a power user): Safari Mobile doesn&#8217;t support the contenteditable attribute and it is not possible to edit Google Docs files.</p>
<p>iWork Mobile doesn&#8217;t (obviously, and that&#8217;s bad to say) support Google Docs and the only apps that mentioned the support is Office Squared. I was going to buy it to try but reviews only talk about a buggy app and suggest to wait a bit more. I also found a post saying that the new version of iPhone OS (coming in June) will support that property so we can use Google Docs from the browser, we&#8217;ll see.</p>
<p>I think this is a biG problem that has to be solved in some way. I would really like to see the Google Docs support in Pages and Numbers but I find it difficult to happen. Anyway also the actual way of moving files from/to the iPad is ridiculous and I aspect new feature in the immediate future.</p>
<p>The general quality of the iPad applications however higher then the iPhone ones (so the cost) and that&#8217;s a good thing: only few bad apps has made real money from the App Store.</p>
<p>Let&#8217;s stay tuned&#8230;</p>
<p>Dem   </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/05/30/ipad-first-day-thoughts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RichFaces editor: move the caret position at the end after a reRender</title>
		<link>http://blog.demetrio.it/2010/02/12/richfaces-editor-move-the-caret-position-at-the-end-after-a-rerender/</link>
		<comments>http://blog.demetrio.it/2010/02/12/richfaces-editor-move-the-caret-position-at-the-end-after-a-rerender/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 20:28:41 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[move caret]]></category>
		<category><![CDATA[position]]></category>
		<category><![CDATA[rich]]></category>
		<category><![CDATA[richfaces]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=194</guid>
		<description><![CDATA[Some times it can happen you need to re-render a block that includes the RichFaces editor: if the user is using to edit a piece of text, after the re-rendering the caret goes back to the first place so if the user were writing he&#8217;d have to manually move it every time it happens.
The solution [...]]]></description>
			<content:encoded><![CDATA[<p>Some times it can happen you need to re-render a block that includes the RichFaces editor: if the user is using to edit a piece of text, after the re-rendering the caret goes back to the first place so if the user were writing he&#8217;d have to manually move it every time it happens.</p>
<p>The solution to this problem (that you can use also for other purposes) is a javascript piece of code found on the TinyMCE forum, adapted for the RichFaces specific case:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #003366; font-weight: bold;">function</span> moveCaretToTheEnd<span style="color: #009900;">&#40;</span>editor_jsf_id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> editor_id <span style="color: #339933;">=</span> editor_jsf_id <span style="color: #339933;">+</span> <span style="color: #3366CC;">'TextArea'</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> ed <span style="color: #339933;">=</span> tinyMCE.<span style="color: #660066;">getInstanceById</span><span style="color: #009900;">&#40;</span>editor_id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> root <span style="color: #339933;">=</span> ed.<span style="color: #660066;">dom</span>.<span style="color: #660066;">getRoot</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #006600; font-style: italic;">// This gets the root node of the editor window</span>
        <span style="color: #003366; font-weight: bold;">var</span> lastnode <span style="color: #339933;">=</span> root.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>root.<span style="color: #660066;">childNodes</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>tinymce.<span style="color: #660066;">isGecko</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">// But firefox places the selection outside of that tag, so we need to go one level deeper:</span>
            lastnode <span style="color: #339933;">=</span> lastnode.<span style="color: #660066;">childNodes</span><span style="color: #009900;">&#91;</span>lastnode.<span style="color: #660066;">childNodes</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #006600; font-style: italic;">// Now, we select the node</span>
        ed.<span style="color: #660066;">selection</span>.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span>lastnode<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// And collapse the selection to the end to put the caret there:</span>
        ed.<span style="color: #660066;">selection</span>.<span style="color: #660066;">collapse</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The only change I had to do is on the first line of the script as the id of the component we have to pass to get the editor instance is <componentId>+&#8221;TextArea&#8221; so I had to compose the id passed to the js function with the &#8220;TextArea&#8221; string.</p>
<p>To discover the id of the component we can use the built-in RichFaces function <em>rich:clientId</em> in this way (example in a poll component):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:poll</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;currentChatMsgs,recipientList,threadFoldedSection&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">oncomplete</span>=<span style="color: #ff0000;">&quot;moveCaretToTheEnd('#{rich:clientId('myEditorJsfId')}')&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">enabled</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Demetrio Filocamo</p>
<p>&#8212;&#8212;</p>
<p>JBoss RichFaces 3.3 (book) &#8211; <a href="http://www.packtpub.com/jboss-richfaces-3-3">http://www.packtpub.com/jboss-richfaces-3-3</a></p>
<p>Learn RichFaces step by step developing a sample application.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/02/12/richfaces-editor-move-the-caret-position-at-the-end-after-a-rerender/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RichFaces editor: how to intercept the &#8220;return&#8221; key to submit a form</title>
		<link>http://blog.demetrio.it/2010/02/12/richfaces-editor-how-to-intercept-the-return-key-to-submit-a-form/</link>
		<comments>http://blog.demetrio.it/2010/02/12/richfaces-editor-how-to-intercept-the-return-key-to-submit-a-form/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 19:06:35 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[intercept]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[onkeypress]]></category>
		<category><![CDATA[return key]]></category>
		<category><![CDATA[rich]]></category>
		<category><![CDATA[richfaces]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=156</guid>
		<description><![CDATA[Hello,
I&#8217;ll try to write more on my blog and keep you update about every technique I use and that can be very useful to you as well.
Today I needed to submit a form with an editor element when the user pressed the &#8220;return&#8221; key (instead of creating a new line).
The code is not so complicate [...]]]></description>
			<content:encoded><![CDATA[<p>Hello,<br />
I&#8217;ll try to write more on my blog and keep you update about every technique I use and that can be very useful to you as well.</p>
<p>Today I needed to submit a form with an editor element when the user pressed the &#8220;return&#8221; key (instead of creating a new line).</p>
<p>The code is not so complicate but as the rich:editor uses the TinyMCE component you have to search all around to find the right way. Better to have a complete solution.</p>
<p>It consists on creating an handler onKeyPress and call a javascript function (created by a:jsFunction) to submit our form. Simpler doing then saying it.</p>
<p>Let&#8217;s start by including the editor in the standard way (form, editor, submit button):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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;rich:editor</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&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></pre></div></div>

<p>I&#8217;ve kept it simple (stripped out all the params and attribute I use) to target only our problem.</p>
<p>Let&#8217;s define a javascript function handler for our use case:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #003366; font-weight: bold;">function</span> returnSubmit<span style="color: #009900;">&#40;</span>ed<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ed.<span style="color: #660066;">onKeyPress</span>.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ed<span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> keyCode <span style="color: #339933;">=</span> e.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">which</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">charCode</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>keyCode <span style="color: #339933;">==</span> <span style="color: #CC0000;">13</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">// My return key handler code here </span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The <em>ed</em> variable will be passed by the editor; let&#8217;s configure our new function to the onsetup editor event:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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;rich:editor</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">onsetup</span>=<span style="color: #ff0000;">&quot;returnSubmit(ed)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&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></pre></div></div>

<p>Now we have a function that is called for each keyPress event, and inside it we can execute something on &#8220;return&#8221; key press.</p>
<p>What we have to do is to submit the form, the best way is to create an Ajax javascript function using a:jsFunction: in this way we can do standard Ajax updates also reRendering elements, submitting params and all the thing we are used to <img src='http://blog.demetrio.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Let&#8217;s create the function:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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;rich:editor</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">onsetup</span>=<span style="color: #ff0000;">&quot;returnSubmit(ed)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:jsFunction</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;submitForm&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&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></pre></div></div>

<p>Now we have to insert it into the handler and it&#8217;s done!</p>
<p>Here it is the whole code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #003366; font-weight: bold;">function</span> returnSubmit<span style="color: #009900;">&#40;</span>ed<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ed.<span style="color: #660066;">onKeyPress</span>.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ed<span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> keyCode <span style="color: #339933;">=</span> e.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">which</span> <span style="color: #339933;">||</span> e.<span style="color: #660066;">charCode</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>keyCode <span style="color: #339933;">==</span> <span style="color: #CC0000;">13</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">// My return key handler code here </span>
                submitForm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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;rich:editor</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">onsetup</span>=<span style="color: #ff0000;">&quot;returnSubmit(ed)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:jsFunction</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;submitForm&quot;</span> <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;something&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></pre></div></div>

<p><strong>Another tip</strong><br />
If with the js function you reRender components, do some action, set some property etc., to avoid duplication of code in the commandButton you can use the same js function into the button using the <em>onclick</em> attribute:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><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;rich:editor</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#{editorBean.myValue}&quot;</span> </span>
<span style="color: #009900;">                <span style="color: #000066;">onsetup</span>=<span style="color: #ff0000;">&quot;returnSubmit(ed)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:commandButton</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Send&quot;</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">&quot;submitForm();&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a:jsFunction</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;submitForm&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">action</span>=<span style="color: #ff0000;">&quot;#{myBean.myAction}&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">oncomplete</span>=<span style="color: #ff0000;">&quot;doSomething();&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">reRender</span>=<span style="color: #ff0000;">&quot;first,second&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;f:setPropertyActionListener</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;valueToSet&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;#{myBean.firstValue}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a:jsFunction<span style="color: #000000; font-weight: bold;">&gt;</span></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></pre></div></div>

<p>Demetrio Filocamo</p>
<p>&#8212;&#8212;</p>
<p>JBoss RichFaces 3.3 (book) &#8211; <a href="http://www.packtpub.com/jboss-richfaces-3-3">http://www.packtpub.com/jboss-richfaces-3-3</a></p>
<p>Learn RichFaces step by step developing a sample application.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/02/12/richfaces-editor-how-to-intercept-the-return-key-to-submit-a-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JBoss RichFaces 3.3 &#8211; Introduction</title>
		<link>http://blog.demetrio.it/2010/02/12/jboss-richfaces-3-3-introduction/</link>
		<comments>http://blog.demetrio.it/2010/02/12/jboss-richfaces-3-3-introduction/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 02:49:19 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[richfaces]]></category>
		<category><![CDATA[slides]]></category>
		<category><![CDATA[slideshare]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=153</guid>
		<description><![CDATA[An introduction to JBoss RichFaces framework and to the book JBoss RichFaces (Packt) by Demetrio Filocamo.
RichFaces is a very useful open source framework that allows you to add Ajax capability to your JSF application (using the standard JSF components) without the need to write JavaScript code and manage JavaScript compatibility between browsers.
You can read more [...]]]></description>
			<content:encoded><![CDATA[<p>An introduction to JBoss RichFaces framework and to the book JBoss RichFaces (Packt) by Demetrio Filocamo.</p>
<p>RichFaces is a very useful open source framework that allows you to add Ajax capability to your JSF application (using the standard JSF components) without the need to write JavaScript code and manage JavaScript compatibility between browsers.</p>
<p>You can read more about the book here: <a href="http://www.packtpub.com/jboss-richfaces-3-3">http://www.packtpub.com/jboss-richfaces-3-3</a></p>
<div id="__ss_3143676" style="width: 425px; text-align: left;"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" title="JBoss RichFaces 3.3 - Introduction" href="http://www.slideshare.net/demetrio812/jboss-richfaces-33-introduction">JBoss RichFaces 3.3 &#8211; Introduction</a><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=slidesintroduction-100211203450-phpapp02&amp;stripped_title=jboss-richfaces-33-introduction" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=slidesintroduction-100211203450-phpapp02&amp;stripped_title=jboss-richfaces-33-introduction" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/demetrio812">Demetrio Filocamo</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/02/12/jboss-richfaces-3-3-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New book: JSF 1.2 Components</title>
		<link>http://blog.demetrio.it/2010/02/12/new-book-jsf-1-2-components/</link>
		<comments>http://blog.demetrio.it/2010/02/12/new-book-jsf-1-2-components/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 01:02:27 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[jsf]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=146</guid>
		<description><![CDATA[Hi guys,
I&#8217;m going to read and then review for Packt Publishing the new book JSF 1.2 Components by lan Hlavats, the developer behing JSF ToolBox for Dreamweaver. The book is about the most important JSF component frameworks we can use to empower our application. So starting from the Standard JSF Components we&#8217;ll go through Facelets, [...]]]></description>
			<content:encoded><![CDATA[<p>Hi guys,<br />
I&#8217;m going to read and then review for Packt Publishing the new book<strong> JSF 1.2 Components </strong>by <strong>lan Hlavats</strong>, the developer behing <em>JSF ToolBox for Dreamweaver</em>. The book is about the most important JSF component frameworks we can use to empower our application. So starting from the <strong>Standard JSF Components</strong> we&#8217;ll go through <strong>Facelets</strong>, <strong>Apache Tomahawk</strong>, <strong>Apache Trinidad</strong>, <strong>ICEfaces</strong>,<strong> JBoss Seam JSF Components</strong> and <strong>JBoss RichFaces</strong>.</p>
<p>It is also technically reviewed by very know guys on JSF field like <strong>Cagatay Civici</strong> (PMC member of open source JSF implementation Apache MyFaces and the project leader of popular PrimeFaces framework), <strong>Ted Goddard</strong> (Chief Software Architect at ICEsoft Technologies and is the technical leader for ICEfaces), <strong>Kito D. Mann</strong> (editor-in-chief of JSF Central &#8211; www.jsfcentral.com &#8211; and the author of JavaServer Faces in Action &#8211; Manning) and others.</p>
<p>I&#8217;ll come back soon with something to say, in the meantime you can download the sample chapter about the <em>Facelets Components</em> by clicking <a href="http://blog.demetrio.it/wp-content/uploads/7627-developing-jsf-components-sample-chapter-2-facelets-components.pdf">here</a>, or buy the book from the <a href="http://www.packtpub.com/jsf-1-2-components-develop-advanced-ajax-enabled-applications/book/mid/090210c140fp?utm_source=demetrio.it&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_002394" target="_blank">Packt website</a>!</p>
<p>Thanks</p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2010/02/12/new-book-jsf-1-2-components/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JBoss RichFaces 3.3 &#8211; My book has been published!</title>
		<link>http://blog.demetrio.it/2009/11/07/jboss-richfaces-3-3/</link>
		<comments>http://blog.demetrio.it/2009/11/07/jboss-richfaces-3-3/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 00:41:09 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[londra]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[3.3]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[demetrio]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[facelets]]></category>
		<category><![CDATA[filocamo]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[manual]]></category>
		<category><![CDATA[packt]]></category>
		<category><![CDATA[richfaces]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[seam]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=131</guid>
		<description><![CDATA[Hi all,
the book I&#8217;ve worked on the last months has finally been published!!

JBoss RichFaces is a rich component library for JavaServer Faces and an AJAX framework that allows easy integration of Ajax capabilities into complex business applications. Do you wish to eliminate the time involved in writing JavaScript code and managing JavaScript-compatibility between browsers to [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,<br />
<strong>the book I&#8217;ve worked on the last months has finally been published!!</strong></p>
<p style="text-align: center;"><a title="JBoss RichFaces 3.3" rel="lightbox[pics131]" href="http://blog.demetrio.it/wp-content/uploads/JBoss-RichFaces.jpg"><img class="attachment wp-att-133 aligncenter" src="http://blog.demetrio.it/wp-content/uploads/JBoss-RichFaces.jpg" alt="JBoss RichFaces 3.3" width="300" height="370" /></a></p>
<p style="text-align: left;">JBoss RichFaces is a rich component library for JavaServer Faces and an AJAX framework that allows easy integration of Ajax capabilities into complex business applications. Do you wish to eliminate the time involved in writing JavaScript code and managing JavaScript-compatibility between browsers to build an Ajax web application quickly?</p>
<p>This book goes beyond the documentation to teach you how to do that. It will show you how to get the most out of JBoss RichFaces by explaining the key components and how you can use them to enhance your applications. Most importantly, you will learn how to integrate Ajax into your applications without using JavaScript, but only standard JSF components. You will learn how to create and customize your own components and add them to your new or existing applications.</p>
<p>First, the book introduces you to JBoss RichFaces and its components. It uses many examples of Ajax components which, among others, include: Calendar, Data Table, ToolTip, ToolBar, Menu, RichEditor, and Drag &#8216;n&#8217; Drop. All these components will help you create the web site you always imagined. Key aspects of the RichFaces framework such as the Ajax framework, skinnability, and Component Development Kit (CDK) will help you customize the look of your web application. As you progress through the book, you will see a sample application that shows you how to build an advanced contact manager. You&#8217;re also going to be amazed to know about the advanced topics you will learn such as developing new components, new skins, optimizing a web application, inserting components dynamically using Java instead of XHTML, and using JavaScript to manage components. This book is more than a reference with component example code: it&#8217;s a manual that will guide you, step by step, through the development of a real Ajax JSF web application.</p>
<p><strong>What This Book Covers</strong></p>
<ul>
<li>Chapter 1: <em>What is RichFaces</em> covers the aims of the RichFaces framework, its components, and what you can do by using it in a web application.</li>
<li>Chapter 2: <em>Getting Ready</em> explains how to configure your environment by creating a simple project using the seam-gen tool, adding support to Seam and Facelets, and the manual configuration for the RichFaces libraries. We will understand the IDE that we can use while developing with the framework.</li>
<li>In Chapter 3: <em>First Steps</em>, you will learn to build Ajax applications by developing a simple example, the basics of RichFaces step by step, from creating the project to editing the code, using very important components and their Ajax properties.</li>
<li>Chapter 4:<em> The Application</em> covers how to create the basics of our project by having a look at the side technologies we might know, in order to build good applications. It will cover templating with Facelets, JBoss Seam authentication, and customization of the entities.</li>
<li>Chapter 5: <em>Making the Application Structure</em> explains us how to create the login and registration system of the website. We&#8217;ll look at all the features that a real application might have.</li>
<li>In Chapter 6: <em>Making the Contacts List and Detail</em>, we will develop the core feature of our application—contact management. We&#8217;ll learn about Ajax interaction and containers, and about new Ajax components that RichFaces offers.</li>
<li>Chapter 7: <em>Finishing the Application</em> explains how to finish building the application using the RichFaces components, and about customizing them.</li>
<li>In Chapter 8: <em>Skin Customization</em>, we&#8217;ll see all the powerful customization capabilities that the RichFaces framework offers.</li>
<li>Chapter 9: <em>Creating a New plug &#8216;n&#8217; skin</em> covers how to create, customize, and package and deploy a new pluggable skin.</li>
<li>Chapter 10: <em>Advanced Techniques</em> explains you how to use and implement pushing, partial updates, and session expiration handling in order to develop advanced applications.</li>
<li>In Chapter 11: <em>Component Development Kit</em>, we&#8217;ll see how to start a project in order to develop a simple JSF Ajax component in a simple and effective way using the features the CDK offers.</li>
<li>Appendix: <em>RichFaces Components Overview</em> covers a list of all the components of RichFaces with their functionalities.</li>
</ul>
<p><strong>Example chapter</strong><br />
You can download a sample chapter, Chapter 8: <em>Skin Customization</em>,  by clicking <a href="http://blog.demetrio.it/wp-content/uploads/Chapter-8-Skin-Customization.pdf">here</a>.</p>
<p><strong>Where to buy it</strong><br />
You can buy JBoss RichFaces 3.3 from the <a href="http://www.packtpub.com/jboss-richfaces-3-3/mid/031109dmdusq?utm_source=Blog.demetrio.it&#038;utm_medium=affiliate&#038;utm_content=authorsite&#038;utm_campaign=mdb_001309" target="_blank">Packt Publishing website</a>.</p>
<p>Free shipping to the US, UK, Europe and selected Asian countries. For more information, please read the <a href="http://www.packtpub.com/Shippingpolicy" target="_blank">Packt Publishing shipping policy</a>.<br />
Alternatively, you can buy the book from Amazon, BN.com, Computer Manuals and most internet book retailers.</p>
<p>Thank you!</p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2009/11/07/jboss-richfaces-3-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding Cache support to a seam-gen generated EAR project</title>
		<link>http://blog.demetrio.it/2009/04/03/adding-cache-support-to-a-seam-gen-generated-ear-project/</link>
		<comments>http://blog.demetrio.it/2009/04/03/adding-cache-support-to-a-seam-gen-generated-ear-project/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 00:08:33 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[ear]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jboss cache]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[seam]]></category>
		<category><![CDATA[seam-gen]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=110</guid>
		<description><![CDATA[Adding Cache support to a Seam project (Seam 2.1.x) it&#8217;s very simple and it is described in the official Seam developer documentation, anyways it doesn&#8217;t explain the exact steps to accomplish the task into an EAR project, I&#8217;m writing them to make your life even more simple  

Add treecache.xml (you can find it into the [...]]]></description>
			<content:encoded><![CDATA[<p>Adding Cache support to a Seam project (Seam 2.1.x) it&#8217;s very simple and it is described in the<a title="JBoss Seam Cache documentation" href="http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/cache.html" target="_blank"> official Seam developer documentation</a>, anyways it doesn&#8217;t explain the exact steps to accomplish the task into an EAR project, I&#8217;m writing them to make your life even more simple <img src='http://blog.demetrio.it/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<ul>
<li>Add treecache.xml (you can find it into the seam blog example) to /resources/META-INF/</li>
<li>Open build.xml for editing, go to the &#8220;ear&#8221; target and tell to copy the treecache.xml file:<br />
&lt;target name=&#8221;ear&#8221; description=&#8221;Build the EAR structure in a staging directory&#8221;&gt;<br />
&#8230;<br />
    &lt;copy todir=&#8221;${ear.dir}/META-INF&#8221;&gt;<br />
        &lt;fileset dir=&#8221;${basedir}/resources/META-INF&#8221;&gt;<br />
            &lt;include name=&#8221;application.xml&#8221;/&gt;<br />
            &lt;include name=&#8221;jboss-app.xml&#8221;/&gt;<br />
            &lt;include name=&#8221;seam-deployment.properties&#8221;/&gt;<br />
            &lt;include name=&#8221;treecache.xml&#8221;/&gt;<br />
        &lt;/fileset&gt;<br />
    &lt;/copy&gt;<br />
&lt;/target&gt;</li>
<li>Edit components.xml, add the following XMLNS:<br />
xmlns:cache=&#8221;http://jboss.com/products/seam/cache&#8221;The following schema location:<br />
http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.1.xsd </p>
<p>And the following declaration:<br />
&lt;cache:jboss-cache-provider configuration=&#8221;META-INF/treecache.xml&#8221; /&gt;</li>
<li>Edit deployed-jars-ear.list and add the required JARs, I used the JBoss Cache 1.x for JBoss AS 4.2.X:<br />
jboss-cache.jar<br />
jgroups.jarHere there is the <a href="http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/cache.html#d0e21178">list</a> of jars (and versions) for other configurations.</li>
</ul>
<p>And <a href="http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/cache.html#d0e21343">here</a> you find the way how to use it in your projects.</p>
<p>Hope you liked it.</p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2009/04/03/adding-cache-support-to-a-seam-gen-generated-ear-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One-to-one relationship with auto-generated key using JPA/Hibernate using annotations</title>
		<link>http://blog.demetrio.it/2009/04/03/one-to-one-relationship-with-auto-generated-key-using-jpahibernate-using-annotations/</link>
		<comments>http://blog.demetrio.it/2009/04/03/one-to-one-relationship-with-auto-generated-key-using-jpahibernate-using-annotations/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 01:18:52 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[auto generated key]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[one-to-one]]></category>
		<category><![CDATA[one2one]]></category>
		<category><![CDATA[seam]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=115</guid>
		<description><![CDATA[ 
Adding a one-to-one relationship with shared primary key can become a difficult task if the main table key is an auto-generated one.
Even the Hibernate Annotations documentation example only works with not auto-generated id, if you try to use an auto incremental id, for example, 
it&#8217;s impossible to persist the 2 tables at the same time.
Surfing on [...]]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>Adding a one-to-one relationship with shared primary key can become a difficult task if the main table key is an auto-generated one.</p>
<p>Even the Hibernate Annotations documentation example only works with not auto-generated id, if you try to use an auto incremental id, for example, </p>
<p>it&#8217;s impossible to persist the 2 tables at the same time.</p>
<p>Surfing on the net I&#8217;ve seen some ppl with this kind of problem (I suppose one-to-one relationships are not so common, don&#8217;t know why) and most of ppl use the foreign-key approach that works ok but it&#8217;s not clean from my point of view, so I wanted to find a solution for my case.</p>
<p>The original example from the Hibernate Annotations Documentation is:</p>
<p>@Entity<br />
public class Body {</p>
<p>    @Id<br />
    public Long getId() { return id; }</p>
<p>    @OneToOne(cascade = CascadeType.ALL)<br />
    @PrimaryKeyJoinColumn<br />
    public Heart getHeart() {<br />
        return heart;<br />
    }</p>
<p>    &#8230;</p>
<p>}</p>
<p> </p>
<p>@Entity<br />
public class Heart {</p>
<p>    @Id<br />
    public Long getId() { &#8230; }</p>
<p>}</p>
<p>As you can see this as not auto generated id and will not work just putting the <em>@GeneratedValue</em> annotation.</p>
<p>The final solution is:</p>
<p>@Entity<br />
public class Body {</p>
<p>    @Id<br />
    <strong>@GeneratedValue(strategy = IDENTITY)</strong><br />
    public Long getId() { return id; }</p>
<p>    @OneToOne(cascade = CascadeType.ALL)<br />
    @PrimaryKeyJoinColumn<br />
    public Heart getHeart() {<br />
        return heart;<br />
    }</p>
<p>    &#8230;</p>
<p>}</p>
<p>@Entity<br />
public class Heart {</p>
<p>    @Id<br />
<strong>    @GeneratedValue(generator=&#8221;foreign&#8221;) <br />
    @GenericGenerator(name=&#8221;foreign&#8221;, strategy = &#8220;foreign&#8221;, parameters = {@Parameter(name=&#8221;property&#8221;, value=&#8221;body&#8221;)})<br />
<span style="font-weight: normal; ">    public Long getId() { &#8230;}</span></strong></p>
<p><strong>    @OneToOne(mappedBy=&#8221;heart&#8221;)<br />
    public Body getBody() { &#8230; }</strong></p>
<p>}</p>
<div>Now all works fine for me.</div>
<div>Thanks</div>
<div>Demetrio</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2009/04/03/one-to-one-relationship-with-auto-generated-key-using-jpahibernate-using-annotations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying a JSF 1.1 app (+ Facelets) on Google App</title>
		<link>http://blog.demetrio.it/2009/03/10/deploying-a-jsf-11-app-on-google-app/</link>
		<comments>http://blog.demetrio.it/2009/03/10/deploying-a-jsf-11-app-on-google-app/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 12:44:09 +0000</pubDate>
		<dc:creator>Demetrio Filocamo</dc:creator>
				<category><![CDATA[londra]]></category>
		<category><![CDATA[facelets]]></category>
		<category><![CDATA[google app]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jsf]]></category>

		<guid isPermaLink="false">http://blog.demetrio.it/?p=121</guid>
		<description><![CDATA[Hi,
As you know yesterday Google enabled Java as the second language on Google App.
I registered to the test version and I want to try to run JSF&#8230;I started with Jsf 1.1 and it worked perfectly!!
I tried the JSF example that come with JBoss Tools, try it at:
http://2.latest.demetrio81280.appspot.com/pages/inputUserName.jsf
If you want to try it, these are the [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>As you know yesterday Google enabled Java as the second language on Google App.</p>
<p>I registered to the test version and I want to try to run JSF&#8230;I started with Jsf 1.1 and it worked perfectly!!</p>
<p>I tried the JSF example that come with JBoss Tools, try it at:</p>
<p><a href="http://2.latest.demetrio81280.appspot.com/pages/inputUserName.jsf" target="_blank">http://2.latest.demetrio81280.appspot.com/pages/inputUserName.jsf</a></p>
<p>If you want to try it, these are the simple steps:</p>
<ol>
<li>Register to <a href="http://code.google.com/intl/it-IT/appengine/" target="_blank">Google App</a> (they says just 10000 ppl initially!)</li>
<li>Download and install <a href="http://code.google.com/intl/it-IT/appengine/downloads.html#Download_the_Google_Plugin_for_Eclipse" target="_blank">Google App plugin for Eclipse</a></li>
<li>Create a Google App project with Eclipse</li>
<li>Create a JSF 1.1 project using the template using JBoss Tools Eclipse plugin (or make your own JSF demo)</li>
<li>Copy all the libraries of the JSF demo into the war/WEB-INF/lib/ directory of Google App project</li>
<li>Copy the src java file of the JSF demo into the src directory of Google App project</li>
<li>Copy the WebContent java file of the JSF demo into the war directory of Google App project</li>
<li>Add this string:<br />
<strong>&lt;sessions-enabled&gt;true&lt;/sessions-enabled&gt;</strong><br />
on the appengine-web.xml file to enable the session</li>
<li>If you used the JSF 1.1 JBoss Tools template you have to make the User bean serializable just adding <strong>implements Serializable</strong> to the User class</li>
</ol>
<p>Done! You can now deploy and test it!!</p>
<p>When I&#8217;ll have more time I want to try JSF 1.2 and RichFaces, I think there will be more problems trying to run JBoss Seam (we&#8217;ll see! <img src='http://blog.demetrio.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
<p><strong>UPDATE</strong>: Facelets works perfectly in JSF 1.1, JSF 1.2 has a problem during startup (see <a href="http://seamframework.org/Community/SeamGoogleAppEngine#comment71623" target="_blank">here</a>)</p>
<p>Demetrio</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.demetrio.it/2009/03/10/deploying-a-jsf-11-app-on-google-app/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
