<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: It&#8217;s a Chameleon! About JSF Pages that change their appearance mid-flight (or: programmatic manipulation of JSF UI Components)</title>
	<atom:link href="http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/feed" rel="self" type="application/rss+xml" />
	<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components</link>
	<description>Weblog for the AMIS Technology corner</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:47:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Slip</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-481271</link>
		<dc:creator>Slip</dc:creator>
		<pubDate>Fri, 07 Oct 2011 01:05:14 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-481271</guid>
		<description>REALLY useful!
I used your techniques to build a page/bean combo that dynamically displays any table in a database, using &lt;h:dataTable&gt;, generated based on the table&#039;s database metadata - sure beats one page per table!</description>
		<content:encoded><![CDATA[<p>REALLY useful!<br />
I used your techniques to build a page/bean combo that dynamically displays any table in a database, using &lt;h:dataTable&gt;, generated based on the table&#8217;s database metadata &#8211; sure beats one page per table!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stewart</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-265484</link>
		<dc:creator>Stewart</dc:creator>
		<pubDate>Fri, 26 Oct 2007 16:02:48 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-265484</guid>
		<description>In reply to my own comment, I have found that the best point to access the UIPanelGrid is in the setter from the binding. ie, if you have:
 then in Bean.java you can have: setThePanel( UIPanel panel) { this.panel = panel; augmentPanel(); }
The panel that is passed in has nothing constructed on it and its id attribute is null, but you can still programmatically add components to it for it to render correctly.
In addition to this, if you have components added in the JSP also, they are preserved and merged with your programmatic additions.
Quite cool, really.
Regards,
Stewart</description>
		<content:encoded><![CDATA[<p>In reply to my own comment, I have found that the best point to access the UIPanelGrid is in the setter from the binding. ie, if you have:<br />
 then in Bean.java you can have: setThePanel( UIPanel panel) { this.panel = panel; augmentPanel(); }<br />
The panel that is passed in has nothing constructed on it and its id attribute is null, but you can still programmatically add components to it for it to render correctly.<br />
In addition to this, if you have components added in the JSP also, they are preserved and merged with your programmatic additions.<br />
Quite cool, really.<br />
Regards,<br />
Stewart</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stewart</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-265424</link>
		<dc:creator>Stewart</dc:creator>
		<pubDate>Thu, 25 Oct 2007 17:24:39 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-265424</guid>
		<description>Hi Lucas,
This is an excellent article, and I thank you for writing it.

One curious situation I have, which I have been unable to solve, is that of programmatically creating the initial page.
I have tried various ways of accessing the created components, such as through a bean or PhaseListener.
It appears the page is not constructed at any point up to and including before RENDER_RESPONSE;
however, if I try programmatic manipulation after RENDER_RESPONSE, apparently the page has already been written to the browser,
so it&#039;s there on a refresh, but not that first time.

Anyone have any ideas?

Thanks,

Stewart</description>
		<content:encoded><![CDATA[<p>Hi Lucas,<br />
This is an excellent article, and I thank you for writing it.</p>
<p>One curious situation I have, which I have been unable to solve, is that of programmatically creating the initial page.<br />
I have tried various ways of accessing the created components, such as through a bean or PhaseListener.<br />
It appears the page is not constructed at any point up to and including before RENDER_RESPONSE;<br />
however, if I try programmatic manipulation after RENDER_RESPONSE, apparently the page has already been written to the browser,<br />
so it&#8217;s there on a refresh, but not that first time.</p>
<p>Anyone have any ideas?</p>
<p>Thanks,</p>
<p>Stewart</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heny</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-191076</link>
		<dc:creator>Heny</dc:creator>
		<pubDate>Tue, 09 Jan 2007 21:26:11 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-191076</guid>
		<description>Could you send me or post the source code in zip file?

Thanks!</description>
		<content:encoded><![CDATA[<p>Could you send me or post the source code in zip file?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeanne</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-58580</link>
		<dc:creator>Jeanne</dc:creator>
		<pubDate>Wed, 17 May 2006 20:46:46 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-58580</guid>
		<description>Lucas, Could you please expand on what happens after one hits &#039;Post your answer&#039;? I am asking because while I am doing something similar and have been able to the &#039;value&#039; of the selectItem but have not been able to successfully utilize getItemLabel. If you needed to access the label portion of the item selected as an &#039;Answer&#039;, how would you do it? Thanks, Jeanne</description>
		<content:encoded><![CDATA[<p>Lucas, Could you please expand on what happens after one hits &#8216;Post your answer&#8217;? I am asking because while I am doing something similar and have been able to the &#8216;value&#8217; of the selectItem but have not been able to successfully utilize getItemLabel. If you needed to access the label portion of the item selected as an &#8216;Answer&#8217;, how would you do it? Thanks, Jeanne</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: giuseppe</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-58018</link>
		<dc:creator>giuseppe</dc:creator>
		<pubDate>Tue, 16 May 2006 14:07:53 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-58018</guid>
		<description>I was thinking about a printable version or a pdf dowload of the article. I will copy and paste the content of the article. Thanks.</description>
		<content:encoded><![CDATA[<p>I was thinking about a printable version or a pdf dowload of the article. I will copy and paste the content of the article. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucas Jellema</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-57894</link>
		<dc:creator>Lucas Jellema</dc:creator>
		<pubDate>Tue, 16 May 2006 07:04:56 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-57894</guid>
		<description>Giuseppe, I am not entirely sure what you mean. All content is right there on the weblog. I have no Word document to back it up. You can just copy and paste it from the site - same as I would to provide this printable copy (at least if a Word document or something similar is what you are after). Is there anything in particular I can do for you?</description>
		<content:encoded><![CDATA[<p>Giuseppe, I am not entirely sure what you mean. All content is right there on the weblog. I have no Word document to back it up. You can just copy and paste it from the site &#8211; same as I would to provide this printable copy (at least if a Word document or something similar is what you are after). Is there anything in particular I can do for you?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: giuseppe</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-57759</link>
		<dc:creator>giuseppe</dc:creator>
		<pubDate>Mon, 15 May 2006 16:52:00 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-57759</guid>
		<description>Lucas, nice article as previous that I have seen in this blog. Is it possible to have a printable version of this article? Thanks in advance. Giuseppe</description>
		<content:encoded><![CDATA[<p>Lucas, nice article as previous that I have seen in this blog. Is it possible to have a printable version of this article? Thanks in advance. Giuseppe</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucas Jellema</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-56950</link>
		<dc:creator>Lucas Jellema</dc:creator>
		<pubDate>Fri, 12 May 2006 09:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-56950</guid>
		<description>See for an interesting debate on this article: &lt;a href=&quot;http://www.theserverside.com/news/thread.tss?thread_id=40395&quot; rel=&quot;nofollow&quot;&gt;The Server Side - Thread 40395&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>See for an interesting debate on this article: <a href="http://www.theserverside.com/news/thread.tss?thread_id=40395" rel="nofollow">The Server Side &#8211; Thread 40395</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucas Jellema</title>
		<link>http://technology.amis.nl/blog/1187/its-a-chamelon-about-jsf-pages-that-change-their-appearance-mid-flight-or-programmatic-manipulation-of-jsf-ui-components/comment-page-1#comment-56935</link>
		<dc:creator>Lucas Jellema</dc:creator>
		<pubDate>Fri, 12 May 2006 06:51:36 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1187#comment-56935</guid>
		<description>Dmitry, 
In this specific example, that would work. However, as I suggest in the article, there may be cases - especially when setting up a questionnaire style application - where the meta-data specifying the page&#039;s look &amp; feel are more maintained in a database and are much more voluminous and contain much more complicated - in part dynamically created - page fragment definitionis. It would be much harder to proactively anticipate al possible pieces of page elements (and their relative sequencing) in a JSP.

I agree that whenever a JSP can get you there with relatively simple (JSTL and EL) logic, it is preferable to defining the UI Components in code. But as soon as the JSP starts to grow fat with lots of if-conditions and repetitions of the same component definitions, resorting to code based run-time manipulation to me is certainly a valuable option.

By the way, how many lines of Servlet code would you need to achieve what this snippet of code does:

UIComponent  answer = (HtmlSelectOneRadio)application.createComponent(HtmlSelectOneRadio.COMPONENT_TYPE);
ValueBinding  answerBinding = application.createValueBinding(&quot;#{pollPickerBacker.answer}&quot;);             
answer.getChildren().add(getAnswerOptionItems());
answer.setId(&quot;answer&quot;);
answer.setValueBinding(&quot;value&quot;, answerBinding);
children.add(answer);

You cannot make that comparison with out.println() too lightly: we are talking 7 lines of code vs. a very substantial number - in the Servlet approach you need to take care of so many things the UI Components in particular and JSF in general does for you.</description>
		<content:encoded><![CDATA[<p>Dmitry,<br />
In this specific example, that would work. However, as I suggest in the article, there may be cases &#8211; especially when setting up a questionnaire style application &#8211; where the meta-data specifying the page&#8217;s look &amp; feel are more maintained in a database and are much more voluminous and contain much more complicated &#8211; in part dynamically created &#8211; page fragment definitionis. It would be much harder to proactively anticipate al possible pieces of page elements (and their relative sequencing) in a JSP.</p>
<p>I agree that whenever a JSP can get you there with relatively simple (JSTL and EL) logic, it is preferable to defining the UI Components in code. But as soon as the JSP starts to grow fat with lots of if-conditions and repetitions of the same component definitions, resorting to code based run-time manipulation to me is certainly a valuable option.</p>
<p>By the way, how many lines of Servlet code would you need to achieve what this snippet of code does:</p>
<p>UIComponent  answer = (HtmlSelectOneRadio)application.createComponent(HtmlSelectOneRadio.COMPONENT_TYPE);<br />
ValueBinding  answerBinding = application.createValueBinding(&#8220;#{pollPickerBacker.answer}&#8221;);<br />
answer.getChildren().add(getAnswerOptionItems());<br />
answer.setId(&#8220;answer&#8221;);<br />
answer.setValueBinding(&#8220;value&#8221;, answerBinding);<br />
children.add(answer);</p>
<p>You cannot make that comparison with out.println() too lightly: we are talking 7 lines of code vs. a very substantial number &#8211; in the Servlet approach you need to take care of so many things the UI Components in particular and JSF in general does for you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

