<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Java堂 &#187; javaee</title>
	<atom:link href="http://www.javatang.com/archives/tag/javaee/feed" rel="self" type="application/rss+xml" />
	<link>http://www.javatang.com</link>
	<description>Java Tang</description>
	<lastBuildDate>Thu, 08 Dec 2011 08:29:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Spring+Velocity中模板路径的问题</title>
		<link>http://www.javatang.com/archives/2008/06/26/5407270.html</link>
		<comments>http://www.javatang.com/archives/2008/06/26/5407270.html#comments</comments>
		<pubDate>Thu, 26 Jun 2008 13:54:07 +0000</pubDate>
		<dc:creator>Jet</dc:creator>
				<category><![CDATA[JavaPlateform]]></category>
		<category><![CDATA[javaee]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[velocity]]></category>

		<guid isPermaLink="false">http://www.javatang.com/archives/2008/06/26/5407270.html</guid>
		<description><![CDATA[在Spring中使用Velocity进行视图渲染的时候需要注意一个路径的设置问题。Spring本身提供了一个用于对Velocity进行设置的类，我们做如下设置： &#60;bean id=&#34;velocityConfig&#34; class=&#34;org.springframework.web.servlet.view.velocity.VelocityConfigurer&#34;&#62; &#160; &#160; &#160; &#160; &#60;property&#160;name=&#34;configLocation&#34; value=&#34;/WEB-INF/velocity.properties&#34; /&#62; &#160; &#160; &#160; &#160; &#60;property&#160;name=&#34;resourceLoaderPath&#34; value=&#34;/WEB-INF/templates&#34; /&#62; &#160; &#160; &#60;/bean&#62; 使用configLocation属性设置了velocity配置文件的路径及文件名，而resourceLoaderPath设置了模板文件所在的位置。这里我们看到，所有的设置路径都是基于网站根目录的。 这个时候对于velocity.properties中用于设置宏文件的velocimacro.library选项而言，他所对应的目录就是前面resourceLoaderPath中设置的目录了，比如我们可以设置如下： velocimacro.library = macro.vm 并且对于模板文件中#parse指令所包含的文件也是基于resourceLoaderPath中所设置的目录。 如果我们将resourceLoaderPath设置为网站跟目录，而模板文件放在了/WEB-INF/template下，这个时候velocimacro.library和#parse指令所包含的文件路径就是基于网站根目录了，例如有个section.vm文件放在了/WEB-INF/template目录下，这个时候在模板文件中必须写成#parse(“/WEB-INF/template/section.vm”)才可以，可以看出这样非常的麻烦。 因此我们不能想当然的将resourceLoaderPath设置为网站的根目录，而是直接指向模板文件所在的目录。或许你认为我这么说有些可笑，但是有的时候我们往往在这些看似不经意的问题上浪费时间。 Related Posts:Velocity 升级为Apache的顶级项目Spring MVC中修改校验的异常信息如何使用DWR2.0的注解功能Apache和Resin组合时UrlRewriteFilter失效的解决方法Resin 3.0.x 经验总结]]></description>
			<content:encoded><![CDATA[<p>在Spring中使用Velocity进行视图渲染的时候需要注意一个路径的设置问题。Spring本身提供了一个用于对Velocity进行设置的类，我们做如下设置：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Olive;">&lt;</span><span style="color: Green;">bean</span><span style="color: Gray;"> </span><span style="color: #00008b;">id</span><span style="color: Gray;">=</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">velocityConfig</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> </span><span style="color: #00008b;">class</span><span style="color: Gray;">=</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">org.springframework.web.servlet.view.velocity.VelocityConfigurer</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">property</span><span style="color: Gray;">&nbsp;</span><span style="color: #00008b;">name</span><span style="color: Gray;">=</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">configLocation</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> </span><span style="color: #00008b;">value</span><span style="color: Gray;">=</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">/WEB-INF/velocity.properties</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> </span><span style="color: Olive;">/&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">property</span><span style="color: Gray;">&nbsp;</span><span style="color: #00008b;">name</span><span style="color: Gray;">=</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">resourceLoaderPath</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> </span><span style="color: #00008b;">value</span><span style="color: Gray;">=</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">/WEB-INF/templates</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> </span><span style="color: Olive;">/&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Olive;">&lt;/</span><span style="color: Green;">bean</span><span style="color: Olive;">&gt;</span></li></ol></div>
<p>使用configLocation属性设置了velocity配置文件的路径及文件名，而resourceLoaderPath设置了模板文件所在的位置。这里我们看到，所有的设置路径都是基于网站根目录的。</p>
<p>这个时候对于velocity.properties中用于设置宏文件的velocimacro.library选项而言，他所对应的目录就是前面resourceLoaderPath中设置的目录了，比如我们可以设置如下：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">velocimacro.library = macro.vm</li></ol></div>
<p>并且对于模板文件中#parse指令所包含的文件也是基于resourceLoaderPath中所设置的目录。</p>
<p>如果我们将resourceLoaderPath设置为网站跟目录，而模板文件放在了/WEB-INF/template下，这个时候velocimacro.library和#parse指令所包含的文件路径就是基于网站根目录了，例如有个section.vm文件放在了/WEB-INF/template目录下，这个时候在模板文件中必须写成#parse(“/WEB-INF/template/section.vm”)才可以，可以看出这样非常的麻烦。</p>
<p>因此我们不能想当然的将resourceLoaderPath设置为网站的根目录，而是直接指向模板文件所在的目录。或许你认为我这么说有些可笑，但是有的时候我们往往在这些看似不经意的问题上浪费时间。</p>
<div id="crp_related"><h2>Related Posts:</h2><ul><li><a href="http://www.javatang.com/archives/2007/03/12/1754126.html" rel="bookmark" class="crp_title">Velocity 升级为Apache的顶级项目</a></li><li><a href="http://www.javatang.com/archives/2010/11/23/5817513.html" rel="bookmark" class="crp_title">Spring MVC中修改校验的异常信息</a></li><li><a href="http://www.javatang.com/archives/2008/07/07/5648271.html" rel="bookmark" class="crp_title">如何使用DWR2.0的注解功能</a></li><li><a href="http://www.javatang.com/archives/2010/08/27/3629451.html" rel="bookmark" class="crp_title">Apache和Resin组合时UrlRewriteFilter失效的解决方法</a></li><li><a href="http://www.javatang.com/archives/2006/08/21/010658.html" rel="bookmark" class="crp_title">Resin 3.0.x 经验总结</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.javatang.com/archives/2008/06/26/5407270.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>程序员自创的一首歌 &#8211; “Java EE 5″</title>
		<link>http://www.javatang.com/archives/2006/09/18/544867.html</link>
		<comments>http://www.javatang.com/archives/2006/09/18/544867.html#comments</comments>
		<pubDate>Sun, 17 Sep 2006 18:54:48 +0000</pubDate>
		<dc:creator>Jet</dc:creator>
				<category><![CDATA[JavaPlateform]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[javaee]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Sun公司一名员工自己创作的歌，关于Java EE 5，很有意思的一首歌，程序员业余生活也可以这么丰富！ MP3地址：远程 本地 Ladies and gentlemen, this is Java EE 5! One, two, three, four, five There’s a technology I use day and night For my application with a web frontend They told me to use .Net But I really don′t wanna So many bugs I fixed last week. My code is neat [...]]]></description>
			<content:encoded><![CDATA[<p class="storycontent">Sun公司一名员工自己创作的歌，关于Java EE 5，很有意思的一首歌，程序员业余生活也可以这么丰富！</p>
<p>MP3地址：<a href="http://tap.javalobby.org/javaee5.mp3">远程</a> <a href="http://www.javatang.com/_download/javaee5.mp3">本地</a></p>
<blockquote><p>Ladies and gentlemen, this is Java EE 5!</p>
<p>One, two, three, four, five<br />
There’s a technology I use day and night<br />
For my application with a web frontend<br />
They told me to use .Net<br />
But I really don′t wanna</p>
<p>So many bugs I fixed last week.<br />
My code is neat and talk is a cheap<br />
I like Glassfish, JSF, persistence API<br />
And as I continue you know they′re gettin′ sweeter</p>
<p>So what can I do I really beg you my Lord<br />
To me codin’ it′s just like a sport<br />
All the bad code from the past, let me dump it<br />
Please set in the trumpet</p>
<p>A little bit of injection in my life<br />
A little bit of persistence by my side<br />
A little bit of NetBeans is all I need<br />
A little bit of EJB’s what I see<br />
A little bit of standards in the sun<br />
A little bit of XML all night long<br />
A little bit web services here I am<br />
A little bit of code makes me real man</p>
<p>This is Java EE 5!</p>
<p>Jump up and down and move your code around<br />
Shake your head to the sound bury bad code under ground<br />
Move one step left and one step right<br />
One to the front and one to the side<br />
Refactor it once and refactor it twice<br />
If it looks like this you’re doin′ it right</p>
<p>A little bit of injection in my life<br />
A little bit of persistence by my side<br />
A little bit of NetBeans is all I need<br />
A little bit of EJB’s is what I see<br />
A little bit of standards in the sun<br />
A little bit of XML all night long<br />
A little bit web services here I am<br />
A little bit of code makes me real man</p>
<p>This is Java EE 5!</p></blockquote>
<div id="crp_related"><h2>Related Posts:</h2><ul><li><a href="http://www.javatang.com/archives/2006/03/09/37292.html" rel="bookmark" class="crp_title">Code Test</a></li><li><a href="http://www.javatang.com/archives/2010/11/23/5817513.html" rel="bookmark" class="crp_title">Spring MVC中修改校验的异常信息</a></li><li><a href="http://www.javatang.com/archives/2006/03/16/11399.html" rel="bookmark" class="crp_title">非常棒的JS的Eclipse插件 &#8211; JSEclipse</a></li><li><a href="http://www.javatang.com/archives/2006/06/13/370442.html" rel="bookmark" class="crp_title">ORA-00600: internal error code, arguments: …</a></li><li><a href="http://www.javatang.com/archives/2006/10/10/444472.html" rel="bookmark" class="crp_title">遇到一个JDK5.0 Update7 以前的bug</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.javatang.com/archives/2006/09/18/544867.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://tap.javalobby.org/javaee5.mp3" length="2691998" type="audio/mpeg" />
<enclosure url="http://www.javatang.com/_download/javaee5.mp3" length="2691998" type="audio/mpeg" />
		</item>
		<item>
		<title>使用Velocity犯的低级错误</title>
		<link>http://www.javatang.com/archives/2006/04/26/322220.html</link>
		<comments>http://www.javatang.com/archives/2006/04/26/322220.html#comments</comments>
		<pubDate>Tue, 25 Apr 2006 16:32:22 +0000</pubDate>
		<dc:creator>Jet</dc:creator>
				<category><![CDATA[JavaPlateform]]></category>
		<category><![CDATA[javaee]]></category>
		<category><![CDATA[velocity]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://www.javatang.com/archives/2006/04/26/322220.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.javatang.com @ 2012-02-10 07:35:48 -->
