<?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>走向云和山的彼端</title>
	<atom:link href="http://www.qiutian.occm.cn/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.qiutian.occm.cn</link>
	<description>世外悠悠隔人间，不忍萋萋乱世烟</description>
	<lastBuildDate>Fri, 27 Aug 2010 08:28:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>JSF中与POPUP(弹出）窗口交换数据的两种方式。</title>
		<link>http://www.qiutian.occm.cn/2010/08/27/jsf%e4%b8%ad%e4%b8%8epopup%e5%bc%b9%e5%87%ba%ef%bc%89%e7%aa%97%e5%8f%a3%e4%ba%a4%e6%8d%a2%e6%95%b0%e6%8d%ae%e7%9a%84%e4%b8%a4%e7%a7%8d%e6%96%b9%e5%bc%8f%e3%80%82/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/27/jsf%e4%b8%ad%e4%b8%8epopup%e5%bc%b9%e5%87%ba%ef%bc%89%e7%aa%97%e5%8f%a3%e4%ba%a4%e6%8d%a2%e6%95%b0%e6%8d%ae%e7%9a%84%e4%b8%a4%e7%a7%8d%e6%96%b9%e5%bc%8f%e3%80%82/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 08:27:19 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[网络开发 [Web-based Development]]]></category>
		<category><![CDATA[form submit]]></category>
		<category><![CDATA[java server face]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[popup window]]></category>
		<category><![CDATA[submit]]></category>
		<category><![CDATA[value]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=80</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' -->

	

很多人都知道，用：popup = window.open(url, name, features);
popup.focus();可以弹出一个新的浏览器的窗口，这是一个十分方便常用的功能。但是如何在JSF中与弹出窗口交换数据？是很多人关心的问题。这里基于Core JSF书中的例子，谈到两个方法，列举到这里，希望对有需求的人有所帮助。</p>
<p>第一种方法较为简单，和所有其他的基于网络编程语言一样，使用URL链接来提交你所需要的变量和变量值。比如我们的例子中，使用：</p>
<p></p>
<p>window.open(&#8220;popup.faces?country=&#8221; + country[i].value, &#8220;popup&#8221;, features);</p>
<p>来将ID为country的控件的值提交为一个叫做country的URL变量。然后在JSF中使用“﻿param.country”来获取这个值。</p>
<p>具体例子实现：</p>
<p>popup1.js&#160;&#160;&#160;function doPopup&#40;source&#41; &#123;
   country = source.form&#91;source.form.id + &#34;:country&#34;&#93;;
   for &#40; var i = 0; i &#60; country.length; i++&#41; &#123;
      if &#40;country&#91;i&#93;.checked&#41; &#123;
         popup = window.open&#40;&#34;popup1.xhtml?country=&#34;
            + country&#91;i&#93;.value, &#34;popup&#34;,
         &#34;height=300,width=200,toolbar=no,menubar=no,&#34;
       [...]]]></description>
			<content:encoded><![CDATA[
<a href="http://www.qiutian.occm.cn/wp-content/gallery/temporary1/27-08-2010-6-01-58-pm.png" title="" class="shutterset_singlepic2" >
	<img class="ngg-singlepic ngg-left" src="http://www.qiutian.occm.cn/wp-content/gallery/cache/2__320x240_27-08-2010-6-01-58-pm.png" alt="27-08-2010-6-01-58-pm" title="27-08-2010-6-01-58-pm" />
</a>
很多人都知道，用：popup = window.open(url, name, features);<br />
popup.focus();可以弹出一个新的浏览器的窗口，这是一个十分方便常用的功能。但是如何在JSF中与弹出窗口交换数据？是很多人关心的问题。这里基于Core JSF书中的例子，谈到两个方法，列举到这里，希望对有需求的人有所帮助。</p>
<p>第一种方法较为简单，和所有其他的基于网络编程语言一样，使用URL链接来提交你所需要的变量和变量值。比如我们的例子中，使用：</p>
<p><span id="more-80"></span></p>
<p>window.open(&#8220;popup.faces?country=&#8221; + country[i].value, &#8220;popup&#8221;, features);</p>
<p>来将ID为country的控件的值提交为一个叫做country的URL变量。然后在JSF中使用“﻿param.country”来获取这个值。</p>
<p>具体例子实现：</p>
<p><div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">popup1.js</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;"><span class="kw2">function</span> doPopup<span class="br0">&#40;</span>source<span class="br0">&#41;</span> <span class="br0">&#123;</span>
   country <span class="sy0">=</span> source.<span class="me1">form</span><span class="br0">&#91;</span>source.<span class="me1">form</span>.<span class="me1">id</span> <span class="sy0">+</span> <span class="st0">&quot;:country&quot;</span><span class="br0">&#93;</span><span class="sy0">;</span>
   <span class="kw1">for</span> <span class="br0">&#40;</span> <span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> country.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>country<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">checked</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
         popup <span class="sy0">=</span> window.<span class="kw3">open</span><span class="br0">&#40;</span><span class="st0">&quot;popup1.xhtml?country=&quot;</span>
            <span class="sy0">+</span> country<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">value</span><span class="sy0">,</span> <span class="st0">&quot;popup&quot;</span><span class="sy0">,</span>
         <span class="st0">&quot;height=300,width=200,toolbar=no,menubar=no,&quot;</span>
               <span class="sy0">+</span> <span class="st0">&quot;scrollbars=yes&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
         popup.<span class="me1">openerFormId</span> <span class="sy0">=</span> source.<span class="me1">form</span>.<span class="me1">id</span><span class="sy0">;</span>
         popup.<span class="kw3">focus</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="br0">&#125;</span>
   <span class="br0">&#125;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="kw2">function</span> doSave<span class="br0">&#40;</span>value<span class="br0">&#41;</span> <span class="br0">&#123;</span>
   <span class="kw2">var</span> formId <span class="sy0">=</span> window.<span class="me1">openerFormId</span><span class="sy0">;</span>
   opener.<span class="me1">document</span>.<span class="me1">forms</span><span class="br0">&#91;</span>formId<span class="br0">&#93;</span><span class="br0">&#91;</span>formId <span class="sy0">+</span> <span class="st0">&quot;:state&quot;</span><span class="br0">&#93;</span>.<span class="me1">value</span> <span class="sy0">=</span> value<span class="sy0">;</span>
   window.<span class="kw3">close</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div></p>
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">technique1.xhtml</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc0">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span>
<span class="sc0">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span class="sc3"><span class="re1">&lt;html</span> <span class="re0">xmlns</span>=<span class="st0">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span class="sc3">      <span class="re0">xmlns:h</span>=<span class="st0">&quot;http://java.sun.com/jsf/html&quot;</span></span>
<span class="sc3">      <span class="re0">xmlns:f</span>=<span class="st0">&quot;http://java.sun.com/jsf/core&quot;</span><span class="re2">&gt;</span></span>
   <span class="sc3"><span class="re1">&lt;h:head<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;h:outputScript</span> <span class="re0">library</span>=<span class="st0">&quot;javascript&quot;</span> <span class="re0">name</span>=<span class="st0">&quot;popup1.js&quot;</span><span class="re2">/&gt;</span></span>
      <span class="sc3"><span class="re1">&lt;title<span class="re2">&gt;</span></span></span>Popup window technique 1<span class="sc3"><span class="re1">&lt;/title<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/h:head<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;h:body<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;h:form<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;table<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;tr<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span></span>Country:<span class="sc3"><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span><span class="re1">&lt;h:selectOneRadio</span> <span class="re0">id</span>=<span class="st0">&quot;country&quot;</span> <span class="re0">value</span>=<span class="st0">&quot;#{bb.country}&quot;</span><span class="re2">&gt;</span></span>
                  <span class="sc3"><span class="re1">&lt;f:selectItem</span> <span class="re0">itemLabel</span>=<span class="st0">&quot;USA&quot;</span> <span class="re0">itemValue</span>=<span class="st0">&quot;USA&quot;</span><span class="re2">/&gt;</span></span>
                  <span class="sc3"><span class="re1">&lt;f:selectItem</span> <span class="re0">itemLabel</span>=<span class="st0">&quot;Canada&quot;</span> <span class="re0">itemValue</span>=<span class="st0">&quot;Canada&quot;</span><span class="re2">/&gt;</span></span>
               <span class="sc3"><span class="re1">&lt;/h:selectOneRadio<span class="re2">&gt;</span></span><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;/tr<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;tr<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span></span>State/Province:<span class="sc3"><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span><span class="re1">&lt;h:inputText</span> <span class="re0">id</span>=<span class="st0">&quot;state&quot;</span> <span class="re0">value</span>=<span class="st0">&quot;#{bb.state}&quot;</span><span class="re2">/&gt;</span><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span><span class="re1">&lt;h:commandButton</span> <span class="re0">value</span>=<span class="st0">&quot;...&quot;</span></span>
<span class="sc3">               <span class="re0">onclick</span>=<span class="st0">&quot;doPopup(this); return false;&quot;</span><span class="re2">/&gt;</span><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;/tr<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;/table<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;p<span class="re2">&gt;</span></span><span class="re1">&lt;h:commandButton</span> <span class="re0">value</span>=<span class="st0">&quot;Next&quot;</span> <span class="re0">action</span>=<span class="st0">&quot;index&quot;</span><span class="re2">/&gt;</span><span class="re1">&lt;/p<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;/h:form<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/h:body<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/html<span class="re2">&gt;</span></span></span></pre></div></div>
<p>这是弹出窗口的内容：</p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">popup1.xhtml</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc0">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span>
<span class="sc0">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span class="sc3"><span class="re1">&lt;html</span> <span class="re0">xmlns</span>=<span class="st0">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span class="sc3">      <span class="re0">xmlns:h</span>=<span class="st0">&quot;http://java.sun.com/jsf/html&quot;</span><span class="re2">&gt;</span></span>
   <span class="sc3"><span class="re1">&lt;h:head<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;h:outputScript</span> <span class="re0">library</span>=<span class="st0">&quot;javascript&quot;</span> <span class="re0">name</span>=<span class="st0">&quot;popup1.js&quot;</span><span class="re2">/&gt;</span></span>
      <span class="sc3"><span class="re1">&lt;title<span class="re2">&gt;</span></span></span>Select a state/province<span class="sc3"><span class="re1">&lt;/title<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/h:head<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;h:body<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;h:form<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;h:dataTable</span> <span class="re0">value</span>=<span class="st0">&quot;#{bb.states[param.country]}&quot;</span> <span class="re0">var</span>=<span class="st0">&quot;state&quot;</span><span class="re2">&gt;</span></span>
            <span class="sc3"><span class="re1">&lt;h:column<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;h:outputLink</span> <span class="re0">value</span>=<span class="st0">&quot;#&quot;</span> <span class="re0">onclick</span>=<span class="st0">&quot;doSave('#{state}');&quot;</span><span class="re2">&gt;</span></span>
                  #{state}
               <span class="sc3"><span class="re1">&lt;/h:outputLink<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;/h:column<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;/h:dataTable<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;/h:form<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/h:body<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/html<span class="re2">&gt;</span></span></span></pre></div></div>
<p>第二种方法，是使用隐藏的表单，并且使用form的&#8221;target&#8221;属性来将值提交到需要的目标。</p>
<p>&lt;h:form id=&#8221;hidden&#8221; target=&#8221;popup&#8221;&gt;<br />
&lt;h:inputHidden id=&#8221;country&#8221; value=&#8221;#{bb.country}&#8221;/&gt;<br />
&lt;h:commandLink id=&#8221;go&#8221; action=&#8221;showStates&#8221;/&gt;<br />
&lt;/h:form&gt;</p>
<p>需要注意的是：</p>
<ul>
<li>Target=&#8221;&#8216;的目标要指向到具体的弹出窗口，这样浏览器才会将你所需要的值提交给你所需要的页面。</li>
<li>bb.country的值，由bb bean来维护</li>
<li>commandlink的action=&#8221;"部分的输出可以用来给JSF navigation<br />
handler做各种判断</li>
</ul>
<p>JS中使用以下方式来获取这个隐藏表单所提交的值：</p>
<p>document.getElementById(&#8220;hidden:country&#8221;).value = country[i].value;<br />
document.getElementById(&#8220;hidden:go&#8221;).onclick(null);</p>
<p>具体实现如下：</p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">technique2.xhtml</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc0">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span>
<span class="sc0">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span class="sc3"><span class="re1">&lt;html</span> <span class="re0">xmlns</span>=<span class="st0">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span class="sc3">      <span class="re0">xmlns:h</span>=<span class="st0">&quot;http://java.sun.com/jsf/html&quot;</span> <span class="re0">xmlns:f</span>=<span class="st0">&quot;http://java.sun.com/jsf/core&quot;</span><span class="re2">&gt;</span></span>
   <span class="sc3"><span class="re1">&lt;h:head<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;h:outputScript</span> <span class="re0">library</span>=<span class="st0">&quot;javascript&quot;</span> <span class="re0">name</span>=<span class="st0">&quot;popup1.js&quot;</span><span class="re2">/&gt;</span></span>
      <span class="sc3"><span class="re1">&lt;title<span class="re2">&gt;</span></span></span>Popup window technique 2<span class="sc3"><span class="re1">&lt;/title<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/h:head<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;h:body<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;h:form<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;table<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;tr<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span></span>Country:<span class="sc3"><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span><span class="re1">&lt;h:selectOneRadio</span> <span class="re0">id</span>=<span class="st0">&quot;country&quot;</span> <span class="re0">value</span>=<span class="st0">&quot;#{bb.country}&quot;</span><span class="re2">&gt;</span></span>
                  <span class="sc3"><span class="re1">&lt;f:selectItem</span> <span class="re0">itemLabel</span>=<span class="st0">&quot;USA&quot;</span> <span class="re0">itemValue</span>=<span class="st0">&quot;USA&quot;</span><span class="re2">/&gt;</span></span>
                  <span class="sc3"><span class="re1">&lt;f:selectItem</span> <span class="re0">itemLabel</span>=<span class="st0">&quot;Canada&quot;</span> <span class="re0">itemValue</span>=<span class="st0">&quot;Canada&quot;</span><span class="re2">/&gt;</span></span>
               <span class="sc3"><span class="re1">&lt;/h:selectOneRadio<span class="re2">&gt;</span></span><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;/tr<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;tr<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span></span>State/Province:<span class="sc3"><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span><span class="re1">&lt;h:inputText</span> <span class="re0">id</span>=<span class="st0">&quot;state&quot;</span> <span class="re0">value</span>=<span class="st0">&quot;#{bb.state}&quot;</span><span class="re2">/&gt;</span><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;td<span class="re2">&gt;</span></span><span class="re1">&lt;h:commandButton</span> <span class="re0">value</span>=<span class="st0">&quot;...&quot;</span></span>
<span class="sc3">               <span class="re0">onclick</span>=<span class="st0">&quot;doPopup(this); return false;&quot;</span><span class="re2">/&gt;</span><span class="re1">&lt;/td<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;/tr<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;/table<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;p<span class="re2">&gt;</span></span><span class="re1">&lt;h:commandButton</span> <span class="re0">value</span>=<span class="st0">&quot;Next&quot;</span> <span class="re0">action</span>=<span class="st0">&quot;index&quot;</span><span class="re2">/&gt;</span><span class="re1">&lt;/p<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;/h:form<span class="re2">&gt;</span></span></span>
&nbsp;
      <span class="sc-1">&lt;!-- This hidden form sends a request to a popup window. --&gt;</span>
      <span class="sc3"><span class="re1">&lt;h:form</span> <span class="re0">id</span>=<span class="st0">&quot;hidden&quot;</span> <span class="re0">target</span>=<span class="st0">&quot;popup&quot;</span><span class="re2">&gt;</span></span>
         <span class="sc3"><span class="re1">&lt;h:inputHidden</span> <span class="re0">id</span>=<span class="st0">&quot;country&quot;</span> <span class="re0">value</span>=<span class="st0">&quot;#{bb.country}&quot;</span><span class="re2">/&gt;</span></span>
         <span class="sc3"><span class="re1">&lt;h:commandLink</span> <span class="re0">id</span>=<span class="st0">&quot;go&quot;</span> <span class="re0">action</span>=<span class="st0">&quot;popup2&quot;</span><span class="re2">/&gt;</span></span>
      <span class="sc3"><span class="re1">&lt;/h:form<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/h:body<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/html<span class="re2">&gt;</span></span></span></pre></div></div>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">popup2.xhtml</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc0">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span>
<span class="sc0">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span class="sc3"><span class="re1">&lt;html</span> <span class="re0">xmlns</span>=<span class="st0">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span class="sc3">      <span class="re0">xmlns:h</span>=<span class="st0">&quot;http://java.sun.com/jsf/html&quot;</span><span class="re2">&gt;</span></span>
   <span class="sc3"><span class="re1">&lt;h:head<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;h:outputScript</span> <span class="re0">library</span>=<span class="st0">&quot;javascript&quot;</span> <span class="re0">name</span>=<span class="st0">&quot;popup1.js&quot;</span><span class="re2">/&gt;</span></span>
      <span class="sc3"><span class="re1">&lt;title<span class="re2">&gt;</span></span></span>Select a state/province<span class="sc3"><span class="re1">&lt;/title<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/h:head<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;h:body<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;h:form<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;h:dataTable</span> <span class="re0">value</span>=<span class="st0">&quot;#{bb.statesForCountry}&quot;</span> <span class="re0">var</span>=<span class="st0">&quot;state&quot;</span><span class="re2">&gt;</span></span>
            <span class="sc3"><span class="re1">&lt;h:column<span class="re2">&gt;</span></span></span>
               <span class="sc3"><span class="re1">&lt;h:outputLink</span> <span class="re0">value</span>=<span class="st0">&quot;#&quot;</span> <span class="re0">onclick</span>=<span class="st0">&quot;doSave('#{state}');&quot;</span><span class="re2">&gt;</span></span>
                  #{state}
               <span class="sc3"><span class="re1">&lt;/h:outputLink<span class="re2">&gt;</span></span></span>
            <span class="sc3"><span class="re1">&lt;/h:column<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;/h:dataTable<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;/h:form<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/h:body<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/html<span class="re2">&gt;</span></span></span></pre></div></div>
<div id="wpshdo_12" class="wp-synhighlighter-outer"><div id="wpshdt_12" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_12"></a><a id="wpshat_12" class="wp-synhighlighter-title" href="#codesyntax_12"  onClick="javascript:wpsh_toggleBlock(12)" title="Click to show/hide code block">popup2.js</a></td><td align="right"><a href="#codesyntax_12" onClick="javascript:wpsh_code(12)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_12" onClick="javascript:wpsh_print(12)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_12" class="wp-synhighlighter-inner" style="display: block;"><pre class="javascript" style="font-family:monospace;"><span class="kw2">function</span> doPopup<span class="br0">&#40;</span>source<span class="br0">&#41;</span> <span class="br0">&#123;</span>
   country <span class="sy0">=</span> source.<span class="me1">form</span><span class="br0">&#91;</span>source.<span class="me1">form</span>.<span class="me1">id</span> <span class="sy0">+</span> <span class="st0">&quot;:country&quot;</span><span class="br0">&#93;</span><span class="sy0">;</span>
   <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> country.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>country<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">checked</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
      popup <span class="sy0">=</span> window.<span class="kw3">open</span><span class="br0">&#40;</span><span class="st0">&quot;&quot;</span><span class="sy0">,</span> <span class="st0">&quot;/faces/popup2.xhtml&quot;</span><span class="sy0">,</span>
         <span class="st0">&quot;height=300,width=200,toolbar=no,menubar=no,scrollbars=yes&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
         popup.<span class="me1">openerFormId</span> <span class="sy0">=</span> source.<span class="me1">form</span>.<span class="me1">id</span><span class="sy0">;</span>
         popup.<span class="kw3">focus</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
         document.<span class="me1">getElementById</span><span class="br0">&#40;</span><span class="st0">&quot;hidden:country&quot;</span><span class="br0">&#41;</span>.<span class="me1">value</span> <span class="sy0">=</span> country<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">value</span><span class="sy0">;</span>
         document.<span class="me1">getElementById</span><span class="br0">&#40;</span><span class="st0">&quot;hidden:go&quot;</span><span class="br0">&#41;</span>.<span class="me1">onclick</span><span class="br0">&#40;</span><span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="br0">&#125;</span>
   <span class="br0">&#125;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="kw2">function</span> doSave<span class="br0">&#40;</span>value<span class="br0">&#41;</span> <span class="br0">&#123;</span>
   <span class="kw2">var</span> formId <span class="sy0">=</span> window.<span class="me1">openerFormId</span><span class="sy0">;</span>
   opener.<span class="me1">document</span>.<span class="me1">forms</span><span class="br0">&#91;</span>formId<span class="br0">&#93;</span><span class="br0">&#91;</span>formId <span class="sy0">+</span> <span class="st0">&quot;:state&quot;</span><span class="br0">&#93;</span>.<span class="me1">value</span> <span class="sy0">=</span> value<span class="sy0">;</span>
   window.<span class="kw3">close</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/27/jsf%e4%b8%ad%e4%b8%8epopup%e5%bc%b9%e5%87%ba%ef%bc%89%e7%aa%97%e5%8f%a3%e4%ba%a4%e6%8d%a2%e6%95%b0%e6%8d%ae%e7%9a%84%e4%b8%a4%e7%a7%8d%e6%96%b9%e5%bc%8f%e3%80%82/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSF中为DataTable增加翻页功能</title>
		<link>http://www.qiutian.occm.cn/2010/08/27/jsf%e4%b8%ad%e4%b8%badatatable%e5%a2%9e%e5%8a%a0%e7%bf%bb%e9%a1%b5%e5%8a%9f%e8%83%bd/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/27/jsf%e4%b8%ad%e4%b8%badatatable%e5%a2%9e%e5%8a%a0%e7%bf%bb%e9%a1%b5%e5%8a%9f%e8%83%bd/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 03:26:44 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[网络开发 [Web-based Development]]]></category>
		<category><![CDATA[翻页]]></category>
		<category><![CDATA[datatable]]></category>
		<category><![CDATA[java server face]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[paging]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=70</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' --><p>初学JSF的大概都会遇到这么个问题，从Bean中将数据读取出来以后，用DataTable在页面上显示。是很常用的数据内容输出的方法，但是DataTable本身没有翻页的功能。如何给DataTable增加翻页呢？这里分享一下CoreJSF 3rd Edition中的pager demo来完成这个数据分页。其思路可以扩展到各种大量数据需要翻页的情况。</p>
<p>不想自己实现这个翻页的朋友，可以使用各种UI Framework中自带的翻页组件。比如Apache Tomahawk 中的 dataScroller 具体实现方法其实和这里要谈到的类似。</p>
<p>OK首先是JSF网页部分：</p>
index.xhtml&#160;&#160;&#160;&#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62;
&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34;
&#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62;
&#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;
      xmlns:h=&#34;http://java.sun.com/jsf/html&#34;
      xmlns:ui=&#34;http://java.sun.com/jsf/facelets&#34;
      xmlns:corejsf=&#34;http://corejsf.com&#34;&#62;
   &#60;h:head&#62;
      &#60;h:outputStylesheet library=&#34;css&#34; name=&#34;styles.css&#34;/&#62;
      &#60;title&#62;Pager Test&#60;/title&#62;
   &#60;/h:head&#62;
   &#60;h:body&#62;
      &#60;ui:debug/&#62;
      &#60;h:form&#62;
         [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.qiutian.occm.cn/wp-content/uploads/2010/08/27-08-2010-12-58-35-PM.png"><img class="alignleft size-medium wp-image-71" title="27-08-2010 12-58-35 PM" src="http://www.qiutian.occm.cn/wp-content/uploads/2010/08/27-08-2010-12-58-35-PM-300x220.png" alt="" width="300" height="220" /></a>初学JSF的大概都会遇到这么个问题，从Bean中将数据读取出来以后，用DataTable在页面上显示。是很常用的数据内容输出的方法，但是DataTable本身没有翻页的功能。如何给DataTable增加翻页呢？这里分享一下CoreJSF 3rd Edition中的pager demo来完成这个数据分页。其思路可以扩展到各种大量数据需要翻页的情况。</p>
<p>不想自己实现这个翻页的朋友，可以使用各种UI Framework中自带的翻页组件。比如Apache Tomahawk 中的 dataScroller 具体实现方法其实和这里要谈到的类似。</p>
<p><span id="more-70"></span>OK首先是JSF网页部分：</p>
<div id="wpshdo_18" class="wp-synhighlighter-outer"><div id="wpshdt_18" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_18"></a><a id="wpshat_18" class="wp-synhighlighter-title" href="#codesyntax_18"  onClick="javascript:wpsh_toggleBlock(18)" title="Click to show/hide code block">index.xhtml</a></td><td align="right"><a href="#codesyntax_18" onClick="javascript:wpsh_code(18)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_18" onClick="javascript:wpsh_print(18)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_18" class="wp-synhighlighter-inner" style="display: block;"><pre class="html4strict" style="font-family:monospace;"><span class="sc2">&lt;?xml <span class="kw3">version</span><span class="sy0">=</span><span class="st0">&quot;1.0&quot;</span> encoding<span class="sy0">=</span><span class="st0">&quot;UTF-8&quot;</span>?&gt;</span>
<span class="sc0">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span>
<span class="sc0">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a> xmlns<span class="sy0">=</span><span class="st0">&quot;http://www.w3.org/1999/xhtml&quot;</span></span>
<span class="sc2">      xmlns:h<span class="sy0">=</span><span class="st0">&quot;http://java.sun.com/jsf/html&quot;</span></span>
<span class="sc2">      xmlns:ui<span class="sy0">=</span><span class="st0">&quot;http://java.sun.com/jsf/facelets&quot;</span></span>
<span class="sc2">      xmlns:corejsf<span class="sy0">=</span><span class="st0">&quot;http://corejsf.com&quot;</span>&gt;</span>
   <span class="sc2">&lt;h:head&gt;</span>
      <span class="sc2">&lt;h:outputStylesheet library<span class="sy0">=</span><span class="st0">&quot;css&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;styles.css&quot;</span><span class="sy0">/</span>&gt;</span>
      <span class="sc2">&lt;<a href="http://december.com/html/4/element/title.html"><span class="kw2">title</span></a>&gt;</span>Pager Test<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/title.html"><span class="kw2">title</span></a>&gt;</span>
   <span class="sc2">&lt;<span class="sy0">/</span>h:head&gt;</span>
   <span class="sc2">&lt;h:body&gt;</span>
      <span class="sc2">&lt;ui:debug<span class="sy0">/</span>&gt;</span>
      <span class="sc2">&lt;h:form&gt;</span>
         <span class="sc2">&lt;h:dataTable <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;timezones&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;#{tz.data}&quot;</span> var<span class="sy0">=</span><span class="st0">&quot;row&quot;</span> <span class="kw3">rows</span><span class="sy0">=</span><span class="st0">&quot;10&quot;</span>&gt;</span>
            <span class="sc2">&lt;h:column&gt;</span>#{row}<span class="sc2">&lt;<span class="sy0">/</span>h:column&gt;</span>
         <span class="sc2">&lt;<span class="sy0">/</span>h:dataTable&gt;</span>
         <span class="sc2">&lt;corejsf:pager dataTableId<span class="sy0">=</span><span class="st0">&quot;timezones&quot;</span> showpages<span class="sy0">=</span><span class="st0">&quot;20&quot;</span></span>
<span class="sc2">                        selectedStyleClass<span class="sy0">=</span><span class="st0">&quot;currentPage&quot;</span><span class="sy0">/</span>&gt;</span>
      <span class="sc2">&lt;<span class="sy0">/</span>h:form&gt;</span>
   <span class="sc2">&lt;<span class="sy0">/</span>h:body&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a>&gt;</span></pre></div></div>
<p>tz这个bean的data是个String[]，其中放了所有的timezone的名称。这里用DataTable将它输出到html页面上。这个表格将会很长，所以我们需要来将其分页化。</p>
<p>TimeZone bean的内容很简单：</p>
<div id="wpshdo_19" class="wp-synhighlighter-outer"><div id="wpshdt_19" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_19"></a><a id="wpshat_19" class="wp-synhighlighter-title" href="#codesyntax_19"  onClick="javascript:wpsh_toggleBlock(19)" title="Click to show/hide code block">TimeZoneBean.java</a></td><td align="right"><a href="#codesyntax_19" onClick="javascript:wpsh_code(19)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_19" onClick="javascript:wpsh_print(19)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_19" class="wp-synhighlighter-inner" style="display: block;"><pre class="java" style="font-family:monospace;"><span class="kw1">package</span> <span class="co2">com.corejsf</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">import</span> <span class="co2">javax.faces.bean.ManagedBean</span><span class="sy0">;</span>
   <span class="co1">// or import javax.inject.Named;</span>
<span class="kw1">import</span> <span class="co2">javax.faces.bean.RequestScoped</span><span class="sy0">;</span>
&nbsp;
@ManagedBean<span class="br0">&#40;</span>name<span class="sy0">=</span><span class="st0">&quot;tz&quot;</span><span class="br0">&#41;</span> <span class="co1">// or @Named(&quot;tz&quot;)</span>
@RequestScoped
<span class="kw1">public</span> <span class="kw1">class</span> TimeZoneBean <span class="br0">&#123;</span>
   <span class="kw1">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#91;</span><span class="br0">&#93;</span> data <span class="sy0">=</span> java.<span class="me1">util</span>.<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Atimezone+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">TimeZone</span></a>.<span class="me1">getAvailableIDs</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
   <span class="kw1">public</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#91;</span><span class="br0">&#93;</span> getData<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="kw1">return</span> data<span class="sy0">;</span> <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>好直到这里都没什么，如果你已经留意前面第一个jsf页面，其中的﻿&lt;corejsf:pager dataTableId=&#8221;timezones&#8221; showpages=&#8221;20&#8243;<br />
selectedStyleClass=&#8221;currentPage&#8221;/&gt;部分，实际就是我们这里的重点了，这是一个定制的Renderer，用这个定制的renderer来控制翻页并且切换DataTable的数据显示。</p>
<p>这里我们的这个翻页Renderer叫“com.corejsf.Pager”该类属于javax.faces.Command。</p>
<p>具体实现方式：</p>
<div id="wpshdo_20" class="wp-synhighlighter-outer"><div id="wpshdt_20" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_20"></a><a id="wpshat_20" class="wp-synhighlighter-title" href="#codesyntax_20"  onClick="javascript:wpsh_toggleBlock(20)" title="Click to show/hide code block">PageRenderer.java</a></td><td align="right"><a href="#codesyntax_20" onClick="javascript:wpsh_code(20)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_20" onClick="javascript:wpsh_print(20)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_20" class="wp-synhighlighter-inner" style="display: block;"><pre class="java" style="font-family:monospace;"><span class="kw1">package</span> <span class="co2">com.corejsf</span><span class="sy0">;</span>
&nbsp;
<span class="kw1">import</span> <span class="co2">java.io.IOException</span><span class="sy0">;</span>
<span class="kw1">import</span> <span class="co2">java.util.Map</span><span class="sy0">;</span>
<span class="kw1">import</span> <span class="co2">javax.faces.component.UIComponent</span><span class="sy0">;</span>
<span class="kw1">import</span> <span class="co2">javax.faces.component.UIData</span><span class="sy0">;</span>
<span class="kw1">import</span> <span class="co2">javax.faces.component.UIForm</span><span class="sy0">;</span>
<span class="kw1">import</span> <span class="co2">javax.faces.context.FacesContext</span><span class="sy0">;</span>
<span class="kw1">import</span> <span class="co2">javax.faces.context.ResponseWriter</span><span class="sy0">;</span>
<span class="kw1">import</span> <span class="co2">javax.faces.render.FacesRenderer</span><span class="sy0">;</span>
<span class="kw1">import</span> <span class="co2">javax.faces.render.Renderer</span><span class="sy0">;</span>
&nbsp;
@FacesRenderer<span class="br0">&#40;</span>componentFamily<span class="sy0">=</span><span class="st0">&quot;javax.faces.Command&quot;</span>,
   rendererType<span class="sy0">=</span><span class="st0">&quot;com.corejsf.Pager&quot;</span><span class="br0">&#41;</span>
<span class="kw1">public</span> <span class="kw1">class</span> PagerRenderer <span class="kw1">extends</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Arenderer+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Renderer</span></a> <span class="br0">&#123;</span>
   <span class="kw1">public</span> <span class="kw4">void</span> encodeBegin<span class="br0">&#40;</span>FacesContext context, UIComponent component<span class="br0">&#41;</span>
      <span class="kw1">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aioexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">IOException</span></a> <span class="br0">&#123;</span>
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> id <span class="sy0">=</span> component.<span class="me1">getClientId</span><span class="br0">&#40;</span>context<span class="br0">&#41;</span><span class="sy0">;</span>
      UIComponent parent <span class="sy0">=</span> component<span class="sy0">;</span>
      <span class="kw1">while</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="br0">&#40;</span>parent <span class="kw1">instanceof</span> UIForm<span class="br0">&#41;</span><span class="br0">&#41;</span> parent <span class="sy0">=</span> parent.<span class="me1">getParent</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> formId <span class="sy0">=</span> parent.<span class="me1">getClientId</span><span class="br0">&#40;</span>context<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
      ResponseWriter writer <span class="sy0">=</span> context.<span class="me1">getResponseWriter</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>    
&nbsp;
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> styleClass <span class="sy0">=</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#41;</span> component.<span class="me1">getAttributes</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;styleClass&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> selectedStyleClass
         <span class="sy0">=</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#41;</span> component.<span class="me1">getAttributes</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;selectedStyleClass&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> dataTableId <span class="sy0">=</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#41;</span> component.<span class="me1">getAttributes</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;dataTableId&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw4">int</span> showpages <span class="sy0">=</span> toInt<span class="br0">&#40;</span>component.<span class="me1">getAttributes</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;showpages&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>      
&nbsp;
      <span class="co1">// find the component with the given ID</span>
&nbsp;
      UIData data <span class="sy0">=</span> <span class="br0">&#40;</span>UIData<span class="br0">&#41;</span> component.<span class="me1">findComponent</span><span class="br0">&#40;</span>dataTableId<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
      <span class="kw4">int</span> first <span class="sy0">=</span> data.<span class="me1">getFirst</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw4">int</span> itemcount <span class="sy0">=</span> data.<span class="me1">getRowCount</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw4">int</span> pagesize <span class="sy0">=</span> data.<span class="me1">getRows</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>pagesize <span class="sy0">&lt;=</span> 0<span class="br0">&#41;</span> pagesize <span class="sy0">=</span> itemcount<span class="sy0">;</span>
&nbsp;
      <span class="kw4">int</span> pages <span class="sy0">=</span> itemcount <span class="sy0">/</span> pagesize<span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>itemcount <span class="sy0">%</span> pagesize <span class="sy0">!=</span> 0<span class="br0">&#41;</span> pages<span class="sy0">++;</span>
&nbsp;
      <span class="kw4">int</span> currentPage <span class="sy0">=</span> first <span class="sy0">/</span> pagesize<span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>first <span class="sy0">&gt;=</span> itemcount <span class="sy0">-</span> pagesize<span class="br0">&#41;</span> currentPage <span class="sy0">=</span> pages <span class="sy0">-</span> <span class="nu0">1</span><span class="sy0">;</span>
      <span class="kw4">int</span> startPage <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span>
      <span class="kw4">int</span> endPage <span class="sy0">=</span> pages<span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>showpages <span class="sy0">&gt;</span> 0<span class="br0">&#41;</span> <span class="br0">&#123;</span>
         startPage <span class="sy0">=</span> <span class="br0">&#40;</span>currentPage <span class="sy0">/</span> showpages<span class="br0">&#41;</span> <span class="sy0">*</span> showpages<span class="sy0">;</span>
         endPage <span class="sy0">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Amath+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Math</span></a>.<span class="me1">min</span><span class="br0">&#40;</span>startPage <span class="sy0">+</span> showpages, pages<span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="br0">&#125;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>currentPage <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span>
         writeLink<span class="br0">&#40;</span>writer, component, formId, id, <span class="st0">&quot;&lt;&quot;</span>, styleClass<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
      <span class="kw1">if</span> <span class="br0">&#40;</span>startPage <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span>
         writeLink<span class="br0">&#40;</span>writer, component, formId, id, <span class="st0">&quot;&lt;&lt;&quot;</span>, styleClass<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
      <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> i <span class="sy0">=</span> startPage<span class="sy0">;</span> i <span class="sy0">&lt;</span> endPage<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
         writeLink<span class="br0">&#40;</span>writer, component, formId, id, <span class="st0">&quot;&quot;</span> <span class="sy0">+</span> <span class="br0">&#40;</span>i <span class="sy0">+</span> 1<span class="br0">&#41;</span>,
            i <span class="sy0">==</span> currentPage <span class="sy0">?</span> selectedStyleClass <span class="sy0">:</span> styleClass<span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="br0">&#125;</span>
&nbsp;
      <span class="kw1">if</span> <span class="br0">&#40;</span>endPage <span class="sy0">&lt;</span> pages<span class="br0">&#41;</span>
         writeLink<span class="br0">&#40;</span>writer, component, formId, id, <span class="st0">&quot;&gt;&gt;&quot;</span>, styleClass<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
      <span class="kw1">if</span> <span class="br0">&#40;</span>first <span class="sy0">&lt;</span> itemcount <span class="sy0">-</span> pagesize<span class="br0">&#41;</span>
         writeLink<span class="br0">&#40;</span>writer, component, formId, id, <span class="st0">&quot;&gt;&quot;</span>, styleClass<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
      <span class="co1">// hidden field to hold result</span>
      writeHiddenField<span class="br0">&#40;</span>writer, component, id<span class="br0">&#41;</span><span class="sy0">;</span>
   <span class="br0">&#125;</span>
&nbsp;
   <span class="kw1">private</span> <span class="kw4">void</span> writeLink<span class="br0">&#40;</span>ResponseWriter writer, UIComponent component,
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> formId, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> id, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> value, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> styleClass<span class="br0">&#41;</span>
      <span class="kw1">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aioexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">IOException</span></a> <span class="br0">&#123;</span>
      writer.<span class="me1">writeText</span><span class="br0">&#40;</span><span class="st0">&quot; &quot;</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span>
      writer.<span class="me1">startElement</span><span class="br0">&#40;</span><span class="st0">&quot;a&quot;</span>, component<span class="br0">&#41;</span><span class="sy0">;</span>
      writer.<span class="me1">writeAttribute</span><span class="br0">&#40;</span><span class="st0">&quot;href&quot;</span>, <span class="st0">&quot;#&quot;</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span>
      writer.<span class="me1">writeAttribute</span><span class="br0">&#40;</span><span class="st0">&quot;onclick&quot;</span>, onclickCode<span class="br0">&#40;</span>formId, id, value<span class="br0">&#41;</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>styleClass <span class="sy0">!=</span> <span class="kw2">null</span><span class="br0">&#41;</span>
         writer.<span class="me1">writeAttribute</span><span class="br0">&#40;</span><span class="st0">&quot;class&quot;</span>, styleClass, <span class="st0">&quot;styleClass&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      writer.<span class="me1">writeText</span><span class="br0">&#40;</span>value, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span>
      writer.<span class="me1">endElement</span><span class="br0">&#40;</span><span class="st0">&quot;a&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
   <span class="br0">&#125;</span>
&nbsp;
   <span class="kw1">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> onclickCode<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> formId, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> id, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> value<span class="br0">&#41;</span> <span class="br0">&#123;</span>
      <span class="kw1">return</span> <span class="kw1">new</span> StringBuilder<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">append</span><span class="br0">&#40;</span><span class="st0">&quot;document.forms['&quot;</span><span class="br0">&#41;</span>
         .<span class="me1">append</span><span class="br0">&#40;</span>formId<span class="br0">&#41;</span>.<span class="me1">append</span><span class="br0">&#40;</span><span class="st0">&quot;']['&quot;</span><span class="br0">&#41;</span>
         .<span class="me1">append</span><span class="br0">&#40;</span>id<span class="br0">&#41;</span>.<span class="me1">append</span><span class="br0">&#40;</span><span class="st0">&quot;'].value='&quot;</span><span class="br0">&#41;</span>.<span class="me1">append</span><span class="br0">&#40;</span>value<span class="br0">&#41;</span>.<span class="me1">append</span><span class="br0">&#40;</span><span class="st0">&quot;'; document.forms['&quot;</span><span class="br0">&#41;</span>
         .<span class="me1">append</span><span class="br0">&#40;</span>formId<span class="br0">&#41;</span>.<span class="me1">append</span><span class="br0">&#40;</span><span class="st0">&quot;'].submit(); return false;&quot;</span><span class="br0">&#41;</span>.<span class="me1">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
   <span class="br0">&#125;</span>
&nbsp;
   <span class="kw1">private</span> <span class="kw4">void</span> writeHiddenField<span class="br0">&#40;</span>ResponseWriter writer, UIComponent component,
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> id<span class="br0">&#41;</span> <span class="kw1">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aioexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">IOException</span></a> <span class="br0">&#123;</span>
      writer.<span class="me1">startElement</span><span class="br0">&#40;</span><span class="st0">&quot;input&quot;</span>, component<span class="br0">&#41;</span><span class="sy0">;</span>
      writer.<span class="me1">writeAttribute</span><span class="br0">&#40;</span><span class="st0">&quot;type&quot;</span>, <span class="st0">&quot;hidden&quot;</span>, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span>
      writer.<span class="me1">writeAttribute</span><span class="br0">&#40;</span><span class="st0">&quot;name&quot;</span>, id, <span class="kw2">null</span><span class="br0">&#41;</span><span class="sy0">;</span>
      writer.<span class="me1">endElement</span><span class="br0">&#40;</span><span class="st0">&quot;input&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
   <span class="br0">&#125;</span>
&nbsp;
   <span class="kw1">public</span> <span class="kw4">void</span> decode<span class="br0">&#40;</span>FacesContext context, UIComponent component<span class="br0">&#41;</span> <span class="br0">&#123;</span>
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> id <span class="sy0">=</span> component.<span class="me1">getClientId</span><span class="br0">&#40;</span>context<span class="br0">&#41;</span><span class="sy0">;</span>
      Map<span class="sy0">&lt;</span>String, String<span class="sy0">&gt;</span> parameters
         <span class="sy0">=</span> context.<span class="me1">getExternalContext</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getRequestParameterMap</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> response <span class="sy0">=</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#41;</span> parameters.<span class="me1">get</span><span class="br0">&#40;</span>id<span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>response <span class="sy0">==</span> <span class="kw2">null</span> <span class="sy0">||</span> response.<span class="me1">equals</span><span class="br0">&#40;</span><span class="st0">&quot;&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">return</span><span class="sy0">;</span> 
&nbsp;
      <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a> dataTableId <span class="sy0">=</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#41;</span> component.<span class="me1">getAttributes</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;dataTableId&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw4">int</span> showpages <span class="sy0">=</span> toInt<span class="br0">&#40;</span>component.<span class="me1">getAttributes</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&quot;showpages&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>      
&nbsp;
      UIData data <span class="sy0">=</span> <span class="br0">&#40;</span>UIData<span class="br0">&#41;</span> component.<span class="me1">findComponent</span><span class="br0">&#40;</span>dataTableId<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
      <span class="kw4">int</span> first <span class="sy0">=</span> data.<span class="me1">getFirst</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw4">int</span> itemcount <span class="sy0">=</span> data.<span class="me1">getRowCount</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw4">int</span> pagesize <span class="sy0">=</span> data.<span class="me1">getRows</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>pagesize <span class="sy0">&lt;=</span> 0<span class="br0">&#41;</span> pagesize <span class="sy0">=</span> itemcount<span class="sy0">;</span>
&nbsp;
      <span class="kw1">if</span> <span class="br0">&#40;</span>response.<span class="me1">equals</span><span class="br0">&#40;</span><span class="st0">&quot;&lt;&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> first <span class="sy0">-=</span> pagesize<span class="sy0">;</span>
      <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>response.<span class="me1">equals</span><span class="br0">&#40;</span><span class="st0">&quot;&gt;&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> first <span class="sy0">+=</span> pagesize<span class="sy0">;</span>
      <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>response.<span class="me1">equals</span><span class="br0">&#40;</span><span class="st0">&quot;&lt;&lt;&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> first <span class="sy0">-=</span> pagesize <span class="sy0">*</span> showpages<span class="sy0">;</span>
      <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>response.<span class="me1">equals</span><span class="br0">&#40;</span><span class="st0">&quot;&gt;&gt;&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> first <span class="sy0">+=</span> pagesize <span class="sy0">*</span> showpages<span class="sy0">;</span>
      <span class="kw1">else</span> <span class="br0">&#123;</span>
         <span class="kw4">int</span> page <span class="sy0">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Integer</span></a>.<span class="me1">parseInt</span><span class="br0">&#40;</span>response<span class="br0">&#41;</span><span class="sy0">;</span>
         first <span class="sy0">=</span> <span class="br0">&#40;</span>page <span class="sy0">-</span> 1<span class="br0">&#41;</span> <span class="sy0">*</span> pagesize<span class="sy0">;</span>
      <span class="br0">&#125;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>first <span class="sy0">+</span> pagesize <span class="sy0">&gt;</span> itemcount<span class="br0">&#41;</span> first <span class="sy0">=</span> itemcount <span class="sy0">-</span> pagesize<span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>first <span class="sy0">&lt;</span> 0<span class="br0">&#41;</span> first <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span>
      data.<span class="me1">setFirst</span><span class="br0">&#40;</span>first<span class="br0">&#41;</span><span class="sy0">;</span>
   <span class="br0">&#125;</span>
&nbsp;
   <span class="kw1">private</span> <span class="kw1">static</span> <span class="kw4">int</span> toInt<span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Object</span></a> value<span class="br0">&#41;</span> <span class="br0">&#123;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>value <span class="sy0">==</span> <span class="kw2">null</span><span class="br0">&#41;</span> <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>value <span class="kw1">instanceof</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Anumber+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Number</span></a><span class="br0">&#41;</span> <span class="kw1">return</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Anumber+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Number</span></a><span class="br0">&#41;</span> value<span class="br0">&#41;</span>.<span class="me1">intValue</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw1">if</span> <span class="br0">&#40;</span>value <span class="kw1">instanceof</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#41;</span> <span class="kw1">return</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">Integer</span></a>.<span class="me1">parseInt</span><span class="br0">&#40;</span><span class="br0">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">String</span></a><span class="br0">&#41;</span> value<span class="br0">&#41;</span><span class="sy0">;</span>
      <span class="kw1">throw</span> <span class="kw1">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aillegalargumentexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span class="kw3">IllegalArgumentException</span></a><span class="br0">&#40;</span><span class="st0">&quot;Cannot convert &quot;</span> <span class="sy0">+</span> value<span class="br0">&#41;</span><span class="sy0">;</span>
   <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>配置方面还需要：</p>
<div id="wpshdo_21" class="wp-synhighlighter-outer"><div id="wpshdt_21" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_21"></a><a id="wpshat_21" class="wp-synhighlighter-title" href="#codesyntax_21"  onClick="javascript:wpsh_toggleBlock(21)" title="Click to show/hide code block">web.xml</a></td><td align="right"><a href="#codesyntax_21" onClick="javascript:wpsh_code(21)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_21" onClick="javascript:wpsh_print(21)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_21" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc3"><span class="re1">&lt;web-app</span> <span class="re0">xmlns:xsi</span>=<span class="st0">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span class="sc3">   <span class="re0">xmlns</span>=<span class="st0">&quot;http://java.sun.com/xml/ns/javaee&quot;</span></span>
<span class="sc3">   <span class="re0">xmlns:web</span>=<span class="st0">&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;</span></span>
<span class="sc3">   <span class="re0">xsi:schemaLocation</span>=<span class="st0">&quot;http://java.sun.com/xml/ns/javaee</span>
<span class="sc3">      http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;</span></span>
<span class="sc3">   <span class="re0">version</span>=<span class="st0">&quot;2.5&quot;</span><span class="re2">&gt;</span></span>
   <span class="sc3"><span class="re1">&lt;servlet<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;servlet-name<span class="re2">&gt;</span></span></span>Faces Servlet<span class="sc3"><span class="re1">&lt;/servlet-name<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;servlet-class<span class="re2">&gt;</span></span></span>javax.faces.webapp.FacesServlet<span class="sc3"><span class="re1">&lt;/servlet-class<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/servlet<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;servlet-mapping<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;servlet-name<span class="re2">&gt;</span></span></span>Faces Servlet<span class="sc3"><span class="re1">&lt;/servlet-name<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;url-pattern<span class="re2">&gt;</span></span></span>/faces/*<span class="sc3"><span class="re1">&lt;/url-pattern<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/servlet-mapping<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;welcome-file-list<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;welcome-file<span class="re2">&gt;</span></span></span>faces/index.xhtml<span class="sc3"><span class="re1">&lt;/welcome-file<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/welcome-file-list<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;context-param<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;param-name<span class="re2">&gt;</span></span></span>javax.faces.PROJECT_STAGE<span class="sc3"><span class="re1">&lt;/param-name<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;param-value<span class="re2">&gt;</span></span></span>Development<span class="sc3"><span class="re1">&lt;/param-value<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/context-param<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;context-param<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;param-name<span class="re2">&gt;</span></span></span>javax.faces.FACELETS_LIBRARIES<span class="sc3"><span class="re1">&lt;/param-name<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;param-value<span class="re2">&gt;</span></span></span>/WEB-INF/corejsf.taglib.xml<span class="sc3"><span class="re1">&lt;/param-value<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/context-param<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/web-app<span class="re2">&gt;</span></span></span></pre></div></div>
<div id="wpshdo_22" class="wp-synhighlighter-outer"><div id="wpshdt_22" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_22"></a><a id="wpshat_22" class="wp-synhighlighter-title" href="#codesyntax_22"  onClick="javascript:wpsh_toggleBlock(22)" title="Click to show/hide code block">corejsf.taglib.xml</a></td><td align="right"><a href="#codesyntax_22" onClick="javascript:wpsh_code(22)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_22" onClick="javascript:wpsh_print(22)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_22" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=<span class="st0">&quot;UTF-8&quot;</span><span class="re2">?&gt;</span></span>
<span class="sc3"><span class="re1">&lt;facelet-taglib</span> <span class="re0">version</span>=<span class="st0">&quot;2.0&quot;</span></span>
<span class="sc3">   <span class="re0">xmlns</span>=<span class="st0">&quot;http://java.sun.com/xml/ns/javaee&quot;</span></span>
<span class="sc3">   <span class="re0">xmlns:xsi</span>=<span class="st0">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span class="sc3">   <span class="re0">xsi:schemaLocation</span>=<span class="st0">&quot;http://java.sun.com/xml/ns/javaee</span>
<span class="sc3">   http://java.sun.com/xml/ns/javaee/web-facelettaglibary_2_0.xsd&quot;</span><span class="re2">&gt;</span></span>
   <span class="sc3"><span class="re1">&lt;namespace<span class="re2">&gt;</span></span></span>http://corejsf.com<span class="sc3"><span class="re1">&lt;/namespace<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;tag<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;tag-name<span class="re2">&gt;</span></span></span>pager<span class="sc3"><span class="re1">&lt;/tag-name<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;component<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;component-type<span class="re2">&gt;</span></span></span>javax.faces.Command<span class="sc3"><span class="re1">&lt;/component-type<span class="re2">&gt;</span></span></span>
         <span class="sc3"><span class="re1">&lt;renderer-type<span class="re2">&gt;</span></span></span>com.corejsf.Pager<span class="sc3"><span class="re1">&lt;/renderer-type<span class="re2">&gt;</span></span></span>
      <span class="sc3"><span class="re1">&lt;/component<span class="re2">&gt;</span></span></span>
   <span class="sc3"><span class="re1">&lt;/tag<span class="re2">&gt;</span></span></span>
<span class="sc3"><span class="re1">&lt;/facelet-taglib<span class="re2">&gt;</span></span></span></pre></div></div>
<p>具体实现如图，代码在tomcat 6.0.29 x64测试通过。</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/27/jsf%e4%b8%ad%e4%b8%badatatable%e5%a2%9e%e5%8a%a0%e7%bf%bb%e9%a1%b5%e5%8a%9f%e8%83%bd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Five tips to convert more customers</title>
		<link>http://www.qiutian.occm.cn/2010/08/23/five-tips-to-convert-more-customers/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/23/five-tips-to-convert-more-customers/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 07:41:52 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[商业金融]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=68</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' --><p>By Netregistry</p>

If you’ve opened your ecommerce store and are ready to sell online, one of the biggest
challenges is trying to convince site visitors to become customers. The internet is a browsing
medium, allowing potential customers to flit from online store to online store, looking for the
cheapest price or best bargain, until they decide to make a purchase. Therefore, it is important
to provide an online store that recognises this.

Unlike the real world, where the presence of a helpful sales assistant can sometimes [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.netregistry.com.au">By Netregistry</a></p>
<div id="_mcePaste">
<div id="_mcePaste">If you’ve opened your ecommerce store and are ready to sell online, one of the biggest</div>
<div id="_mcePaste">challenges is trying to convince site visitors to become customers. The internet is a browsing</div>
<div id="_mcePaste">medium, allowing potential customers to flit from online store to online store, looking for the</div>
<div id="_mcePaste">cheapest price or best bargain, until they decide to make a purchase. Therefore, it is important</div>
<div id="_mcePaste">to provide an online store that recognises this.</div>
<div></div>
<div id="_mcePaste">Unlike the real world, where the presence of a helpful sales assistant can sometimes close a</div>
<div id="_mcePaste">sale on a wavering store visitor, the internet has a back button that makes it far easier for your</div>
<div id="_mcePaste">visitors to leave your store quickly and anonymously. So how do you close those sales?</div>
</div>
<div></div>
<div>
<h2>Keep it simple</h2>
<div></div>
<div>Most people shop online for convenience, so it is imperative that your online store has an</div>
<div>easy purchasing process. Don’t overcomplicate your online store by using forms, requiring</div>
<div>registration or using complex navigation if you don’t have to. Always ensure a customer can</div>
<div>click a button at any time to go straight to a purchase.</div>
<div></div>
<h2>Secure and easy payments</h2>
<div></div>
<div>One of the biggest worries to internet shoppers is the security of their credit card details when</div>
<div>buying their online bargains.</div>
<div>By ordering a dedicated or shared SSL certificate from Netregistry, you can show your</div>
<div>customers their payment transactions are safely encrypted to protect their valuable information.</div>
<div></div>
<div><span id="more-68"></span></div>
<div></div>
<h2>Landing pages that sell</h2>
<div></div>
<div>Visitors may arrive at your online store through a variety of routes, meaning they may land</div>
<div>on different pages of your website.</div>
<div>Because of this, ensure each relevant landing page is focussed on closing that particular</div>
<div>sale. The internet is about instant gratification, so reward a visitor searching for your</div>
<div>bargains with a quick response to their needs. Each landing page should be designed</div>
<div>to provide a simple ‘one click sale’ if at all possible, providing an instant solution to the</div>
<div>visitor’s request, whilst removing clutter. Take the visitor by the hand and lead them where</div>
<div>you want them to go.</div>
<div></div>
<h2>Make them an offer they can’t refuse</h2>
<div></div>
<div>That’s what Domino Pizza did when they entered the competitive pizza home delivery</div>
<div>market with their “30 minutes or it’s free” campaign. What can your online store offer to</div>
<div>encourage customers to buy from you instead of any of the other online stores fighting for</div>
<div>their attention; cheap deals on fast delivery, a money-back guarantee, free upgrades?</div>
<div>The online shopping world is different to the high street, where your shop is only</div>
<div>competing with sellers in the local area. Online, a customer can visit numerous stores in</div>
<div>minutes to compare prices and deals, increasing competition dramatically. Ensure your</div>
<div>offer stands out from the rest.</div>
<div></div>
<h2>Have postage and shipping alternatives advertised up front</h2>
<div></div>
<div>It is common for customers to abandon a purchase at the very last page of the payment</div>
<div>process once the postage is factored into the overall price, catching them by surprise. By</div>
<div>offering fair postage rates up front, you allow a customer to effectively assess the value of</div>
<div>buying through your store.</div>
<div>Offer alternative methods of postage, where possible. Some online stores offer delivery only by</div>
<div>courier, or other expensive methods, which can turn customers away. Courier costs can more</div>
<div>than double the price of an item in some cases, immediately short-circuiting a sale. Ensure</div>
<div>every product on your website has a cost-effective postage solution that makes the whole</div>
<div>package attractive to the buyer.</div>
</div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/23/five-tips-to-convert-more-customers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make your customers love you</title>
		<link>http://www.qiutian.occm.cn/2010/08/23/how-to-make-your-customers-love-you/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/23/how-to-make-your-customers-love-you/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 07:33:48 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[商业金融]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=65</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' -->
In a bricks-and-mortar store, customers can be served with a smile and a helping hand.


However, in the online world, there are many other factors to consider, such as dealing with postage and delivery issues and handling online queries. Luke Telford talks with two people from online stores about the challenges they face and how they use their service strategies to ensure their customers are taken care of online, all the time.

</p>
Monsterthreads: tailoring your style
“Effective communication is essential in business, and [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">
<div id="_mcePaste"><strong>In a bricks-and-mortar store, customers can be served with a smile and a helping hand.</strong></div>
<div id="_mcePaste"><strong><br />
</strong></div>
<div id="_mcePaste"><strong>However, in the online world, there are many other factors to consider, such as dealing with postage and delivery issues and handling online queries. Luke Telford talks with two people from online stores about the challenges they face and how they use their service strategies to ensure their customers are taken care of online, all the time.</strong></div>
<div></div>
<div><strong></p>
<h2><span style="font-weight: normal;">Monsterthreads: tailoring your style</span></h2>
<div><span style="font-weight: normal;">“Effective communication is essential in business, and the internet is essential for connecting with the public, especially gen X and Y,” says Mark Mamrot, CEO and owner of online t-shirt retailer Monsterthreads.</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;"> “Online and face-to-face customers have strong service expectations, and your ability to meet those expectations shapes their perception of you. In a physical shop, customers can judge the quality of your business by many elements but online, the interaction is often limited to a relatively static website. Your responsiveness, therefore, is crucial to the customer’s experience.</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;">“When dealing with customers online, responsiveness is definitely an important factor. However, manner is also crucial. It will vary from business to business – for a company such as ours, customers need to be treated with a personal touch. We treat our customers as we would treat our friends, and often go beyond our obligations to keep them satisfied and maintain the personality of the Monsterthreads brand.</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;">“Of course, we do accommodate customer feedback. We have a ‘comments and feedback’ field integrated into our order process, and we use mailing list software with a return address. We also perform periodic satisfaction surveys. Most importantly, we act on what we learn from those surveys.</span></div>
<div></div>
<div><span style="font-weight: normal;"><span id="more-65"></span><br />
</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;">“Every bit of feedback receives a reply, whether it’s a thank-you, an apology or an explanation. When you deal with thousands of customers, you will encounter a diverse range of people, including some with unreasonable expectations. It’s important to understand that not everyone can be utterly satisfied with your product, especially with a product as personal as garments. However, just about everyone can be satisfied with your customer service effort.’</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<h2><span style="font-weight: normal;">Mag Nation: grasping the leap of faith</span></h2>
<div><span style="font-weight: normal;">“The willingness of customers to shop online means we’re not just competing with the newsagent up the block; we’re also competing with newsagents in Perth, as well as Amazon and other online magazine stores,” explains Oliver Palmer, online operator of MagNation.com.au.</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;"> “Customer service is paramount when other retailers are willing to deliver the same product at a similar price. Word of mouth is exponentially quicker than it was even five years ago. Tony Hsieh from online clothing store Zappos said that they’re not in the retail business so much as the customer service business, and we agree with this wholeheartedly.</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;">“It’s hard to put a figure on how much time we spend interacting with customers but we keep a keen eye on Facebook and Twitter and make a point of responding to comments and tweets. Our customers have come to view our social media presence as a resource where they find out about new magazines or when titles are coming into our stores, and that’s not only useful for them but it’s also a great way for us to keep in touch with demand and shifting trends.</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;"> “We don’t have any complicated CRM systems to handle feedback; everything we use is off-the-shelf. Email, Twitter, Facebook and our blog runs on WordPress. We have a contact form on our website and get a lot of feedback via Facebook and tweets.</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;">“Some essential elements for good customer service involve open communication and delivering what you promise. If something goes wrong, be honest and do whatever it takes to fix it.</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;">“An anonymous commenter recently spammed seven of our most recent blog posts, accusing us of a litany of crimes. We decided to publish the comment in its entirety on a dedicated post and to debunk each of their accusations one by one. In this case, many of our customers sprang to our defence.</span></div>
<div><span style="font-weight: normal;"><br />
</span></div>
<div><span style="font-weight: normal;">It took us a while to realise something that’s seemingly obvious – our customers online are taking a leap of faith by purchasing from us, or indeed any online store. They’re giving us their money upfront for a product that will be delivered over the course of an entire year and as a result, they often need a bit more care than in-store customers.”</span></div>
<p></strong></div>
</div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/23/how-to-make-your-customers-love-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2010 CWE/SANS Top 25 Most Dangerous Software Errors</title>
		<link>http://www.qiutian.occm.cn/2010/08/23/2010-cwesans-top-25-most-dangerous-software-errors/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/23/2010-cwesans-top-25-most-dangerous-software-errors/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 07:28:55 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=62</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' --><p>http://cwe.mitre.org/top25/#Listing</p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://cwe.mitre.org/top25/#Listing">http://cwe.mitre.org/top25/#Listing</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/23/2010-cwesans-top-25-most-dangerous-software-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>让Alfresco Explorer中表单提交后不回到页面顶端</title>
		<link>http://www.qiutian.occm.cn/2010/08/18/%e8%ae%a9alfresco%e7%9a%84alfresco-explorer%e8%a1%a8%e6%a0%bc%e6%8f%90%e4%ba%a4%e5%90%8e%e4%b8%8d%e5%9b%9e%e5%88%b0%e9%a1%b6%e7%ab%af/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/18/%e8%ae%a9alfresco%e7%9a%84alfresco-explorer%e8%a1%a8%e6%a0%bc%e6%8f%90%e4%ba%a4%e5%90%8e%e4%b8%8d%e5%9b%9e%e5%88%b0%e9%a1%b6%e7%ab%af/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 09:56:07 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[网络开发 [Web-based Development]]]></category>
		<category><![CDATA[alfresco]]></category>
		<category><![CDATA[Alfresco Explorer]]></category>
		<category><![CDATA[auto scrolling]]></category>
		<category><![CDATA[form submit]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=54</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' --><p>无论新的surf怎么好，起码现在还仍然不太成熟，老的Alfresco Explorer虽然技术较为落后，但是功能和各方面仍然比新的UI成熟很多。</p>
<p>如果你经常使用alfresco explorer来进行文档和记录管理和编辑，你会发现当你在同一个页面中有多个form的时候，每次form提交该页面都会自动回到首页，如果你的页面很长，这个问题很是烦人。（其实在使用ajax list or space or whatever picker等UI的时候都会有同样的问题，增加和删除项后form提交会导致页面回到顶端）</p>
<p>在alfresco.war的web.xml中有一个项可以修复该问题。编辑web.xml，找到：</p>
Source code&#160;&#160;&#160;&#60;context-param&#62;
        &#60;param-name&#62;org.apache.myfaces.AUTO_SCROLL&#60;/param-name&#62;
        &#60;param-value&#62;true&#60;/param-value&#62;
        &#60;description&#62;
            If true, a javascript function will be rendered that is able to restore the
            former vertical scroll on every request. Convenient feature if you [...]]]></description>
			<content:encoded><![CDATA[<p>无论新的surf怎么好，起码现在还仍然不太成熟，老的Alfresco Explorer虽然技术较为落后，但是功能和各方面仍然比新的UI成熟很多。</p>
<p>如果你经常使用alfresco explorer来进行文档和记录管理和编辑，你会发现当你在同一个页面中有多个form的时候，每次form提交该页面都会自动回到首页，如果你的页面很长，这个问题很是烦人。（其实在使用ajax list or space or whatever picker等UI的时候都会有同样的问题，增加和删除项后form提交会导致页面回到顶端）</p>
<p>在alfresco.war的web.xml中有一个项可以修复该问题。编辑web.xml，找到：</p>
<div id="wpshdo_24" class="wp-synhighlighter-outer"><div id="wpshdt_24" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_24"></a><a id="wpshat_24" class="wp-synhighlighter-title" href="#codesyntax_24"  onClick="javascript:wpsh_toggleBlock(24)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_24" onClick="javascript:wpsh_code(24)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_24" onClick="javascript:wpsh_print(24)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_24" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;context-param<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;param-name<span class="re2">&gt;</span></span></span>org.apache.myfaces.AUTO_SCROLL<span class="sc3"><span class="re1">&lt;/param-name<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;param-value<span class="re2">&gt;</span></span></span>true<span class="sc3"><span class="re1">&lt;/param-value<span class="re2">&gt;</span></span></span>
        <span class="sc3"><span class="re1">&lt;description<span class="re2">&gt;</span></span></span>
            If true, a javascript function will be rendered that is able to restore the
            former vertical scroll on every request. Convenient feature if you have pages
            with long lists and you do not want the browser page to always jump to the top
            if you trigger a link or button action that stays on the same page.
            Default: &quot;false&quot;
        <span class="sc3"><span class="re1">&lt;/description<span class="re2">&gt;</span></span></span>
    <span class="sc3"><span class="re1">&lt;/context-param<span class="re2">&gt;</span></span></span></pre></div></div>
<p>3.2r2中没编辑过的话在56-66行，将其中的param-value 由 false改为ture就可以了。</p>
<p>修改后使用myface auto scrolling功能记录你上次的位置，方便了许多。</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/18/%e8%ae%a9alfresco%e7%9a%84alfresco-explorer%e8%a1%a8%e6%a0%bc%e6%8f%90%e4%ba%a4%e5%90%8e%e4%b8%8d%e5%9b%9e%e5%88%b0%e9%a1%b6%e7%ab%af/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>5 easy ways to keep your customers</title>
		<link>http://www.qiutian.occm.cn/2010/08/16/5-easy-ways-to-keep-your-customers/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/16/5-easy-ways-to-keep-your-customers/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 06:13:03 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[商业金融]]></category>
		<category><![CDATA[CRM]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=49</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' --><p>

	

David Binning</p>
<p>3 August 2010</p>
<p>The more useful information you know about your customers, the better you can understand and address their needs.</p>
<p>Chosen carefully and implemented intelligently, a customer relationship management (CRM) system can help you gain powerful insights into what makes your customers tick.</p>
<p>The key to getting customer relationship management right is in deciding the best questions to ask and then figuring out what to do with the answers. Before you begin asking your customers questions though, ask yourself some:</p>
<p>* Who [...]]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://www.qiutian.occm.cn/wp-content/gallery/5-easy-ways-to-keep-your-customers/r3350-acerin.jpg" title="" class="shutterset_singlepic1" >
	<img class="ngg-singlepic ngg-left" src="http://www.qiutian.occm.cn/wp-content/gallery/cache/1__320x240_r3350-acerin.jpg" alt="r3350-acerin" title="r3350-acerin" />
</a>
David Binning</p>
<p>3 August 2010</p>
<p><strong>The more useful information you know about your customers, the better you can understand and address their needs.</strong></p>
<p>Chosen carefully and implemented intelligently, a customer relationship management (CRM) system can help you gain powerful insights into what makes your customers tick.</p>
<p>The key to getting customer relationship management right is in deciding the best questions to ask and then figuring out what to do with the answers. Before you begin asking your customers questions though, ask yourself some:</p>
<p>* Who are your customers?<br />
* What are the main subgroups?<br />
* How do you currently interact with them, and how would you like to interact with them?<br />
* What do they currently buy from you, and what do you think they might buy in the future?<br />
* How long have they been customers, and what do you know about why they chose to do business with you?</p>
<p>CRM systems provide a framework to collect and process all of the information about the people who buy, or should be buying from you, so that you can develop smarter and more effective strategies for targeting them, while tracking your success beyond the mere fact of a sale.<span id="more-49"></span></p>
<h2>1. Segment your customer base</h2>
<p>In order for CRM systems to be effective, it is important to feed in as much useful information as possible on your customers.</p>
<p>This data should include a record of all conversations and interactions, from emails to phone calls and other channels. Also consider the customer experience of purchases, including with your competitors, and dates, return of goods for whatever reason, complaints and other post-sale feedback, including expressions of dissatisfaction.</p>
<p>Then there’s all the information specific to each customer, such as company and industry, name, job title and gender of key contacts, as well as how long they’ve been with the company and even their budget.</p>
<p>According to Michael Loop from digital marketing specialist Datarati, it’s vital to start from scratch and to ensure that the data entered is clean.</p>
<p>“It’s important to have rules for validation in systems so that segmentation is clean and accurate and the system is free from duplications,” he says. “If you don’t have that information you will be sending out inconsistent messaging and possibly creating duplication.”</p>
<h2>2. Work out which information to focus on</h2>
<p>Obvious information to capture includes the best method of contacting and interacting with customers, such as whether they prefer to be phoned or emailed and whether there are best times for contact. And as Foster stresses, make sure that your customers want to hear from you.</p>
<p>“You really need to know whether you have permission to send people emails, for instance,” he says. If you don’t have permission, you will be contravening spam/privacy laws.</p>
<p>Digital communications, especially via the web, are creating new opportunities to monitor and respond to customer behaviour. For instance, Datarati’s Loop suggests that companies pay close attention to what information is accessed on their websites, such as market reports, case studies or other materials that might provide insight into what customers are thinking about. Personal information is also very important. In the past, the more popular sources in the business world might have been bars and golf courses; now social networking is emerging as a useful source of ‘highly enriched data’ that can be applied to increase the effectiveness of CRM systems.</p>
<h2>3. When you have the data, how do you use it?</h2>
<p>A big point of getting CRM right, is that it boosts your ability to craft more intelligent and targeted campaigns for the future, while also giving you useful ways to refine your general interaction with customers.</p>
<p>For instance, information from a CRM system might lead to an email campaign being segmented into different groups presenting different incentives or special offers depending on past history. “Try to look at trends for customers and export that data to things like email marketing,” Foster suggests.</p>
<h2>4. Make use of your CRM system day-to-day: checklist</h2>
<p>* Train your staff – A CRM system will only be as good as the people who use it. Therefore the most important thing to get right for successful implementation is staff education.</p>
<p>* Ensure it gets used – CRM takes time and effort, and sales and other staff need to understand what’s in it for them. Unless there is a full understanding of and commitment to the concept of CRM, its value to your organisation will always be limited.</p>
<p>* Keep it fresh – Data has a use-by date, so it’s vital your team commits to keeping the data up-to-date and making the most of the latest information. “Start with something simple, such as just tracking every time you phone someone, until you begin to see value,” Shoeboxed’s Foster says. “Build on it over time.”</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/16/5-easy-ways-to-keep-your-customers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>买了个多功能电子相框，好像叫做iPad啊？ 还不错。</title>
		<link>http://www.qiutian.occm.cn/2010/08/09/%e4%b9%b0%e4%ba%86%e4%b8%aa%e5%a4%9a%e5%8a%9f%e8%83%bd%e7%94%b5%e5%ad%90%e7%9b%b8%e6%a1%86/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/09/%e4%b9%b0%e4%ba%86%e4%b8%aa%e5%a4%9a%e5%8a%9f%e8%83%bd%e7%94%b5%e5%ad%90%e7%9b%b8%e6%a1%86/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 11:38:39 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[科技小东东 [Tech Gadget]]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[jailbreak]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=43</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' --><p>18th-Aug-2010: 新的3.2.2出来了，暂时不能越狱，大家注意如果你越狱了，iTune叫你升级新版注意点“否”，在iTunes的功能设置选项中有禁止自动更新的选项，注意调整。</p>
<p>10th-Aug-2010: 这年头的电子相框还能“越狱”，昨晚上越狱成功，中途出现白苹果，不过现已修复。还有这个相框是基于Unix操作系统的，怪不得还挺贵 lolz</p>
<p>越狱后装了IPA补丁，很可能会白苹果，不过可以重新刷回来，
步骤如下： 1。进入刷机模式：按HOME+电源 10秒，然后放开电源继续按HOME，直到ITUNES连接界面出现
2。打开ITUNES会有显示一个IPAD需要恢复。
3。按提示确认恢复。
4。下载恢复固件后，自己手动关机
5。把ITUNES的帐号换成美国帐号，不然下面就进不去恢复的服务器。
6。再重复1~3，之后会出现连接服务器，连上后恢复，成功。</p>
<p>一般下载是30分钟（400M）恢复是15分钟。
以上是昨天恢复出厂设置的经过，请大家参考。</p>
<p>1，下载iPad 3.2固件；http:/ /appldnld.apple.com.edgesuite.net/content.info.apple.com/iPad/061-7987.20100403.mjiTr/iPad1,1_3.2_7B367_Restore.ipsw   文件大小：456.8mb
2，将开机就只能显示一个大白苹果的IPAD用数据线链接到安装有iTunes的电脑，这时候的显示还是卡在一个白苹果的界面。
3，同时按住圆点+开/关机键直到IPAD黑屏，松开开/关机键大约7秒左右直到Itunes检测到连接为止即进入DFU模式，
4，此时看到iTunes会显示有一个等待恢复的ipad。
5，按住键盘shift后点击iTunes恢复按钮，会出现一个对话框，此时请选择之前下载的固件文件进行恢复。
6，恢复进程约5分钟。耐心等待。。。您心爱的ipad马上就要回到您身边了。</p>
<p>9th-Aug-2010: 买了个多功能电子相框，好像叫做iPad啊？ 还不错。</p>
]]></description>
			<content:encoded><![CDATA[<p>18th-Aug-2010: 新的3.2.2出来了，暂时不能越狱，大家注意如果你越狱了，iTune叫你升级新版注意点“否”，在iTunes的功能设置选项中有禁止自动更新的选项，注意调整。</p>
<p>10th-Aug-2010: 这年头的电子相框还能“越狱”，昨晚上越狱成功，中途出现白苹果，不过现已修复。还有这个相框是基于Unix操作系统的，怪不得还挺贵 lolz</p>
<blockquote><p>越狱后装了IPA补丁，很可能会白苹果，不过可以重新刷回来，<br />
步骤如下： 1。进入刷机模式：按HOME+电源 10秒，然后放开电源继续按HOME，直到ITUNES连接界面出现<br />
2。打开ITUNES会有显示一个IPAD需要恢复。<br />
3。按提示确认恢复。<br />
4。下载恢复固件后，自己手动关机<br />
5。把ITUNES的帐号换成美国帐号，不然下面就进不去恢复的服务器。<br />
6。再重复1~3，之后会出现连接服务器，连上后恢复，成功。</p>
<p>一般下载是30分钟（400M）恢复是15分钟。<br />
以上是昨天恢复出厂设置的经过，请大家参考。</p>
<p>1，下载iPad 3.2固件；http:/ /appldnld.apple.com.edgesuite.net/content.info.apple.com/iPad/061-7987.20100403.mjiTr/iPad1,1_3.2_7B367_Restore.ipsw   文件大小：456.8mb<br />
2，将开机就只能显示一个大白苹果的IPAD用数据线链接到安装有iTunes的电脑，这时候的显示还是卡在一个白苹果的界面。<br />
3，同时按住圆点+开/关机键直到IPAD黑屏，松开开/关机键大约7秒左右直到Itunes检测到连接为止即进入DFU模式，<br />
4，此时看到iTunes会显示有一个等待恢复的ipad。<br />
5，按住键盘shift后点击iTunes恢复按钮，会出现一个对话框，此时请选择之前下载的固件文件进行恢复。<br />
6，恢复进程约5分钟。耐心等待。。。您心爱的ipad马上就要回到您身边了。</p></blockquote>
<p>9th-Aug-2010: 买了个多功能电子相框，好像叫做iPad啊？ 还不错。</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/09/%e4%b9%b0%e4%ba%86%e4%b8%aa%e5%a4%9a%e5%8a%9f%e8%83%bd%e7%94%b5%e5%ad%90%e7%9b%b8%e6%a1%86/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Will the Real Browser Stats Please Stand Up?</title>
		<link>http://www.qiutian.occm.cn/2010/08/06/will-the-real-browser-stats-please-stand-up/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/06/will-the-real-browser-stats-please-stand-up/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 07:43:22 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[网页 & 平面设计]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[stats]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=39</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' --><p>Recently, Mashable published an article entitled “IE6 Finally  Nearing Extinction”, announcing that IE6 usage in the United States  and Europe has finally dropped below 5%.</p>
<p>That news probably warmed the  cockles of the hearts of web designers everywhere. Thus, it  seems designers and developers now have even more incentive to stop  supporting IE6, following the pattern set by  Google, notably with regards to YouTube.</p>
<p>The stats in the Mashable article are based on StatCounter  Global [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" src="http://netdna.webdesignerdepot.com/uploads/browser_stats/thumb.jpg" alt="" width="200" height="160" />Recently, Mashable published an article entitled <a rel="nofollow" href="http://mashable.com/2010/06/01/ie6-below-5-percent/">“IE6 Finally  Nearing Extinction”</a>, announcing that IE6 usage in the United States  and Europe has finally dropped below 5%.</p>
<p>That news probably warmed the  cockles of the hearts of web designers everywhere. Thus, <strong>it  seems designers and developers now have even more incentive to stop  supporting IE6</strong>, following the pattern set <a rel="nofollow" href="http://googleenterprise.blogspot.com/2010/01/modern-browsers-for-modern-applications.html">by  Google</a>, notably with regards to <a rel="nofollow" href="http://techcrunch.com/2009/07/14/youtube-will-be-next-to-kiss-ie6-support-goodbye/">YouTube</a>.</p>
<p>The stats in the Mashable article are based on <a rel="nofollow" href="http://gs.statcounter.com/#browser_version-eu-monthly-201006-201006-bar">StatCounter  Global Stats</a>.  In this article, I’ll provide some food for thought by way of some    alternative statistics that in many ways contradict the sources for the    article published by Mashable.</p>
<p>These stats should drive home the point   that every website is different, and that <strong>in some cases it may   still be necessary to provide a fairly decent experience in IE6</strong>,   while <a rel="nofollow" href="http://www.impressivewebs.com/ie6-progressive-enhancement/">progressively   enhancing</a> design and functionality for newer browsers.</p>
<div><script type="text/javascript">// <![CDATA[
document.write(unescape("%3Cscript type='text/javascript' src='http://www.webdesignerdepot.com/wp-content/themes/wdd2/ads-rotator.php'%3E%3C/script%3E"));
// ]]&gt;</script><script src="http://www.webdesignerdepot.com/wp-content/themes/wdd2/ads-rotator.php" type="text/javascript"></script><a href="http://www.webdesignerdepot.com/scripts/track.php?id=Sitegrinder-banner&amp;url=http://www.medialab.com/sitegrinder3/?utm_source=webdesignerdepot&amp;utm_medium=banner&amp;utm_campaign=team"><img class=" aktuucpcpuppobkewlkq aktuucpcpuppobkewlkq aktuucpcpuppobkewlkq aktuucpcpuppobkewlkq" src="http://netdna.webdesignerdepot.com/uploads/ads/CS5_SG3_You_bannerad_500x80.jpg" alt="" /></a></div>
<p>Below is a screenshot from the June browser version  report for Europe, with IE6’s share indicated:</p>
<p><a rel="nofollow" href="http://gs.statcounter.com/#browser_version-eu-monthly-201006-201006-bar"><img title="Browser version stats for  Europe" src="http://netdna.webdesignerdepot.com/uploads/browser_stats/statcounter-europe.jpg" alt="Browser version stats for Europe" width="615" height="478" /></a></p>
<p>But developers should not be so quick to jump on this bandwagon. The   statistics that the Mashable article were based on are specific to   Europe and the U.S. (which are obviously huge markets), so the advice   given in so many areas of web design likewise applies here: Design for   your audience, and don’t be swayed by trends.</p>
<p><span id="more-39"></span></p>
<h2>What are the Worldwide Stats?</h2>
<p>Let’s look at the same statistics from StatCounter, but with the  broader <a rel="nofollow" href="http://gs.statcounter.com/#browser_version-ww-monthly-201006-201006-bar">worldwide</a> filter applied:</p>
<p><a rel="nofollow" href="http://gs.statcounter.com/#browser_version-ww-monthly-201006-201006-ba"><img title="Browser version stats  worldwide" src="http://netdna.webdesignerdepot.com/uploads/browser_stats/statcounter-ww.jpg" alt="Browser version stats worldwide" width="615" height="476" /></a></p>
<p>Now the IE6 usage stats are just about doubled, up to just under 10%.   Already we can see the importance of considering your own audience and   your own analytics reports before hastily disregarding IE6 support.</p>
<p>Another browser version report, this one by <a rel="nofollow" href="http://marketshare.hitslink.com/browser-market-share.aspx?qprid=2&amp;qptimeframe=M">Net  Applications</a> provides significantly higher statistics for IE6:</p>
<p><a rel="nofollow" href="http://marketshare.hitslink.com/browser-market-share.aspx?qprid=2&amp;qptimeframe=M"><img title="Browser version  stats on Net Applications" src="http://netdna.webdesignerdepot.com/uploads/browser_stats/netapplications-browsers.jpg" alt="Browser version stats on Net Applications" width="615" height="189" /></a></p>
<p>Net Applications explain <a rel="nofollow" href="http://netmarketshare.com/">on  their home page</a> how their stats are compiled, for those who are  curious as to why  their stats for IE6 differ so much. Even if we don’t  accept these as  the most relevant stats, they do offer an alternative  report that <strong>encourages developers and site owners to pay close  attention to their own analytics</strong>.</p>
<p>Another very significant set of stats for worldwide browser usage is   provided by W3schools. Generally speaking, web developers should not   rely on reports from W3schools, because their usage stats are based on   W3school’s analytics. Their website is visited by web professionals and   programmers who are very unlikely to use IE6 in their day-to-day tasks.   Nonetheless, their <a rel="nofollow" href="http://www.w3schools.com/browsers/browsers_stats.asp">browser version stats</a> are interesting to consider:</p>
<p><a rel="nofollow" href="http://www.w3schools.com/browsers/browsers_stats.asp"><img title="Browser version stats  from W3schools" src="http://netdna.webdesignerdepot.com/uploads/browser_stats/w3schools-browsers.jpg" alt="Browser version stats from W3schools" width="615" height="188" /></a></p>
<p>Even in this niche area, the usage for IE6 is almost 3% higher than   the reports for the U.S. and Europe. So again, while the stats for   Europe and the U.S. are encouraging for the demise of IE6, we should   still be careful.</p>
<p>It should also be noted that the W3schools browser stats page is (and   has long been) at the top of Google search results for the phrase “<a rel="nofollow" href="http://www.google.com/#q=browser+usage+statistics">browser usage  statistics</a>“.  This is misleading because those stats are specific to  the tech and  programming industry, and should not be considered for  final analytics.</p>
<h2>What About Individual Country Reports?</h2>
<p>This is where the reports get very interesting. Below, you’ll find   screenshots displaying browser version stats for some of the <a rel="nofollow" href="http://en.wikipedia.org/wiki/List_of_countries_by_population">most  populous nations</a> in the world, with the IE6 stats indicated:</p>
<h3>Browser Usage Stats for China</h3>
<p><a rel="nofollow" href="http://gs.statcounter.com/#browser_version-CN-monthly-201006-201006-ba-bar"><img title="Browser version stats for  China" src="http://netdna.webdesignerdepot.com/uploads/browser_stats/statcounter-china.jpg" alt="Browser version stats for China" width="615" height="517" /></a></p>
<p>The stats shown above for China alone are hard to believe. IE6   dominates usage in that market. But encouragingly, the stats are <a rel="nofollow" href="http://gs.statcounter.com/#browser_version-as-monthly-201006-201006-ba-bar">much  lower for Asia overall</a>, as shown below:</p>
<h3>Browser Usage Stats for Asia</h3>
<p><a rel="nofollow" href="http://gs.statcounter.com/#browser_version-as-monthly-201006-201006-ba-bar"><img title="Browser version stats for  Asia" src="http://netdna.webdesignerdepot.com/uploads/browser_stats/statcounter-asia.jpg" alt="Browser version stats for Asia" width="615" height="514" /></a></p>
<h3>Browser Usage Stats for India</h3>
<p><a rel="nofollow" href="http://gs.statcounter.com/#browser_version-IN-monthly-201006-201006-bar"><img title="Browser version stats for  India" src="http://netdna.webdesignerdepot.com/uploads/browser_stats/statcounter-india.jpg" alt="Browser version stats for India" width="615" height="522" /></a></p>
<h3>Browser Usage Stats for Pakistan</h3>
<p><a rel="nofollow" href="http://gs.statcounter.com/#browser_version-PK-monthly-201006-201006-bar"><img title="Browser version stats  for Pakistan" src="http://netdna.webdesignerdepot.com/uploads/browser_stats/statcounter-pakistan.jpg" alt="Browser version stats for Pakistan" width="615" height="516" /></a></p>
<p>Of course, just because these are some of the most populated parts of   the world, does not necessarily mean those are large or lucrative   markets. In fact, due to the dense population numbers, the opposite   could be true.</p>
<p>So, the stats above will obviously only be pertinent to those who are  developing <strong>websites and web apps targeted at those specific  geographic markets</strong>.</p>
<p>At the very least, reviewing some of these  country-specific reports  reminds us why the usage stats have remained so  high for so long.</p>
<h2>What Does This all Mean?</h2>
<p>The reasonable thing to conclude from these reports is that <strong>each  project is different</strong>, and no single set of stats should be the  determining factor for support of IE6.</p>
<p>If you’re developing a brand new  site that doesn’t have any  analytics trends, then you should carefully  study the demographics of  your intended audience, and then adjust your  support requirements as  new analytics statistics are gathered after  launch.</p>
<p>On the other hand, if you’re redeveloping or realigning an already   established property, past analytics reports should prove invaluable to   your development efforts to ensure you’re reaching as many people as   possible.</p>
<p>As an epilogue to this discussion, it would certainly be wise to also   consider usage for IE7 and IE8 — both of which, according to many of   the charts shown above, have significant market shares.</p>
<p><em>This post was written exclusively for Webdesigner Depot by Louis Lazaris, a freelance writer and web developer. Louis runs <a rel="nofollow" href="http://www.impressivewebs.com/">Impressive  Webs</a> where he posts articles and tutorials on web design. You can <a rel="nofollow" href="http://twitter.com/ImpressiveWebs">follow Louis on Twitter</a> or get in touch with him  through his website.</em></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/06/will-the-real-browser-stats-please-stand-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Hack</title>
		<link>http://www.qiutian.occm.cn/2010/08/06/css-hack/</link>
		<comments>http://www.qiutian.occm.cn/2010/08/06/css-hack/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 07:27:18 +0000</pubDate>
		<dc:creator>qiutian</dc:creator>
				<category><![CDATA[网页 & 平面设计]]></category>

		<guid isPermaLink="false">http://www.qiutian.occm.cn/?p=33</guid>
		<description><![CDATA[<!-- cincopa_excerpt_rt = 'clean' --><p>This tutorial is written by David Hammond, a 20-year-old web technology enthusiast from California who is currently juggling this site, work, college, and other pet projects. He mantains the site Web Devout educating people on web development and standards.</p>
<p>Dealing with browser inconsistencies often makes up a majority of the work for a web designer. Sometimes there is no reasonable way to accomplish a desired layout in all major web browsers without the use of some special exception rules for certain [...]]]></description>
			<content:encoded><![CDATA[<p><em>This tutorial is written by David Hammond, a 20-year-old web technology enthusiast from California who is currently juggling this site, work, college, and other pet projects. He mantains the site Web Devout educating people on web development and standards.</em></p>
<p>Dealing with browser inconsistencies often makes up a majority of the work for a web designer. Sometimes there is no reasonable way to accomplish a desired layout in all major web browsers without the use of some special exception rules for certain layout engines. Hacks necessarily lead to potential complications and should be avoided whenever possible, but when the circumstances require hacks to be used, it&#8217;s best to know what your options are and weigh the consequences appropriately. The purpose of this article is to describe some of the CSS hacks, also called CSS filters, with the least significant potential consequences.</p>
<div id="contents">
<h2>Table of Contents</h2>
<ol>
<li><a href="http://www.webdevout.net/css-hacks#conditional_comments">Conditional comments</a>
<ol>
<li><a href="http://www.webdevout.net/css-hacks#conditional_comments-syntax">Syntax</a></li>
<li><a href="http://www.webdevout.net/css-hacks#conditional_comments-stand_alone">Fixing stand-alone versions of Internet Explorer</a></li>
<li><a href="http://www.webdevout.net/css-hacks#conditional_comments-css_hack">Conditional comments as a CSS hack</a></li>
</ol>
</li>
<li><a href="http://www.webdevout.net/css-hacks#in_css">In-CSS hacks</a>
<ol>
<li><a href="http://www.webdevout.net/css-hacks#in_css-selectors">Easy selectors</a></li>
<li><a href="http://www.webdevout.net/css-hacks#in_css-minimized">Minimized attribute selectors</a></li>
<li><a href="http://www.webdevout.net/css-hacks#in_css-important">!important</a></li>
<li><a href="http://www.webdevout.net/css-hacks#in_css-import_media">@import &#8220;non-ie.css&#8221; all;</a></li>
<li><a href="http://www.webdevout.net/css-hacks#in_css-hyphen">body[class|="page-body"]</a></li>
</ol>
</li>
<li><a href="http://www.webdevout.net/css-hacks#unrecommended">Unrecommended hacks</a>
<ol>
<li><a href="http://www.webdevout.net/css-hacks#unrecommended-vendor_prefix">_property: value and -property: value</a></li>
<li><a href="http://www.webdevout.net/css-hacks#unrecommended-asterisk_prefix">*property: value</a></li>
<li><a href="http://www.webdevout.net/css-hacks#unrecommended-body_empty">body:empty</a></li>
<li><a href="http://www.webdevout.net/css-hacks#unrecommended-link_visited">a:link:visited, a:visited:link</a></li>
<li><a href="http://www.webdevout.net/css-hacks#unrecommended-gt_body">&gt;body</a></li>
<li><a href="http://www.webdevout.net/css-hacks#unrecommended-html_star">html*</a></li>
<li><a href="http://www.webdevout.net/css-hacks#unrecommended-important_ie">!ie</a></li>
<li><a href="http://www.webdevout.net/css-hacks#unrecommended-important_exclam">!important!</a></li>
</ol>
</li>
</ol>
</div>
<div><span id="more-33"></span></div>
<div id="conditional_comments">
<h2>Conditional comments</h2>
<p>Due to its relatively poor level of standards support, Internet Explorer tends to be the subject of most CSS hacks. Luckily, as of version 5, it deliberately supports a rather safe-to-use hack called “conditional comments”. Conditional comments are specially constructed HTML comments that Internet Explorer on Windows may treat differently from other browsers, optionally based on IE&#8217;s version number. They can cause Internet Explorer to ignore the markup between comments or to include part of a comment as if it was regular markup. Conditional comments apply specifically to browsers using Internet Explorer&#8217;s Trident layout engine, meaning IE-based browsers like Maxthon and Avant handle them like Internet Explorer does while browsers using other layout engines see them simply as regular comments. Internet Explorer on the Mac uses a different layout engine and doesn&#8217;t support conditional comments.</p>
<p>The most beneficial aspect of conditional comments is that you are not relying on browser bugs when using them. When you use CSS hacks that rely on browser bugs, you run into the possibility of those bugs being fixed at an unwanted time or other browsers showing the same bugs. Conditional comments only work in browsers that specifically support them and claim to be based on Internet Explorer, which in this case all known browsers are honest about.</p>
<p>There are two forms of conditional comments: positive and negative. A positive conditional comment will expose the included markup only to web browsers that match the condition (meaning only the selected versions of Internet Explorer). A negative conditional comment will expose the markup only to web browsers that don&#8217;t match the condition (meaning all non-IE web browsers and any versions of IE that the condition didn&#8217;t match). Note that, since versions of IE older than IE 5 don&#8217;t support conditional comments, you may get unexpected results in those browsers.</p>
<div id="conditional_comments-syntax">
<h3>Syntax</h3>
<p>The syntax for conditional comments is as follows:</p>
<dl>
<dt>Positive</dt>
<dd>&lt;!&#8211;[if condition]&gt; HTML &lt;![endif]&#8211;&gt;</dd>
<dt>Negative</dt>
<dd>&lt;!&#8211;[if !condition]&gt;&lt;![IGNORE[--&gt;&lt;![IGNORE[]]&gt; HTML &lt;!&#8211;&lt;![endif]&#8211;&gt;</dd>
</dl>
<p>condition is one of the following:</p>
<dl>
<dt>IE</dt>
<dd>Any version of IE</dd>
<dt>lt IE version</dt>
<dd>Versions less than version</dd>
<dt>lte IE version</dt>
<dd>Versions less than or equal to version</dd>
<dt>IE version</dt>
<dd>Only version version</dd>
<dt>gte IE version</dt>
<dd>Versions greater than or equal to version</dd>
<dt>gt IE version</dt>
<dd>Versions greater than version</dd>
</dl>
<p>version is the version of Internet Explorer, typically 5, 5.5, 6, or 7</p>
<p>HTML is the HTML to be included if the condition does or doesn&#8217;t match, depending on the type of conditional comment. When included, the HTML is placed right where the conditional comment is in the source.</p>
<p>For negative conditions, &lt;![IGNORE[--&gt;&lt;![IGNORE[]]&gt; can be replaced with &#8211;&gt; if the condition is simply IE. The longer version is only needed when Internet Explorer might parse the contents.</p>
<p>The &lt;![IGNORE[ ... ]]&gt; directive is not available in XML, so it is illegal to use it in XHTML. A solution would be to split it up into two special conditional comments: &lt;!&#8211;[if !condition]&gt; XHTML &lt;![endif]&#8211;&gt; &lt;!&#8211;[if !IE]&gt;&#8211;&gt; XHTML &lt;!&#8211;&lt;![endif]&#8211;&gt; where XHTML is the same both places. Note that Internet Explorer 7 and below don&#8217;t yet recognize XHTML as a form of XML, so this is merely forward-looking.</p>
<p>To minimize the chance of your site breaking in future versions of Internet Explorer, read <a href="http://www.webdevout.net/tidings/2007/05/29/preparing-your-site-for-ienext/">Preparing your site for IE.next</a>.</p>
</div>
<div id="conditional_comments-stand_alone">
<h3>Fixing stand-alone versions of Internet Explorer</h3>
<p>Internet Explorer was not designed to allow multiple versions to be installed at once, and Microsoft doesn&#8217;t officially support any such configurations. If you use one of the <a href="http://browsers.evolt.org/?ie/32bit/standalone">hacked third party packages</a> that attempts to do this, you will experience problems with version-specific conditional comments, among other things. This is because the different stand-alone copies still rely on a common centralized registry for certain data, including version information.</p>
<p>Although there is no simple way to cut through all of the issues with stand-alone versions of Internet Explorer, it is possible to force them to look elsewhere for their version information, thus fixing this issue with conditional comments. The trick is to remove the normal centralized version indicator. To do this, first open up regedit.exe from the “Run&#8230;” dialog. Navigate to HKEY_LOCAL_MACHINE/Software/Microsoft/Internet Explorer/Version Vector/ (If HKEY_LOCAL_MACHINE doesn&#8217;t exist, try HKLM instead). In the right pane, you should see a row with a Name value of IE. Rename this by clicking on it and changing it to zIE (or anything unique and different). Restart Internet Explorer to see the effects. Now when it looks for the IE key for its version information, the key will be missing and it will be forced to determine the correct version number from its own module.</p>
<p>Stand-alone versions of Internet Explorer have a number of other issues, and it therefore may be better to instead use a separate virtual machine for each version of Internet Explorer to ensure that what you see is what your users will see. I recommend <a href="http://www.vmware.com/products/server/">VMware Server</a>, which is completely free of charge and fairly easy to set up.</p>
</div>
<div id="conditional_comments-css_hack">
<h3>Conditional comments as a CSS hack</h3>
<p>Conditional comments can be used as a CSS hack by including links to stylesheets based on the layout engine. Here is an example of how stylesheets can be separated in this way:</p>
<div id="wpshdo_28" class="wp-synhighlighter-outer"><div id="wpshdt_28" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_28"></a><a id="wpshat_28" class="wp-synhighlighter-title" href="#codesyntax_28"  onClick="javascript:wpsh_toggleBlock(28)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_28" onClick="javascript:wpsh_code(28)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_28" onClick="javascript:wpsh_print(28)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_28" class="wp-synhighlighter-inner" style="display: block;"><pre class="html4strict" style="font-family:monospace;"><span class="sc0">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a> <span class="kw3">lang</span><span class="sy0">=</span><span class="st0">&quot;en&quot;</span>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/title.html"><span class="kw2">title</span></a>&gt;</span>Test<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/title.html"><span class="kw2">title</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/link.html"><span class="kw2">link</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;all_browsers.css&quot;</span> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;stylesheet&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span>&gt;</span>
<span class="sc-1">&lt;!--[if IE]&gt; &lt;link href=&quot;ie_only.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt; &lt;![endif]--&gt;</span>
<span class="sc-1">&lt;!--[if lt IE 7]&gt; &lt;link href=&quot;ie_6_and_below.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt; &lt;![endif]--&gt;</span>
<span class="sc-1">&lt;!--[if !lt IE 7]&gt;&lt;![IGNORE[--&gt;</span><span class="sc2">&lt;!<span class="br0">&#91;</span>IGNORE<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#93;</span>&gt;</span> <span class="sc2">&lt;<a href="http://december.com/html/4/element/link.html"><span class="kw2">link</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;recent.css&quot;</span> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;stylesheet&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span>&gt;</span> <span class="sc-1">&lt;!--&lt;![endif]--&gt;</span>
<span class="sc-1">&lt;!--[if !IE]&gt;--&gt;</span> <span class="sc2">&lt;<a href="http://december.com/html/4/element/link.html"><span class="kw2">link</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;not_ie.css&quot;</span> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;stylesheet&quot;</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span>&gt;</span> <span class="sc-1">&lt;!--&lt;![endif]--&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span>Test<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a>&gt;</span></pre></div></div>
<p>In the above example, all_browsers.css applies to all browsers, ie_only.css only applies to all versions of Internet Explorer, ie_6_and_below.css applies to all versions of Internet Explorer below IE 7, recent.css applies to all browsers except IE versions below 7, and not_ie.css applies to all non-IE browsers.</p>
</div>
<p>See also: <a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp">MSDN: About Conditional Comments</a></p>
</div>
<div id="in_css">
<h2>In-CSS hacks</h2>
<p>One of the drawbacks of conditional comments is that they require changes to the HTML source. Unfortunately, there is no equivalent to conditional comments in CSS. Instead, if you must use in-CSS hacks, you must use some other much less reliable techniques, often involving the exploitation of browser bugs.</p>
<div id="in_css-selectors">
<h3>Easy selectors</h3>
<p>Most in-CSS hacks deal with selector bugs. The following is a list of browser version ranges and the beginnings of selectors that are known to select elements in them. Note that because these hacks rely on browser bugs or missing features, results may vary in some lesser-known or future browsers. All of these selectors use valid CSS.</p>
<dl>
<dt>IE 6 and below</dt>
<dd>* html {}</dd>
<dt>IE 7 and below</dt>
<dd>*:first-child+html {} * html {}</dd>
<dt>IE 7 only</dt>
<dd>*:first-child+html {}</dd>
<dt>IE 7 and modern browsers only</dt>
<dd>html&gt;body {}</dd>
<dt>Modern browsers only (not IE 7)</dt>
<dd>html&gt;/**/body {}</dd>
<dt>Recent Opera versions 9 and below</dt>
<dd>html:first-child {}</dd>
</dl>
<p>Note that the hack for IE 7 and below is actually two separate selectors: one for IE 7 and one for IE 6 and below. The rest of the desired selector must be added to both parts of the hack. The two parts <strong>cannot</strong> be combined with a comma, because IE 6 and below will fail to correctly parse the selector and won&#8217;t be targetted.</p>
<p>Some of these selectors require that the document has a doctype but no processing instructions (including XML declarations). This is the ideal setup to prevent IE 6 from going into quirks mode anyway.</p>
<p>The above selectors will select either the html or body element. This should be used as the start of your full selector. For example, if your desired selector is #foo .bar and you want it to apply only to IE 7, your resulting selector will be *:first-child+html #foo .bar.</p>
<p><strong>Warning:</strong> Due to the nature of the Opera-specific selector and Internet Explorer 7&#8242;s incorrect handling of :first-child, it is very possible that the html:first-child selector may also select in a future version of Internet Explorer, so be careful when using it. This selector also relies on a bug, so it may be fixed in a future version of Opera. This page also describes an <a href="http://www.webdevout.net/css-hacks#in_css-hyphen">alternative method</a> that is more of an issue to implement but may be somewhat more dependable considering the likely priorities of bug fixing.</p>
</div>
<div id="in_css-minimized">
<h3>Minimized attribute selectors</h3>
<p>These hacks are based on differences in handling of attributes in minimized form. If a tag is written &lt;input disabled&gt;, input[disabled="disabled"] {} should select it. However, most browsers get this wrong and in different ways.</p>
</div>
<div>
<p>For the above markup, here are the selectors various browsers recognize to select the p element:</p>
<dl>
<dt>#attrhack[disabled=""]+p {}</dt>
<dd>Firefox 1.5 and below, possibly future versions</dd>
<dd>Safari 2.0 and below, possibly future versions</dd>
<dd>Konqueror 3.5 and below, possibly future versions</dd>
<dt>#attrhack[disabled="true"]+p {}</dt>
<dd>Opera 9 and below, possibly future versions</dd>
</dl>
<p>Note that neither of these selects Internet Explorer 7. Although it supports attribute selectors and adjacent sibling combinators, it doesn&#8217;t seem to recognize a string value for attributes in minimized form.</p>
<p><strong>Notice:</strong> Minimized attribute form is allowed in HTML but not in XHTML. This hack will not work in XHTML documents.</p>
</div>
<div id="in_css-important">
<h3>!important</h3>
<p>Internet Explorer 6 and below had a problem with the !important identifier that caused it to be ignored if another declaration of the same property appeared later in the same style declaration block. This can be used to feed Internet Explorer 6 and below special property values that are ignored by other browsers. Internet Explorer 7 fixed this issue.</p>
<p>Here is an example of this technique in use:</p>
<div id="wpshdo_29" class="wp-synhighlighter-outer"><div id="wpshdt_29" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_29"></a><a id="wpshat_29" class="wp-synhighlighter-title" href="#codesyntax_29"  onClick="javascript:wpsh_toggleBlock(29)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_29" onClick="javascript:wpsh_code(29)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_29" onClick="javascript:wpsh_print(29)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_29" class="wp-synhighlighter-inner" style="display: block;"><pre class="html4strict" style="font-family:monospace;"><span class="sc0">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a> <span class="kw3">lang</span><span class="sy0">=</span><span class="st0">&quot;en&quot;</span>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/title.html"><span class="kw2">title</span></a>&gt;</span>Test<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/title.html"><span class="kw2">title</span></a>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/input.html"><span class="kw2">input</span></a> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;hidden&quot;</span> <span class="kw3">disabled</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;attrhack&quot;</span>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span>Test<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a>&gt;</span></pre></div></div>
</div>
<div id="in_css-import_media">
<h3>@import &#8220;non-ie.css&#8221; all;</h3>
<p>Internet Explorer 7 and below don&#8217;t support media selectors on @import rules, instead ignoring the entire rule when they are present. Therefore, you can create an entire stylesheet for non-IE browsers and import it into your main stylesheet by adding @import &#8220;non-ie.css&#8221; all;.</p>
<p>Future versions of Internet Explorer may support the @import rule correctly.</p>
<p>@import &#8220;stylesheet.css&#8221; all; imports the stylesheet in <strong>all major browsers except IE 7 and below</strong>. It may or may not work in future versions of IE.</p>
</div>
<div id="in_css-hyphen">
<h3>body[class|="page-body"]</h3>
<p>The CSS 2.1 specification isn&#8217;t clear about whether or not a hyphen can be included in the value of a hyphen-separated attribute selector. Most browsers, including Firefox and Internet Explorer 7, Allow the body[class|="page-body"] selector to select an element whose start tag looks like this: &lt;body&gt;. However, Opera interprets the specification differently in this regard. It splits up the attribute value by hyphens and only checks the first piece against the attribute selector value. Obviously, if the attribute was split by hyphens, the first piece won&#8217;t have any hyphens in it, so Opera treats this selector as a non-match. Therefore, when the proper class is applied to the body element, this selector matches Internet Explorer 7 and most modern browsers except Opera. Opera may change their behavior to match other browsers in the future, but this technique is known to work for Opera 8 and 9.</p>
<p>Here is an example of this technique in use:</p>
<div id="wpshdo_30" class="wp-synhighlighter-outer"><div id="wpshdt_30" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_30"></a><a id="wpshat_30" class="wp-synhighlighter-title" href="#codesyntax_30"  onClick="javascript:wpsh_toggleBlock(30)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_30" onClick="javascript:wpsh_code(30)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_30" onClick="javascript:wpsh_print(30)" title="Print code"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.qiutian.occm.cn/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_30" class="wp-synhighlighter-inner" style="display: block;"><pre class="html4strict" style="font-family:monospace;"><span class="sc0">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a> <span class="kw3">lang</span><span class="sy0">=</span><span class="st0">&quot;en&quot;</span>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/title.html"><span class="kw2">title</span></a>&gt;</span>Test<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/title.html"><span class="kw2">title</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/style.html"><span class="kw2">style</span></a> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/css&quot;</span>&gt;</span>
p
{
background: red; /* Applies to all major browsers */
}
body[class|=&quot;page-body&quot;] p
{
background: green; /* Applies to IE 7 and most modern browsers except Opera */
}
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/style.html"><span class="kw2">style</span></a>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span>
<span class="sc2">&lt;<a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span>Test<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/p.html"><span class="kw2">p</span></a>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a>&gt;</span></pre></div></div>
</div>
<div>
<p>body[class|="page-body"] {} selects the body element with the class page-body in <strong>IE 7 and all modern browsers except Opera 9 and below</strong>. It may or may not work in future versions.</p>
</div>
</div>
<div id="unrecommended">
<h2>Unrecommended hacks</h2>
<p>If you are going to use hacks, the above techniques are the recommended choices. However, it&#8217;s interesting to point out the following unrecommended hacks. Some of them rely on invalid CSS or are more clumsy than the above alternatives.</p>
<div id="unrecommended-vendor_prefix">
<h3>_property: value and -property: value</h3>
<p>Due to a parsing error, Internet Explorer 6 and below wouldn&#8217;t fail on properties that were prefixed with non-alphanumeric characters. Prefixing a regular property name with _ or &#8211; will cause the property to be applied to Internet Explorer 6 and below but generally not in other browsers. Internet Explorer 7 had this bug fixed.</p>
<p>The CSS specification allows browsers to use an underscore (_) or hyphen (-) as a prefix for a vendor-specific property name with the guarantee that such properties will never be used in a future CSS standard. Because of this guarantee, these two prefix characters are ideal options for this hack.</p>
<p>Although the CSS specification defines this vendor-specific property syntax, the properties are inherently not part of any W3C-endorsed CSS profile and are therefore invalid when validated against one. For this reason, and because there is an <a href="http://www.webdevout.net/css-hacks#in_css-important">often acceptable alternative</a>, this hack is unrecommended.</p>
<p>_property: value and -property: value apply the property value in <strong>IE 6 and below</strong>. Warning: this uses <strong>invalid CSS</strong>.</p>
</div>
<div id="unrecommended-asterisk_prefix">
<h3>*property: value</h3>
<p>Although Internet Explorer 7 corrected its behavior when a property name is prefixed with an underscore or a hyphen, other non-alphanumeric character prefixes are treated as they were in IE6. Therefore, if you add a non-alphanumeric character such as an asterisk (*) immediately before a property name, the property will be applied in IE and not in other browsers. Unlike with the hyphen and underscore method, the CSS specification makes no reservations for the asterisk as a prefix, so use of this hack could result in unexpected behavior as the CSS specifications evolve.</p>
<p>*property: value applies the property value in <strong>IE 7 and below</strong>. It may or may not work in future versions. Warning: this uses <strong>invalid CSS</strong>.</p>
</div>
<div id="unrecommended-body_empty">
<h3>body:empty</h3>
<p>The :empty pseudo-classes is proposed for CSS 3 and should select an element that has no elements or text inside it. However, when used on the body element, Firefox 1.5 and 2.0 (and corresponding versions of other Gecko-based browsers) always select it even when the body has content (which it should always have).</p>
<p>Although this hack is expected to be valid in CSS 3, it has not yet reached W3C Recommendation status and is invalid CSS 2.x, so it currently isn&#8217;t recommended to use this hack. However, it is probably the best way to single out recent versions of Firefox.</p>
<p>body:empty {} selects the body element in <strong>Firefox 1.5 and 2.0 only</strong>. It may or may not work in future versions. Warning: this uses <strong>invalid CSS 2.x</strong> but <strong>valid CSS 3</strong> according to recent drafts.</p>
</div>
<div id="unrecommended-link_visited">
<h3>a:link:visited, a:visited:link</h3>
<p>According to the CSS standard, the :link and :visited link states are mutually exclusive: :link actually means “unvisited link”. However, IE 7 and below will ignore one of these pseudo-classes if the other appears later in the same simple selector.</p>
<p>If you have the tag &lt;a href=&#8221;foo.html&#8221; id=&#8221;linkhack&#8221;&gt;, either #linkhack:link:visited {} or #linkhack:visited:link {} will select the element in IE 7 and below. The two selectors can be combined for a single declaration block: #linkhack:link:visited, #linkhack:visited:link {}. In IE 7, you can also use an adjacent sibling combinator (+) to select other elements near the link.</p>
<p>This uses perfectly valid CSS, but this method is less practical than some of the <a href="http://www.webdevout.net/css-hacks#in_css-selectors">above methods</a> and is therefore not recommended.</p>
<p>a:link:visited, a:visited:link {} selects an a element in <strong>IE 7 and below</strong>. It may or may not work in future versions.</p>
</div>
<div id="unrecommended-gt_body">
<h3>&gt;body</h3>
<p>If a simple selector is missing on either side of the child combinator (&gt;), Internet Explorer 7 incorrectly assumes that the missing simple selector is a universal selector. So &gt;body is treated by IE7 like *&gt;body, while other browsers ignore it because it&#8217;s a parsing error. Similarly, IE7 treats &gt;&gt; like *&gt;*&gt;*.</p>
<p>IE7 has the same quirk with other combinators. +p is treated like *+p and ~p is treated like *~p. (Note: The ~ combinator is an upcoming CSS 3 feature and is not valid CSS 2.1.)</p>
<p>&gt;body {} selects the body element in <strong>IE 7 only</strong>. It may or may not work in future versions. Warning: this uses <strong>invalid CSS</strong>!</p>
</div>
<div id="unrecommended-html_star">
<h3>html*</h3>
<p>Internet Explorer 7 fixed the quirk that allowed the universal selector (*) to select some nonexistent parent of the html element, but there&#8217;s another issue that they didn&#8217;t fix: When a universal selector is directly adjacent to another simple selector without a space between, Internet Explorer 7 assumes a space there. That means that html* is treated by IE7 like html *, while other browsers ignore it because it&#8217;s a parsing error. Similarly, IE7 treats ** like * *.</p>
<p>html* {} selects all descendants of the html element in <strong>IE 7 and below</strong>. It may or may not work in future versions. Warning: this uses <strong>invalid CSS</strong>!</p>
</div>
<div id="unrecommended-important_ie">
<h3>!ie</h3>
<p>Internet Explorer 7 fixed one of the issues with the !important identifier, but it still has problems when the identifier has an error in it. If an illegal identifier name is used in place of important, Internet Explorer 7 and below will handle the property normally instead of failing. Therefore, in any style declaration block, you can include properties intended to only apply to Internet Explorer and add an !ie identifier. Almost any word can be used in place of ie.</p>
<p>The !ie identifier allows the property to be applied in <strong>IE 7 and below</strong>. It may or may not work in future versions. Warning: this uses <strong>invalid CSS</strong>!</p>
</div>
<div id="unrecommended-important_exclam">
<h3>!important!</h3>
<p>Another problem with the !important identifier that wasn&#8217;t fixed in IE 7 is the treatment of non-alphanumeric characters after the identifier. Normally, this should cause the property to fail, but Internet Explorer 7 and below ignore the additional punctuate and apply the property as if it just had the !important identifier.</p>
<p>The !important! identifier allows the property to be applied with importance in <strong>IE 7 and below</strong> and the property is not applied in other browsers. It may or may not work in future versions. Warning: this uses <strong>invalid CSS</strong>!</p>
</div>
</div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.qiutian.occm.cn/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.qiutian.occm.cn/2010/08/06/css-hack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.qiutian.occm.cn/feed/ ) in 1.45415 seconds, on Sep 4th, 2010 at 9:14 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Sep 4th, 2010 at 10:14 am UTC -->