﻿<?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-VincentChen‘s Blog-文章分类-Spring</title><link>http://www.blogjava.net/Vencent/category/7757.html</link><description>&lt;font color='orange'&gt;本博客仅为收集所用。在此对原作者表示感谢。&lt;/font&gt;
&lt;div class="custom"&gt;
&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-6256612161572960";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = ["FFDDAA","FFDDAA","FFDDAA","FFDDAA"];
google_color_bg = ["FFDDAA","FFDDAA","FFDDAA","FFDDAA"];
google_color_link = ["FFDDAA","0033FF","00008B","99CC33"];
google_color_url = ["999999","0033FF","00008B","FFCC00"];
google_color_text = ["0033FF","AA9999","0033FF","AA9999"];
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;/div&gt;</description><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 17:43:40 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 17:43:40 GMT</pubDate><ttl>60</ttl><item><title>Spring + hibernate + webwork + freemarker 整合配置</title><link>http://www.blogjava.net/Vencent/articles/40757.html</link><dc:creator>Vincent Chen</dc:creator><author>Vincent Chen</author><pubDate>Wed, 12 Apr 2006 16:31:00 GMT</pubDate><guid>http://www.blogjava.net/Vencent/articles/40757.html</guid><wfw:comment>http://www.blogjava.net/Vencent/comments/40757.html</wfw:comment><comments>http://www.blogjava.net/Vencent/articles/40757.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Vencent/comments/commentRss/40757.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Vencent/services/trackbacks/40757.html</trackback:ping><description><![CDATA[
		<div class="postText">
				<div class="postText">
						<p>web.xml  <br />// 这里不需要配置字符过滤，网上有的例子加了，实际上<br />webwork.properties里设置如下就可以了页面也是GBK<br />webwork.locale=zh_CN<br />webwork.i18n.encoding=GBK<br />－－－－－－－－－－－－－－－－－－－－－－－－－－－<br /></p>
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
								<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
								<span style="color: rgb(0, 0, 255);">&lt;!</span>
								<span style="color: rgb(255, 0, 255);">DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" <br />         "http://java.sun.com/dtd/web-app_2_3.dtd"</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
								</span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">web-app</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />  </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">context-param</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />     </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">param-name</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">contextConfigLocation</span>
								<span style="color: rgb(0, 0, 255);">&lt;/</span>
								<span style="color: rgb(128, 0, 0);">param-name</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />     </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">param-value</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">/WEB-INF/classes/applicationContext.xml</span>
								<span style="color: rgb(0, 0, 255);">&lt;/</span>
								<span style="color: rgb(128, 0, 0);">param-value</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />  </span>
								<span style="color: rgb(0, 0, 255);">&lt;/</span>
								<span style="color: rgb(128, 0, 0);">context-param</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br /> </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">listener</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />  </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">listener-class</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />     org.springframework.web.context.ContextLoaderListener</span>
								<br />   <span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">listener-class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">listener</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">listener</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">listener-class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />     com.atlassian.xwork.ext.ResolverSetupServletContextListener</span><span style="color: rgb(0, 0, 255);"><br />   &lt;/</span><span style="color: rgb(128, 0, 0);">listener-class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">listener</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"><br />    &lt;servlet&gt;<br />    &lt;servlet-name&gt;context&lt;/servlet-name&gt;<br />             &lt;servlet-class&gt;<br />                org.springframework.web.context.ContextLoaderServlet<br />             &lt;/servlet-class&gt;<br />             &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;<br />     &lt;/servlet&gt;<br />     </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">webwork</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            com.opensymphony.webwork.dispatcher.ServletDispatcher</span><br />         <span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet-class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">load-on-startup</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">load-on-startup</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">freemarker</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-class</span><span style="color: rgb(0, 0, 255);">&gt;</span><br />      <span style="color: rgb(0, 0, 0);">com.opensymphony.webwork.views.freemarker.FreemarkerServlet</span><span style="color: rgb(0, 0, 255);"><br />   &lt;/</span><span style="color: rgb(128, 0, 0);">servlet-class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">load-on-startup</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">10</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">load-on-startup</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-mapping</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">webwork</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">url-pattern</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">*.action</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">url-pattern</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet-mapping</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-mapping</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">freemarker</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">url-pattern</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">*.ftl</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">url-pattern</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet-mapping</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">welcome-file-list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">index.html</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">welcome-file</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">welcome-file-list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">taglib</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">taglib-uri</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">webwork</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">taglib-uri</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">taglib-location</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">/WEB-INF/webwork.tld</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">taglib-location</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">taglib</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">web-app</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /><br /></span></div>
						<br />
						<p>－－－－－－－－－－－－－－－－－－－－－－－－－－－<br /><br />xwork.xml<br /><br />==================---------------------------------------------</p>
						<p>
						</p>
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
								<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
								<span style="color: rgb(0, 0, 255);">&lt;?</span>
								<span style="color: rgb(255, 0, 255);">xml version="1.0"</span>
								<span style="color: rgb(0, 0, 255);">?&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
								</span>
								<span style="color: rgb(0, 0, 255);">&lt;!</span>
								<span style="color: rgb(255, 0, 255);">DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" <br />          "http://www.opensymphony.com/xwork/xwork-1.0.dtd"</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
										<br />
								</span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">xwork</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
										<br />  </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">include </span>
								<span style="color: rgb(255, 0, 0);">file</span>
								<span style="color: rgb(0, 0, 255);">="webwork-default.xml"</span>
								<span style="color: rgb(0, 0, 255);">/&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />    </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">package </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="users"</span>
								<span style="color: rgb(255, 0, 0);"> extends</span>
								<span style="color: rgb(0, 0, 255);">="webwork-default"</span>
								<span style="color: rgb(255, 0, 0);">
										<br />        externalReferenceResolver</span>
								<span style="color: rgb(0, 0, 255);">=<br />                       "com.atlassian.xwork.ext.SpringServletContextReferenceResolver"</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
										<br />        </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">interceptors</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />            </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">interceptor </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="reference-resolver"</span>
								<span style="color: rgb(255, 0, 0);">
										<br />               class</span>
								<span style="color: rgb(0, 0, 255);">="com.opensymphony.xwork.interceptor.ExternalReferencesInterceptor"</span>
								<span style="color: rgb(0, 0, 255);">/&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />            </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">interceptor-stack </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="myDefaultWebStack"</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />                </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">interceptor-ref </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="defaultStack"</span>
								<span style="color: rgb(0, 0, 255);">/&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />                </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">interceptor-ref </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="reference-resolver"</span>
								<span style="color: rgb(0, 0, 255);">/&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />                </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">interceptor-ref </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="model-driven"</span>
								<span style="color: rgb(0, 0, 255);">/&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />       </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">interceptor-ref </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="params"</span>
								<span style="color: rgb(0, 0, 255);">/&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />            </span>
								<span style="color: rgb(0, 0, 255);">&lt;/</span>
								<span style="color: rgb(128, 0, 0);">interceptor-stack</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />        </span>
								<span style="color: rgb(0, 0, 255);">&lt;/</span>
								<span style="color: rgb(128, 0, 0);">interceptors</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
										<br />
								</span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">default-interceptor-ref </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="myDefaultWebStack"</span>
								<span style="color: rgb(0, 0, 255);">/&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />        </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">action </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="blogUser"</span>
								<span style="color: rgb(255, 0, 0);"> class</span>
								<span style="color: rgb(0, 0, 255);">="com.jsblog.action.BlogUserAction"</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />   </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">external-ref </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="baseDao"</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">baseDaoTarget</span>
								<span style="color: rgb(0, 0, 255);">&lt;/</span>
								<span style="color: rgb(128, 0, 0);">external-ref</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">     <br />    //这里是把applicationContext里配置的DAO 注入action里 action里要有baseDao属性<br />   </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">result </span>
								<span style="color: rgb(255, 0, 0);">name</span>
								<span style="color: rgb(0, 0, 255);">="success"</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">/add.htm</span>
								<span style="color: rgb(0, 0, 255);">&lt;/</span>
								<span style="color: rgb(128, 0, 0);">result</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />  </span>
								<span style="color: rgb(0, 0, 255);">&lt;/</span>
								<span style="color: rgb(128, 0, 0);">action</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
						</div>
						<br />
						<p>-------------------------------------------------------------------------<br /><br />applicationContext.xml<br /><br />---------------------------------------------------------------------------</p>
						<p>
						</p>
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
								<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
								<span style="color: rgb(0, 0, 255);">&lt;?</span>
								<span style="color: rgb(255, 0, 255);">xml version="1.0"</span>
								<span style="color: rgb(0, 0, 255);">?&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
								</span>
								<span style="color: rgb(0, 0, 255);">&lt;!</span>
								<span style="color: rgb(255, 0, 255);">DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" <br />           "http://www.springframework.org/dtd/spring-beans.dtd"</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />
								</span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">beans </span>
								<span style="color: rgb(255, 0, 0);">default-autowire</span>
								<span style="color: rgb(0, 0, 255);">="no"</span>
								<span style="color: rgb(255, 0, 0);"> default-dependency-check</span>
								<span style="color: rgb(0, 0, 255);">="none"</span>
								<span style="color: rgb(255, 0, 0);">
										<br />         default-lazy-init</span>
								<span style="color: rgb(0, 0, 255);">="false"</span>
								<span style="color: rgb(0, 0, 255);">&gt;</span>
								<span style="color: rgb(0, 0, 0);">
										<br />    </span>
								<span style="color: rgb(0, 0, 255);">&lt;</span>
								<span style="color: rgb(128, 0, 0);">bean </span>
								<span style="color: rgb(255, 0, 0);">id</span>
								<span style="color: rgb(0, 0, 255);">="dataSource"</span>
								<span style="color: rgb(255, 0, 0);"> class</span>
								<span style="color: rgb(0, 0, 255);">="org.apache.commons.dbcp.BasicDataSource"</span> 
								<span style="color: rgb(255, 0, 0);"><br />         destroy-method</span><span style="color: rgb(0, 0, 255);">="close"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="driverClassName"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">com.microsoft.jdbc.sqlserver.SQLServerDriver</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="url"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;<br />              </span><span style="color: rgb(0, 0, 0);">jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=jsblog;SelectMethod=cursor<br />            </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="username"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">sa</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="password"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">jfy</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">bean</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">bean </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="sessionFactory"</span><span style="color: rgb(255, 0, 0);"><br />          class</span><span style="color: rgb(0, 0, 255);">="org.springframework.orm.hibernate.LocalSessionFactoryBean"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="dataSource"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">ref </span><span style="color: rgb(255, 0, 0);">local</span><span style="color: rgb(0, 0, 255);">="dataSource"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="mappingResources"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">com/jsblog/BlogUserForm.hbm.xml</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">list</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="hibernateProperties"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">props</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">prop </span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="hibernate.dialect"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                    net.sf.hibernate.dialect.SQLServerDialect<br />                </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">prop</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">prop </span><span style="color: rgb(255, 0, 0);">key</span><span style="color: rgb(0, 0, 255);">="hibernate.show_sql"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">true</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">prop</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">props</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">bean</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">bean </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="transactionManager"</span><span style="color: rgb(255, 0, 0);"><br />          class</span><span style="color: rgb(0, 0, 255);">="org.springframework.orm.hibernate.HibernateTransactionManager"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="sessionFactory"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">ref </span><span style="color: rgb(255, 0, 0);">local</span><span style="color: rgb(0, 0, 255);">="sessionFactory"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">bean</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">bean </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="baseDaoTarget"</span><span style="color: rgb(255, 0, 0);"> class</span><span style="color: rgb(0, 0, 255);">="com.jsblog.dao.BlogUserDao"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="sessionFactory"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">ref </span><span style="color: rgb(255, 0, 0);">local</span><span style="color: rgb(0, 0, 255);">="sessionFactory"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">bean</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">beans</span><span style="color: rgb(0, 0, 255);">&gt;</span></div>
						<br />
						<p>---------------------------------------------------------------------------<br /><br />BlogUserDao.java<br />---------------------------------------------------------------------------<br /></p>
						<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
								<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
								<span style="color: rgb(0, 0, 255);">package</span>
								<span style="color: rgb(0, 0, 0);"> com.jsblog.dao;<br /><br /></span>
								<span style="color: rgb(0, 0, 255);">import</span>
								<span style="color: rgb(0, 0, 0);"> org.springframework.orm.hibernate.support.HibernateDaoSupport;<br /></span>
								<span style="color: rgb(0, 0, 255);">import</span>
								<span style="color: rgb(0, 0, 0);"> org.springframework.orm.hibernate.HibernateCallback;<br /></span>
								<span style="color: rgb(0, 0, 255);">import</span>
								<span style="color: rgb(0, 0, 0);"> org.springframework.orm.hibernate.SessionFactoryUtils;<br /></span>
								<span style="color: rgb(0, 0, 255);">import</span>
								<span style="color: rgb(0, 0, 0);"> com.jsblog.BlogUserForm;<br /><br /></span>
								<span style="color: rgb(0, 0, 255);">import</span>
								<span style="color: rgb(0, 0, 0);"> java.io.Serializable;<br /></span>
								<span style="color: rgb(0, 0, 255);">import</span>
								<span style="color: rgb(0, 0, 0);"> java.util.List;<br /><br /></span>
								<span style="color: rgb(0, 0, 255);">import</span>
								<span style="color: rgb(0, 0, 0);"> net.sf.hibernate.HibernateException;<br /></span>
								<span style="color: rgb(0, 0, 255);">import</span>
								<span style="color: rgb(0, 0, 0);"> net.sf.hibernate.Session;<br /><br /></span>
								<span style="color: rgb(0, 0, 255);">public</span>
								<span style="color: rgb(0, 0, 0);"> </span>
								<span style="color: rgb(0, 0, 255);">class</span>
								<span style="color: rgb(0, 0, 0);"> BlogUserDao </span>
								<span style="color: rgb(0, 0, 255);">extends</span>
								<span style="color: rgb(0, 0, 0);"> HibernateDaoSupport </span>
								<span style="color: rgb(0, 0, 255);">implements</span>
								<span style="color: rgb(0, 0, 0);"> BaseDao {<br /><br />    </span>
								<span style="color: rgb(0, 0, 255);">public</span>
								<span style="color: rgb(0, 0, 0);"> </span>
								<span style="color: rgb(0, 0, 255);">void</span>
								<span style="color: rgb(0, 0, 0);"> insert(BlogUserForm bloguser) {<br />        getHibernateTemplate().save(bloguser);<br />    }<br />}</span>
						</div>
						<br />
				</div>
		</div>
<img src ="http://www.blogjava.net/Vencent/aggbug/40757.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Vencent/" target="_blank">Vincent Chen</a> 2006-04-13 00:31 <a href="http://www.blogjava.net/Vencent/articles/40757.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring学习资源</title><link>http://www.blogjava.net/Vencent/articles/38373.html</link><dc:creator>Vincent Chen</dc:creator><author>Vincent Chen</author><pubDate>Thu, 30 Mar 2006 14:55:00 GMT</pubDate><guid>http://www.blogjava.net/Vencent/articles/38373.html</guid><wfw:comment>http://www.blogjava.net/Vencent/comments/38373.html</wfw:comment><comments>http://www.blogjava.net/Vencent/articles/38373.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Vencent/comments/commentRss/38373.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Vencent/services/trackbacks/38373.html</trackback:ping><description><![CDATA[
		1、<a class="f20">Spring Live中文文档</a><p><a href="http://searchwebservices.techtarget.com.cn/wpsum/29/2217529.shtml?504">http://searchwebservices.techtarget.com.cn/wpsum/29/2217529.shtml?504</a></p><p>2、<a class="f20">Spring实战</a></p><p><a href="http://searchwebservices.techtarget.com.cn/wpsum/75/2215575.shtml?2994">http://searchwebservices.techtarget.com.cn/wpsum/75/2215575.shtml?2994</a></p><p>3、Spring - Java/J2EE Application Framework</p><p>Spring Framework 开发参考手册（中文版）</p><p><a href="http://www.jactiongroup.net/reference/html/index.html">http://www.jactiongroup.net/reference/html/index.html</a></p><p>4、<font size="2">Introducing to Spring Framework（中文修订版）</font></p><p><a href="http://spring.jactiongroup.net/viewtopic.php?t=453">http://spring.jactiongroup.net/viewtopic.php?t=453</a></p><p>5、<span style="font-weight: bold;">Spring Framework 介绍 （ppt培训文档）</span></p><p><span style="font-weight: bold;"><a href="http://www.jactiongroup.net/doc/Introduction2open-sourceSpringframework4J2EE.ppt" target="_blank"><font color="#006699">http://www.jactiongroup.net/doc/Introduction2open-sourceSpringframework4J2EE.ppt</font></a></span></p><p><span style="font-weight: bold;"><a href="http://www.jactiongroup.net/doc/IntroductionToSpring.ppt" target="_blank"><font color="#006699">http://www.jactiongroup.net/doc/IntroductionToSpring.ppt</font></a></span></p><p><span style="font-weight: bold;">6、Spring 中文社区</span></p><p><span style="font-weight: bold;"><a href="http://spring.jactiongroup.net/">http://spring.jactiongroup.net</a></span></p><p><span style="font-weight: bold;">7、中国IT实验室 Spring 框架完全进阶专题</span></p><p><span style="font-weight: bold;"><a href="http://www.chinaitlab.com/www/techspecial/spring/">http://www.chinaitlab.com/www/techspecial/spring/</a></span></p><p><span style="font-weight: bold;"></span></p><p><br />8、<a href="http://www.springframework.org/">http://www.springframework.org</a></p><img src ="http://www.blogjava.net/Vencent/aggbug/38373.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Vencent/" target="_blank">Vincent Chen</a> 2006-03-30 22:55 <a href="http://www.blogjava.net/Vencent/articles/38373.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring Framework标记库初学指南</title><link>http://www.blogjava.net/Vencent/articles/36954.html</link><dc:creator>Vincent Chen</dc:creator><author>Vincent Chen</author><pubDate>Wed, 22 Mar 2006 16:21:00 GMT</pubDate><guid>http://www.blogjava.net/Vencent/articles/36954.html</guid><wfw:comment>http://www.blogjava.net/Vencent/comments/36954.html</wfw:comment><comments>http://www.blogjava.net/Vencent/articles/36954.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Vencent/comments/commentRss/36954.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Vencent/services/trackbacks/36954.html</trackback:ping><description><![CDATA[
		<span class="article-table-text">Spring是一个服务于所有层面的application
framework:提供了bean的配置基础，AOP的支持，JDBC的提取框架,抽象事务支持，等等。它有一个非常显著的特点：在某个层面上如果你不
需要Spring的支持，你就可以不使用String的class，只使用它的某一部分的功能。从它的设计理念，你可以看到String帮助你实现了真正
的逻辑层和web层的分离。
<br /><br />　　相对于EJB来说，Spring是一个轻量级的J2EE应用开发框架。这里提到的轻量级指的是Spring框架本身，而不是说Spring只
能适用于轻量级的应用开发。Spring的轻盈体现在其框架本身的基础结构以及对其他应用工具的支持和装配能力，与EJB这种庞然大物相比，Spring
使我们把各个技术层次之间的风险降低。EJB的内聚性较强，比如数据持久层管理、事务管理、生命周期管理都全部交给了EJB容器中管理，内聚性的白盒特征
使我们必须放弃一部分可控性而去信任容器能力。而Spring则是考虑如何“不造轮子”，如何更好的组装这些轮子，让他们更好的转动。比如数据持久层管理
可以使用hibernate，日志管理可以使用jakartacommonlogging。一个比较恰当的比喻就是“我们要钉几个钉子，为了完成这个目
的，锤子生产商生产了大大小小一系列的锤子，每个锤子都有一套复杂的使用方法，用来钉某种特别的钉子，结果令我们头疼不堪。解决锤子过多的问题，通过
spring，我们可以使用几种锤子，但用起来象是只有一个锤子”。(注：这段话是在网上看见的，这里引用这个比喻，我个人觉得很生动)关于这个框架也有
一些简单的总结：“Spring有几个主要的部分：Bean+ApplicationContext，以一种统一的、IoC的方式查找、管理、组装、使用
系统的组件，取代一切工厂；持久化框架；web框架。“J2EE框架”是RodJohnson的愿景，他希望Spring为J2EE轻量级解决方案提供自
底至顶的全面基础设施支持。” <br />　　上面是关于一个新的Framework的简单介绍，据说是未来J2EE发展的方向。以前在论坛上有关于J2EE最佳组合的讨论，听说这个
JSTL+Struts(或webwork)+Spring+Hibernate的组合很被看好,如果你感兴趣的话，可以到
SpringFramework中文论坛上看看。下面转入本文的正题。
<br /><br />　　Spring 标记库介绍及用法：
<br /><br />　　本文将重点介绍Spring 提供的标记库及其用法：
<br /><br />　　当你在项目中用Spring Framework的时候，表现层可以选择Spring
Framework自带的标记库。当然，这不是你唯一的选择。你可以选择其它标记库或模板替换技术。Spring Framework
并没有为应用提供非常丰富的标记库。Spring Framework
提供的标记库仅仅是为了够用就行，它并不是无所不包的。呵呵，这点与Struts丰富的标记库不一样。其实这点符合RodJohnson的出发点，既“不
造轮子”。当然，Spring Framework标记库有它自身的特点，可以说是个有益的补充吧。
<br /><br />　　Spring 标记库分类如下：
<br /><br />　　1、spring:hasBindErrors 
<br /><br />　　2、spring:bind 
<br /><br />　　3、spring:transform 
<br /><br />　　4、spring:message 
<br /><br />　　5、spring:htmlEscape 
<br /><br />　　6、spring:theme 
<br /><br />　　下面我们来具体介绍一下用法：
<br /><br />　　1、spring:hasBindErrors 
<br /><br />　　对应org.springframework.web.servlet.tags.BindErrorsTag标记库处理类。
<br /><br />　　这个标记提供用于绑定对象的errors，如果这个标记被用到的话，那么关于这个对象的错误将在页面上显示出来。使用这个标记的前提条件是要
先使用＜spring:bind＞标记,并且＜spring:hasBindErrors＞这个标记不能用来表示对象的状态，它仅仅可以绑定对象本身和对
象的属性。 具体用法如下：
<br /><br />＜spring:hasBindErrors name="priceIncrease"＞ ＜b＞Please fix all errors!＜/b＞ ＜/spring:hasBindErrors＞
<br /><br />　　通过这个简单的例子，我来具体说一下这个标记的属性吧。
<br /><br />　　name：是要被检查的Bean的名字。这个属性是必需要的。
<br /><br />　　这里是简单用法，所以就不介绍它包含的errors变量了。具体看英语文档。下同。
<br /><br />　　2、spring:bind 
<br /><br />　　对应org.springframework.web.servlet.tags.BindTag标记库处理类
<br /><br />　　这个标记用来为某个bean或bean 的属性赋值，通常和form一起用，相当于action的作用。它指明表单要提交到那个类或类的属性中去。
<br /><br />　　其中path属性是必须的，指明转到的类的路径。举例如下：
<br /><br />＜form method="post"＞
<br />＜table width="95%" bgcolor="f8f8ff" border="0" cellspacing="0" cellpadding="5"＞
<br />＜tr＞ 
<br />＜td alignment="right" width="20%"＞Increase (%):＜/td＞ 
<br />＜spring:bind path="priceIncrease.percentage"＞ 
<br />＜td width="20%"＞ 
<br />＜input type="text" name="percentage" value="＜c:out value="${status.value}"/＞"＞ 
<br />＜/td＞
<br />＜td width="60%"＞ 
<br />＜font color="red"＞＜c:out value="${status.errorMessage}"/＞＜/font＞
<br />＜/td＞ 
<br />＜/spring:bind＞ 
<br />＜/tr＞
<br />＜/table＞ 
<br />＜br＞
<br />……………………省略
<br />＜/form＞ 
<br /><br />　3、spring:transform 
<br /><br />　　对应org.springframework.web.servlet.tags.TransformTag标记库处理类,这个标记用来转换
表单中不与bean中的属性一一对应的那些属性，通常和＜spring:bind＞一起使用。＜spring:transform＞标记为
＜spring:bind＞使用提供了更好的支持。
<br /><br />　　属性如下：
<br /><br />　　value：必需要的。和当前＜spring:bind＞标记指向的bean类相同。就是你要转换的实体类名。
<br /><br />　　var：不是必需的。这个字符串被用来绑定输出结果到page，request, session或application scope.默认情况输出到jsp中。
<br /><br />　　scope：不是必需的。前提条件var必须设置的情况下。它的值可以是page，request, session或application。
<br /><br />　　4、spring:message 对应org.springframework.web.servlet.tags.MessageTag标记库处理类
<br /><br />　　这个标记用来帮助springframework支持国际化。和JSTL的fmt:message标记类似。当然这个标记可以很好的工作的本地的springframework框架下。
<br /><br />　　属性如下：
<br /><br />　　code：不是必需的。用来查找message,如果没有被使用的话，text将被使用。
<br /><br />　　text：不是必需的。假如code不存在的话，默认是text输出。当code和text都没有设置的话，标记将输出为null.
<br /><br />　　var：不是必需的。这个字符串被用来绑定输出结果到page，request, session或application scope.默认情况输出到jsp中。
<br /><br />　　scope：不是必需的。前提条件var必须设置的情况下。它的值可以是page，request, session或application。
<br /><br />　　5、spring:htmlEscape 
<br /><br />　　对应org.springframework.web.servlet.tags.HtmlEscapeTag标记库处理类
<br /><br />　　不常用，这里省略
<br /><br />　　6、spring:theme 
<br /><br />　　对应org.springframework.web.servlet.tags.ThemeTag标记库处理类
<br /><br />　　不常用，这里省略
<br /><br />　　学习完这些用法后，让我们来看个具体的例子吧。
<br /><br />　　配置步骤如下：
<br /><br />　　目录结构图：
<br /><br />-spirngapp 
<br />-WEB-INF 
<br />-classes 
<br />-lib 
<br />-src 
<br />-war 
<br /><br />　　1、将spring.tld拷贝到WEB-INF目录。
<br /><br />　　2、将spring.jar拷贝到WEB-INF\lib包下
<br /><br />　　举例如下：
<br /><br />　　在web.xml中配置好taglib属性，代码如下：
<br /><br />＜?xml version="1.0" encoding="UTF-8"?＞
<br />＜!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'＞
<br />＜web-app＞
<br />＜servlet＞
<br />＜servlet-name＞springapp＜/servlet-name＞
<br />＜servlet-class＞org.springframework.web.servlet.DispatcherServlet＜/servlet-class＞
<br />＜load-on-startup＞1＜/load-on-startup＞
<br />＜/servlet＞ 
<br />＜servlet-mapping＞ 
<br />＜servlet-name＞springapp＜/servlet-name＞
<br />＜url-pattern＞*.htm＜/url-pattern＞ 
<br />＜/servlet-mapping＞
<br />＜welcome-file-list＞ 
<br />＜welcome-file＞ index.jsp ＜/welcome-file＞
<br />＜/welcome-file-list＞
<br />＜taglib＞
<br />＜taglib-uri＞/spring＜/taglib-uri＞
<br />＜taglib-location＞/WEB-INF/spring.tld＜/taglib-location＞
<br />＜/taglib＞
<br />＜/web-app＞ 
<br /><br />　　jsp页面代码如下：
<br /><br />＜%@ include file="/WEB-INF/jsp/include.jsp" %＞
<br />＜%@ taglib prefix="spring" uri="/spring" %＞
<br />＜html＞
<br />＜head＞
<br />＜title＞＜fmt:message key="title"/＞＜/title＞
<br />＜/head＞
<br />＜body＞
<br />＜h1＞
<br />＜fmt:message key="priceincrease.heading"/＞
<br />＜/h1＞
<br />＜form method="post"＞
<br />＜table width="95%" bgcolor="f8f8ff" border="0" cellspacing="0" cellpadding="5"＞ 
<br />＜tr＞
<br />＜td alignment="right" width="20%"＞Increase (%):＜/td＞ 
<br />＜spring:bind path="priceIncrease.percentage"＞
<br />＜td width="20%"＞
<br />＜input type="text" name="percentage" value="＜c:out value="${status.value}"/＞"＞ 
<br />＜/td＞ 
<br />＜td width="60%"＞
<br />＜font color="red"＞
<br />＜c:out value="${status.errorMessage}"/＞
<br />＜/font＞
<br />＜/td＞
<br />＜/spring:bind＞ 
<br />＜/tr＞
<br />＜/table＞
<br />＜br＞
<br />＜spring:hasBindErrors name="priceIncrease"＞
<br />＜b＞Please fix all errors!＜/b＞ 
<br />＜/spring:hasBindErrors＞ ＜br＞＜br＞
<br />＜input type="submit" alignment="center" value="Execute"＞
<br />＜/form＞
<br />＜a href="＜c:url value="hello.htm"/＞"＞Home＜/a＞
<br />＜/body＞
<br />＜/html＞ 
<br /><br />　　＜spring:bind＞标记经常用来绑定＜input＞表单元素以便提交给PriceIncrease.java,其实
PriceIncrease.java中就是包含一些getter和setter的方法的类。当用户按下按钮提交的时候，其表单中的值实际上就被
framework放到了PriceIncrease.java中。＜spring:bind＞经常和form一起使用.这个$
{status.errorMessage}和${status.value}是一个framework定义的特殊变量，它们被用来显示错误信息和当前表
单中的数据。呵呵，今天就到此为止吧，关于Spring Framework标记库的详细用法，请参考其文档。(转载文章请保留出处：<a href="http://www.javajia.com/">Java家(www.javajia.com)</a>)</span>
<img src ="http://www.blogjava.net/Vencent/aggbug/36954.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Vencent/" target="_blank">Vincent Chen</a> 2006-03-23 00:21 <a href="http://www.blogjava.net/Vencent/articles/36954.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>