<?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>public static final &#187; Facelets</title>
	<atom:link href="http://www.publicstaticfinal.de/tag/facelets/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.publicstaticfinal.de</link>
	<description>the constant Java blog</description>
	<lastBuildDate>Fri, 25 Feb 2011 14:48:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Weld Tutorial &#8211; Part 1</title>
		<link>http://www.publicstaticfinal.de/2009/10/23/weld-tutorial-part-1/</link>
		<comments>http://www.publicstaticfinal.de/2009/10/23/weld-tutorial-part-1/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 08:03:52 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[JSF]]></category>
		<category><![CDATA[Facelets]]></category>
		<category><![CDATA[JavaEE 6]]></category>
		<category><![CDATA[jsr-299]]></category>
		<category><![CDATA[Weld]]></category>

		<guid isPermaLink="false">http://www.publicstaticfinal.de/?p=68</guid>
		<description><![CDATA[Following my recently published article about integrating Weld with Tomcat6 here&#8217;s Part 1 of my Weld tutorial. In this first part I want to create a really really really simple example application &#8211; the so called &#8220;Hello Weld&#8221; example. For the Non-German readers: &#8220;Hello Weld&#8221; is a litte pun. &#8220;World&#8221; is &#8220;Welt&#8221; in German which [...]]]></description>
			<content:encoded><![CDATA[<p>Following my recently published article about integrating Weld with Tomcat6 here&#8217;s Part 1 of my Weld tutorial.</p>
<p>In this first part I want to create a really really really simple example application &#8211; the so called &#8220;Hello Weld&#8221; example. For the Non-German readers: &#8220;Hello Weld&#8221; is a litte pun. &#8220;World&#8221; is &#8220;Welt&#8221; in German which is pretty close to Weld. <img src='http://www.publicstaticfinal.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Enough jokes for now, let&#8217;s go to work.<span id="more-68"></span>First we create the simplest bean known to mankind:</p>
<pre class="brush: java; title: ; notranslate">
package de.publicstaticfinal.web.jsf;
import java.io.Serializable;

import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

@Named(&quot;helloWeld&quot;)
@SessionScoped
public class HelloWeld implements Serializable {
private String message = &quot;Hello Weld&quot;;

 public String getMessage() {
   return message;
 }
}
</pre>
<ul>
<li>9: @Named(&#8220;helloWeld&#8221;) tells Weld that this bean is accessible under the name &#8220;helloWeld&#8221;. You don&#8217;t have to specify a value the default would be the camel-cased de-capitalized name of the Class.</li>
<li>10: @SessionScoped tells Weld that this bean resides in session scope. Be aware: When you use JSF 2.0 the are two @SessionScoped annotation. If using Wled always use the annotation in the javax.enterprise package.</li>
</ul>
<p>Now consider the following Facelets page which just outputs the &#8220;message&#8221; field from the bean referenced by the name &#8220;helloWeld&#8221;:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
 xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;
 xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
 xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&gt;
&lt;head&gt;
&lt;title&gt;Test&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h:outputText value=&quot;#{helloWeld.message}&quot; /&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>And with little surprise you get this output:</p>
<p><a href="http://www.publicstaticfinal.de/wp-content/uploads/2009/10/helloWeld01.png" rel="thumbnail"><img class="alignnone size-medium wp-image-67" title="helloWeld01" src="http://www.publicstaticfinal.de/wp-content/uploads/2009/10/helloWeld01-300x167.png" alt="helloWeld01" width="300" height="167" /></a></p>
<p>What happened? When helloWeld.jsf is requested Weld does a lookup of &#8220;#{helloWeld}&#8221; and since we declared the bean it can be found by Weld. Weld creates an instance of the bean and puts it into session scope. If you debug the application and create a breakpoint you can see that it is indeed always the same instance within a session.</p>
<p>There&#8217;s nothing that special about it since the scoped annotations are also included in JSF 2.0. Part 2 of my tutorial will show you the real fun with dependency injection.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.publicstaticfinal.de/2009/10/23/weld-tutorial-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSF 2: What&#8217;s new?</title>
		<link>http://www.publicstaticfinal.de/2009/08/05/jsf-2-whats-new/</link>
		<comments>http://www.publicstaticfinal.de/2009/08/05/jsf-2-whats-new/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 07:34:17 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Facelets]]></category>

		<guid isPermaLink="false">http://www.publicstaticfinal.de/?p=43</guid>
		<description><![CDATA[Ever wanted to have a complete overview of the (cool) new features of JSF 2? Well, you might be pleased by the blog entry of Andy Schwartz which gives a really terrific introduction to JSF 2. But be warned: You need a lot of time to work through the post! What’s New in JSF 2?]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to have a complete overview of the (cool) new features of JSF 2? Well, you might be pleased by the blog entry of Andy Schwartz which gives a really terrific introduction to JSF 2. But be warned: You need a lot of time to work through the post!</p>
<p><a href="http://andyschwartz.wordpress.com/2009/07/31/whats-new-in-jsf-2/" target="_blank">What’s New in JSF 2?</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.publicstaticfinal.de/2009/08/05/jsf-2-whats-new/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unified EL: Method calls using parameters</title>
		<link>http://www.publicstaticfinal.de/2009/06/02/unified-el-method-calls-using-parameters/</link>
		<comments>http://www.publicstaticfinal.de/2009/06/02/unified-el-method-calls-using-parameters/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 13:07:47 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[JSF]]></category>
		<category><![CDATA[EL]]></category>
		<category><![CDATA[Facelets]]></category>

		<guid isPermaLink="false">http://www.publicstaticfinal.de/?p=38</guid>
		<description><![CDATA[What Seam (and its Extended EL) could do a long time ago standard EL can do now, too: calling methods with parameters. Assuming you have the following bean: If you put &#60;h:outputText value=&#8221;#{myBean.sayHello(&#8216;Daniel&#8217;)}&#8221;/&#62; somewhere in your JSF page the output ist not a TargetInvocationException or a MethodNotFoundException but indeed a &#8220;Hello Daniel&#8221;. But with one [...]]]></description>
			<content:encoded><![CDATA[<p>What Seam (and its Extended EL) could do a long time ago standard EL can do now, too: calling methods with parameters. Assuming you have the following bean:</p>
<pre class="brush: java; title: ; notranslate">
public class MyBean {
 public String sayHello(final String name){
  return &quot;Hello &quot;  + name;
 }
}
</pre>
<p><span id="more-38"></span></p>
<p>If you put &lt;h:outputText value=&#8221;#{myBean.sayHello(&#8216;Daniel&#8217;)}&#8221;/&gt; somewhere in your JSF page the output ist not a TargetInvocationException or a MethodNotFoundException but indeed a &#8220;Hello Daniel&#8221;. But with one precondition: you have to use Facelets and not JSP (which should already do). Why is described by <a href="http://blogs.sun.com/rlubke/entry/unified_expression_language_is_and" target="_blank">Ryan Lubke</a>.</p>
<p>If you&#8217;re using Tomcat 6 be aware that it brings its own el-api.jar so you have to replace it in the lib folder.</p>
<p><strong>UPDATE</strong>: As admitted in the comments I hadn&#8217;t tested the stuff I wrote above. The steps described here aren&#8217;t enough, so I&#8217;m writing it again so that it works.</p>
<ol>
<li>Download the two SNAPSHOT jars (el-api and el-ri) from the location posted in Ryan&#8217;s blog entry</li>
<li>Put el-api-2.1.2-SNAPSHOT.jar into &lt;tomcat root&gt;/lib and remove the existing el-api.jar (please make an backup)</li>
<li>Put el-impl-2.1.2-SNAPSHOT.jar into the WEB-INF/lib folder of your webapp (or let Maven do this for you <img src='http://www.publicstaticfinal.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</li>
<li>An now the most important part: Tell JSF to use the ExpressionFactory of the RI by adding the following lines to the web.xml:
<pre class="brush: xml; title: ; notranslate">
&lt;context-param&gt;
 &lt;param-name&gt;com.sun.faces.expressionFactory&lt;/param-name&gt;
 &lt;param-value&gt;com.sun.el.ExpressionFactoryImpl&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
</li>
</ol>
<p>I missed number 4 so JSF always uses org.apache.el.ExpressionFactoryImpl as the default ExpressionFactory. But if you follow these 4 steps everything should work. At least it works for me (Mojarra 2.0.1 and Tomcat 6.0.20).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.publicstaticfinal.de/2009/06/02/unified-el-method-calls-using-parameters/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

