﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-马尔代夫-文章分类-Hibernate</title><link>http://www.blogjava.net/lvlinghui/category/15927.html</link><description /><language>zh-cn</language><lastBuildDate>Thu, 01 Mar 2007 14:03:54 GMT</lastBuildDate><pubDate>Thu, 01 Mar 2007 14:03:54 GMT</pubDate><ttl>60</ttl><item><title>规范分页</title><link>http://www.blogjava.net/lvlinghui/articles/73330.html</link><dc:creator>马尔代夫</dc:creator><author>马尔代夫</author><pubDate>Tue, 03 Oct 2006 13:14:00 GMT</pubDate><guid>http://www.blogjava.net/lvlinghui/articles/73330.html</guid><wfw:comment>http://www.blogjava.net/lvlinghui/comments/73330.html</wfw:comment><comments>http://www.blogjava.net/lvlinghui/articles/73330.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lvlinghui/comments/commentRss/73330.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lvlinghui/services/trackbacks/73330.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 分页，这是Web应用中经常要涉及的问题，相信每一位开发人员都有这个自信解决这个问题，看了不少各式各样的分页实现代码，总觉得应该有一个比较好的规范来处理分页。有没有一个比较好、规范的分页接口，这样大家都可以围绕此接口做实现，这样分页处理就统一起来，简单多，而不我们看到现象：不同公司个人的不同版本的分页实现。个人非常欣赏aopalliance项目，虽然只是一些接口的定义，但定于规范化AOP确实做出不小...&nbsp;&nbsp;<a href='http://www.blogjava.net/lvlinghui/articles/73330.html'>阅读全文</a><img src ="http://www.blogjava.net/lvlinghui/aggbug/73330.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lvlinghui/" target="_blank">马尔代夫</a> 2006-10-03 21:14 <a href="http://www.blogjava.net/lvlinghui/articles/73330.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ArticlesManager 0.1 分页功能的实现--Hibernate</title><link>http://www.blogjava.net/lvlinghui/articles/73329.html</link><dc:creator>马尔代夫</dc:creator><author>马尔代夫</author><pubDate>Tue, 03 Oct 2006 13:10:00 GMT</pubDate><guid>http://www.blogjava.net/lvlinghui/articles/73329.html</guid><wfw:comment>http://www.blogjava.net/lvlinghui/comments/73329.html</wfw:comment><comments>http://www.blogjava.net/lvlinghui/articles/73329.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lvlinghui/comments/commentRss/73329.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lvlinghui/services/trackbacks/73329.html</trackback:ping><description><![CDATA[
		<div class="content">
				<p>ArticlesManager 的分页功能基于 Hibernate 的 分页实现。</p>
				<p>主要好处就是移植了，至于效率如何，暂时还没有考虑到，Hibernate推荐的，应该还不错吧！</p>
				<p>将含有分页的列表页面作为一个对象，对象中组合了 Articles 这个对象。</p>
				<p>该对象还具有返回是否是首页，是否为末页，是否有上页，下页 等方法。</p>
				<p>PageNavigation.java  的类的具体代码：</p>
				<p>
				</p>
				<pre class="java" style="BORDER-RIGHT: #d0d0d0 1px solid; BORDER-TOP: #d0d0d0 1px solid; FONT: 10px Verdana, Courier, monospace; BORDER-LEFT: #d0d0d0 1px solid; COLOR: #000066; BORDER-BOTTOM: #d0d0d0 1px solid; BACKGROUND-COLOR: #f0f0f0">
						<div style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-SIZE: 10px; PADDING-BOTTOM: 2px; COLOR: #808080; PADDING-TOP: 2px; BORDER-BOTTOM: #d0d0d0 1px solid; FONT-FAMILY: Verdana, Arial, sans-serif; BACKGROUND-COLOR: #f0f0ff">JavaZoo.com © 2006. Code Language:java.</div>
						<ol>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">package</span> net.<span style="COLOR: #006600">hulihutu</span>.<span style="COLOR: #006600">pages</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #a1a100">import org.hibernate.HibernateException;</span>
										</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #a1a100">import org.hibernate.Query;</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #a1a100">import org.hibernate.ScrollableResults;</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #a1a100">import java.util.List;</span>
										</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">/**</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">  * Hibernate分页信息</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">  */</span>
										</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="FONT-WEIGHT: bold; COLOR: #000000">class</span> PageNavigation <span style="FONT-WEIGHT: bold; COLOR: #000000">implements</span> Page <span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">private</span>
												<a style="COLOR: #000060" href="http://www.google.com/search?hl=en&amp;q=allinurl%3AList+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky">
														<span style="FONT-WEIGHT: bold; COLOR: #aaaadd">List</span>
												</a> elements;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">private</span>
												<span style="COLOR: #993333">int</span> pageSize;</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">private</span>
												<span style="COLOR: #993333">int</span> pageNumber;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">private</span>
												<span style="COLOR: #993333">int</span> totalElements = <span style="COLOR: #cc66cc">0</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">/**</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   * 构建PageNavigation对象，完成Hibernate的Query数据的分页处理</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   *</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   * @param query           Hibernate的Query对象</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   * @param pageNumber 当前页编码，从1开始，如果传的值为Integer.MAX_VALUE表示获取最后一页。</span>
										</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   *                                     如果你不知道最后一页编码，传Integer.MAX_VALUE即可。如果当前页超过总页数，也表示最后一页。</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   *                                     这两种情况将重新更改当前页的页码，为最后一页编码。</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   * @param pageSize     每一页显示的条目数</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   */</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span> PageNavigation<span style="COLOR: #66cc66">(</span>Query query, <span style="COLOR: #993333">int</span> pageNumber, <span style="COLOR: #993333">int</span> pageSize<span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageNumber</span> = pageNumber;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageSize</span> = pageSize;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">try</span>
												<span style="COLOR: #66cc66">{</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">      ScrollableResults scrollableResults = query.<span style="COLOR: #006600">scroll</span><span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">//get the total elements number</span>
										</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">      scrollableResults.<span style="COLOR: #006600">last</span><span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">totalElements</span> = scrollableResults.<span style="COLOR: #006600">getRowNumber</span><span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #b1b100">if</span>
												<span style="COLOR: #66cc66">(</span>
												<a style="COLOR: #000060" href="http://www.google.com/search?hl=en&amp;q=allinurl%3AInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky">
														<span style="FONT-WEIGHT: bold; COLOR: #aaaadd">Integer</span>
												</a>.<span style="COLOR: #006600">MAX_VALUE</span> == <span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageNumber</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">          || <span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageNumber</span> &gt; getLastPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #808080; FONT-STYLE: italic">//last page</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">{</span>
										</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageNumber</span> = getLastPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">      elements = query.<span style="COLOR: #006600">setFirstResult</span><span style="COLOR: #66cc66">(</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">(</span>
												<span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageNumber</span> - <span style="COLOR: #cc66cc">1</span><span style="COLOR: #66cc66">)</span> * <span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageSize</span><span style="COLOR: #66cc66">)</span>.<span style="COLOR: #006600">setMaxResults</span><span style="COLOR: #66cc66">(</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageSize</span> + <span style="COLOR: #cc66cc">1</span><span style="COLOR: #66cc66">)</span>.<span style="COLOR: #006600">list</span><span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span>;</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
												<span style="FONT-WEIGHT: bold; COLOR: #000000">catch</span>
												<span style="COLOR: #66cc66">(</span>HibernateException e<span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">throw</span>
												<span style="FONT-WEIGHT: bold; COLOR: #000000">new</span>
												<a style="COLOR: #000060" href="http://www.google.com/search?hl=en&amp;q=allinurl%3ARuntimeException+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky">
														<span style="FONT-WEIGHT: bold; COLOR: #aaaadd">RuntimeException</span>
												</a>
												<span style="COLOR: #66cc66">(</span>e<span style="COLOR: #66cc66">)</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
										</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">boolean</span> getIsFirstPage<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> getThisPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> == <span style="COLOR: #cc66cc">1</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">boolean</span> getIsLastPage<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> getThisPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> &gt;= getLastPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">boolean</span> getHasNextPage<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> getLastPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> &gt; getThisPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">boolean</span> getHasPreviousPage<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> getThisPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> &gt; <span style="COLOR: #cc66cc">1</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">int</span> getLastPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> totalElements % <span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageSize</span> == <span style="COLOR: #cc66cc">0</span> ? totalElements</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">        / <span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageSize</span> : totalElements / <span style="FONT-WEIGHT: bold; COLOR: #000000">this</span>.<span style="COLOR: #006600">pageSize</span> + <span style="COLOR: #cc66cc">1</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">/**</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   * 返回List类型数据</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   *</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   * @return     List数据源</span>
										</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #808080; FONT-STYLE: italic">   */</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<a style="COLOR: #000060" href="http://www.google.com/search?hl=en&amp;q=allinurl%3AList+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky">
														<span style="FONT-WEIGHT: bold; COLOR: #aaaadd">List</span>
												</a> getElements<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> elements;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">int</span> getTotalNumberOfElements<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> totalElements;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">int</span> getThisPageFirstElementNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span>
												<span style="COLOR: #66cc66">(</span>getThisPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> - <span style="COLOR: #cc66cc">1</span><span style="COLOR: #66cc66">)</span> * getPageSize<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> + <span style="COLOR: #cc66cc">1</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">int</span> getThisPageLastElementNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #993333">int</span> fullPage = getThisPageFirstElementNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> + getPageSize<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> - <span style="COLOR: #cc66cc">1</span>;</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> getTotalNumberOfElements<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> &lt; fullPage ? getTotalNumberOfElements<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">        : fullPage;</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">int</span> getNextPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> getThisPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> + <span style="COLOR: #cc66cc">1</span>;</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">int</span> getPreviousPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> getThisPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span> - <span style="COLOR: #cc66cc">1</span>;</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">int</span> getPageSize<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> pageSize;</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">public</span>
												<span style="COLOR: #993333">int</span> getThisPageNumber<span style="COLOR: #66cc66">(</span><span style="COLOR: #66cc66">)</span><span style="COLOR: #66cc66">{</span></div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="FONT-WEIGHT: bold; COLOR: #000000">return</span> pageNumber;</div>
								</li>
								<li style="FONT-WEIGHT: bold; COLOR: #006060">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020">
												<span style="COLOR: #66cc66">}</span>
										</div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
								<li style="FONT: 10px Verdana, Courier, monospace; COLOR: #003030">
										<div style="FONT: 10px Verdana, Courier, monospace; COLOR: #000020"> </div>
								</li>
						</ol>
						<div style="PADDING-RIGHT: 2px; BORDER-TOP: #d0d0d0 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 10px; PADDING-BOTTOM: 2px; COLOR: #808080; PADDING-TOP: 2px; FONT-FAMILY: Verdana, Arial, sans-serif; BACKGROUND-COLOR: #f0f0ff">Parsed in 0.862 seconds,  using GeSHi 1.0.7.12</div>
				</pre>
				<p>
				</p>
				<p>分页后的文章列表参见附件，右下角为分页连接。</p>
				<p>目前Jsp页面中完全不含有 java 类，但是看到很多程序使用的自定义tld来处理分页，打算以后对这部分内容进行重构。</p>
				<p>附件4为 articleListAction 。给浏览器返回的是 pageNagivation 类 ^_^ </p>
				<p> </p>
		</div>
		<div class="attach">图片附件(缩略图):<br /><a href="http://www.hulihutu.net/attachment.php?id=52" target="_blank"><img height="158" alt="大小: 203.11 K&#xD;尺寸: 400 x 158&#xD;浏览: 4 次&#xD;点击打开新窗口浏览全图" src="http://www.hulihutu.net/attachments/date_200608/thumb_1fe68fb47a7fcd9b3c221bb5e0e20c0a.jpg" width="400" border="0" /></a></div>
		<div class="attach">图片附件(缩略图):<br /><a href="http://www.hulihutu.net/attachment.php?id=53" target="_blank"><img height="122" alt="大小: 155.75 K&#xD;尺寸: 400 x 122&#xD;浏览: 2 次&#xD;点击打开新窗口浏览全图" src="http://www.hulihutu.net/attachments/date_200608/thumb_d25bdd12230a8b0cb671f61e546430a5.jpg" width="400" border="0" /></a></div>
		<div class="attach">图片附件(缩略图):<br /><a href="http://www.hulihutu.net/attachment.php?id=54" target="_blank"><img height="133" alt="大小: 177.13 K&#xD;尺寸: 400 x 133&#xD;浏览: 3 次&#xD;点击打开新窗口浏览全图" src="http://www.hulihutu.net/attachments/date_200608/thumb_e393211e03b02eae01ffd9f653377af9.jpg" width="400" border="0" /></a></div>
		<div class="attach">图片附件(缩略图):<br /><a href="http://www.hulihutu.net/attachment.php?id=55" target="_blank"><img height="48" alt="大小: 46.68 K&#xD;尺寸: 400 x 48&#xD;浏览: 2 次&#xD;点击打开新窗口浏览全图" src="http://www.hulihutu.net/attachments/date_200608/thumb_3bada83657186ebb2e6e68dd63340bf4.jpg" width="400" border="0" /></a></div>
<img src ="http://www.blogjava.net/lvlinghui/aggbug/73329.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lvlinghui/" target="_blank">马尔代夫</a> 2006-10-03 21:10 <a href="http://www.blogjava.net/lvlinghui/articles/73329.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>