<?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>Devon Hillard&#039;s Digital Sanctuary &#187; modal</title>
	<atom:link href="http://www.digitalsanctuary.com/tech-blog/tag/modal/feed" rel="self" type="application/rss+xml" />
	<link>http://www.digitalsanctuary.com/tech-blog</link>
	<description>Java, ATG, Seam, and related Technologies</description>
	<lastBuildDate>Mon, 30 Jan 2012 23:04:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>RichFaces Modal Panels, s:graphicImage, and IE6</title>
		<link>http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/richfaces-modal-panels-sgraphicimage-and-ie6.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/richfaces-modal-panels-sgraphicimage-and-ie6.html#comments</comments>
		<pubDate>Mon, 14 Apr 2008 07:40:38 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[Seam]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[richfaces]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/?p=95</guid>
		<description><![CDATA[If, like me, you are using the Seam s:graphicImage tag to serve an image from within a RichFaces modal panel, you may have run into an issue where in IE6 the image does not get displayed, and you get the &#8230; <a href="http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/richfaces-modal-panels-sgraphicimage-and-ie6.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If, like me, you are using the Seam s:graphicImage tag to serve an image from within a RichFaces modal panel, you may have run into an issue where in IE6 the image does not get displayed, and you get the dreaded red X of failure.  It works fine in all other browsers, including IE7, and works outside of the modal panel, but not from within the modal panel.</p>
<p>It&#8217;s not a problem with the image data (saving the image from another browser and serving it up directly works fine.  I suspect it&#8217;s a delay issue with the rendering of the modal panel.  For me, it was serving up the red X about 90% of the time under IE6.</p>
<p>The &#8220;fix&#8221; is to stop using the s:graphicImage tag within the modal, and use a Servlet to stream out the image data instead.  It&#8217;s pretty easy.</p>
<p>One gotcha I had was that I already had a Servlet handling video output, and I couldn&#8217;t find an example of how to configure two separate paths into the seam web:context-filter Servlet Filter (which allows access to Seam components, like the entity manager to load up the video/image items).  A helpful response on the forums gave me this solution:</p>
<pre lang="xml">
<web:context-filter regex-url-pattern="/image/*|/video/*" />
</pre>
<p>Also, if you&#8217;re struggling to figure out what a library&#8217;s new feature isn&#8217;t working for you, no matter how many permutations of the documented usage you try, check the versions in the manifest files in the library&#8217;s jars.  Maybe, like me, you upgraded the jars in one project, but forgot to upgrade them in this one&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/richfaces-modal-panels-sgraphicimage-and-ie6.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Displaying and Rerendering a RichFaces ModalPanel from a commandLink</title>
		<link>http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/displaying-and-rerendering-a-richfaces-modalpanel-from-a-commandlink.html</link>
		<comments>http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/displaying-and-rerendering-a-richfaces-modalpanel-from-a-commandlink.html#comments</comments>
		<pubDate>Wed, 05 Mar 2008 00:43:45 +0000</pubDate>
		<dc:creator>Devon</dc:creator>
				<category><![CDATA[Seam]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[richfaces]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/displaying-and-rerendering-a-richfaces-modalpanel-from-a-commandlink.html</guid>
		<description><![CDATA[Let's say that when a user clicks on something, perhaps selecting something from a DataTable or DataGrid, you want to call some server side code, and then popup a modal panel which needs to show content based on the new state setup by your server side call.  In my case I have a DataGrid showing a number of items, and when a user clicks on an item I want to set the current selected item on a Seam component on the server, and then popup a modal panel to display detailed information about the item, and provide the user some actions within the modal panel. <a href="http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/displaying-and-rerendering-a-richfaces-modalpanel-from-a-commandlink.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say that when a user clicks on something, perhaps selecting something from a DataTable or DataGrid, you want to call some server side code, and then popup a modal panel which needs to show content based on the new state setup by your server side call.  In my case I have a DataGrid showing a number of items, and when a user clicks on an item I want to set the current selected item on a Seam component on the server, and then popup a modal panel to display detailed information about the item, and provide the user some actions within the modal panel.</p>
<p>Looking at the solution it seems so simple, but for some reason it took me hours of trying different combinations, orders, tags, JavaScripts, etc&#8230; before I could get this to work correctly.  I had the panel appearing with the old data, or appearing with the old data and then disappearing completely, only to show the so called new data the next time I clicked on an item, or rendering on the page itself below the footer, or not popping up at all, or popping up with null data, or&#8230;.  So I&#8217;m posting it up here for myself and anyone else who runs into issues.</p>
<p>First, create your modal panel (rich:modalPanel).  I do this in a separate .xhtml file, as I will use the same model panel in various pages throughout the site.  In your modal-panel.xhtml file (or whatever you choose to name it), start with a <code lang=xml> &lt;ui:composition&gt;</code> tag, define your RichFaces xml namespace (and any other JSF libs you&#8217;ll be using), and then setup your <code>&lt;rich:modalpanel&gt;</code></p>
<p>You need to give the modalPanel a unique id, in this case we&#8217;ll call it &#8220;myModalPanel&#8221;.</p>
<p><code>&lt;rich:modalpanel id="myModalPanel" autosized="true" zindex="2000"&gt;</code></p>
<p>Inside your modalPanel tag, you need to define an inner div.  This is the div which you will be rerendering after the server action is complete.  I use  tags, as I&#8217;m using Seam.  Ensure that any references to backing beans or data that you want refreshed are within these div tags.  You must give this div a unique id as well, in this case we&#8217;ll call it &#8220;myModalDiv&#8221;.</p>
<p><code>&lt;s:div id="myModalDiv"&gt;</code></p>
<p>The one limitation that I&#8217;ve run into here, and if you know how to solve this, please let me know, is that the <code>&lt;f:facet&gt;</code> tags for your header text and controls can&#8217;t be inside this div, and you can&#8217;t put the div around the whole modalPanel (or it makes the panel disappear when you rerender).  As such you can&#8217;t make anything from the <code>&lt;f:facet&gt;</code>s be updated on rerender.  This is preventing me from having the modal panel header displaying the current selected item&#8217;s name.  Not great, but not the end of the world.</p>
<p>So inside this div you have your dynamic output.  I have lots of <code>&lt;h:outputtext value="#{backingBean.selectedItem.property}"&gt;</code> type entries in mine.</p>
<p>On your actual page where you will be displaying the modal panel from you need to include the modal-panel.xhtml file, I use a:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;a:include viewid=&quot;/modal-panel.xhtml&quot;&gt;
</pre>
<p>Then, I have my page, which includes a rich:dataGrid, and inside it has an <code>&lt;a:commandLink&gt;</code> which creates the AJAX clickable item.  This commandLink has to call the backend action, display the modal panel, and rerender your div.</p>
<p><code>&lt;a:commandlink id="showItem" action="#{backingBean.setSelectedItem(item)}" oncomplete="Richfaces.showModalPanel('myModalPanel',{width:550, top:200});" rerender="myModalDiv"&gt;<br />
    Click Here!<br />
&lt;/a:commandlink&gt;</code></p>
<p>This makes the panel display, and then the new content is rendered in the panel.  It seems to work just how I wanted it to.  With the minor annoyance of having to use a static modalPanel header.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.digitalsanctuary.com/tech-blog/java/jboss/seam/displaying-and-rerendering-a-richfaces-modalpanel-from-a-commandlink.html/feed</wfw:commentRss>
		<slash:comments>77</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/11 queries in 0.002 seconds using disk: basic
Object Caching 322/335 objects using disk: basic

Served from: www.digitalsanctuary.com @ 2012-02-06 23:54:37 -->
