﻿<?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-云自无心水自闲-随笔分类-Appfuse</title><link>http://www.blogjava.net/usherlight/category/20411.html</link><description>天平山上白云泉，云自无心水自闲。何必奔冲山下去，更添波浪向人间！</description><language>zh-cn</language><lastBuildDate>Mon, 17 Sep 2007 12:13:09 GMT</lastBuildDate><pubDate>Mon, 17 Sep 2007 12:13:09 GMT</pubDate><ttl>60</ttl><item><title>Appfuse 2.0RC1 published</title><link>http://www.blogjava.net/usherlight/archive/2007/09/17/145804.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Mon, 17 Sep 2007 04:42:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/09/17/145804.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/145804.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/09/17/145804.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/145804.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/145804.html</trackback:ping><description><![CDATA[<p>On Sep 4, Matt Raible annouced the release of AppFuse 2.0RC1.<br />
On Sep 7, Matt Raible uploaded a PDF to appfuse.dev.java.net contains the relevant pages from the wiki that help you develop with AppFuse 2.0.<br />
And yesterday, Matt Raible uploaded a big package to appfuse.dev.java.net. It included all the dependencies of the appfuse2.0 RC1 needed.</p>
good job, Matt.<img src ="http://www.blogjava.net/usherlight/aggbug/145804.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-09-17 12:42 <a href="http://www.blogjava.net/usherlight/archive/2007/09/17/145804.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring 的容器</title><link>http://www.blogjava.net/usherlight/archive/2007/08/23/138716.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Wed, 22 Aug 2007 16:12:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/08/23/138716.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/138716.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/08/23/138716.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/138716.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/138716.html</trackback:ping><description><![CDATA[<p>Spring的关键之一就是容器，在Spring中主要是两种容器：一个是BeanFactory，一个是ApplicationContext。<br>容器的作用是，管理所有的bean的生命周期，从创建bean的实例开始，到最后bean的消亡。<br>这两种容器的作用基本相同，但是Application Context是BeanFactory的子类，增加了一些功能，所以更为强大一些，主要体现在3个方面：<br>1. 能解析文本消息，提供文本的国际化（I18N）。<br>2. ApplicationContext提供一种通用的方法来加载文件资源，比如：图像文件。<br>3. 能够发布事件到注册的监听器。<br>所以，在大多数应用中，都使用Application Context。</p>
<p>ApplicationContext接口的实现类有很多，但常用的有3个：<br>1. ClassPathXmlApplicationContext<br>2. FileSystemXmlApplicationContext<br>3. XmlWebApplicationContext</p>
<p>ApplicationContext和BeanFactory的另一个区别在于对singleton bean的加载上。Bean Factory延迟加载所有的bean直到getBean()的调用，而ApplicationContext稍微智能一些，预先加载所有的singleton bean。</p><img src ="http://www.blogjava.net/usherlight/aggbug/138716.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-08-23 00:12 <a href="http://www.blogjava.net/usherlight/archive/2007/08/23/138716.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Appfuse2.0与Eclipse的真正整合</title><link>http://www.blogjava.net/usherlight/archive/2007/08/08/135365.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Wed, 08 Aug 2007 14:37:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/08/08/135365.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/135365.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/08/08/135365.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/135365.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/135365.html</trackback:ping><description><![CDATA[<p>1. 安装Mysql，Maven等等。这些在网上都有详细的说明。<br>2. 我更改了Maven的Repository的路径，缺省是放在C:\document and settings\&lt;user name&gt;\.m2\repository目录下，我觉得放在C:下不好，所以更换了路径。<br>打开～maven/conf/setting.xml，修改&lt;localRepository&gt;的值。</p>
<p>3. 使用Maven下载appfuse<br>我使用的是struts所以，使用的命令是：<br>mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=appfuse<br>这里，我把下载的目录名改为了appfuse，在appfuse.org的quick start中是使用myproject的。</p>
<p>4. 运行的过程中，会出错，我在两台机器上都遇到了错误。<br>关系不大。可以继续进行。</p>
<p>5. 下载源代码。<br>我是在Eclipse中使用Subversion下载的，可以使用mvn appfuse:full-source，但是只能下载到web下的代码，service, data等部分的代码就没有了。<br>Svn的Repository的地址是：<a href="https://appfuse.dev.java.net/svn/appfuse">https://appfuse.dev.java.net/svn/appfuse</a></p>
<p>6. Java Source Code已经尽在掌握了，只是还分布在不同的目录里。<br>分别是在：data，service，webapp，都在main\java目录下。</p>
<p>7. 开始获取jsp，配置文件等。<br>首先cd ~maven\repo\org\hibernate\jtidy\r8-20060801<br>edit jtidy-r8-20060801.pom<br>去掉一个重复的 &lt;licenses&gt; 标签.</p>
<p>8. 去掉mysql的root用户的密码，<br>update user set password=password('') where user='root'; flush privileges;</p>
<p>9. cd appfuse<br>mvn integration-test<br>在appfuse-snapshot1.0目录下，把jsp、image,js,css等全部复制过来<br>另外，还有很多配置文件，象applicationContext-dao.xml等等。<br>还有一个，就是library了。其中有一个要注意的是ehcache需要使用1.3.0, 如果使用1.2.X，会报<br>javax.servlet.ServletException: Failure when attempting to set Content-Encoding: gzip<br>这个错误。</p>
<p>10. 我是使用Eclipse的Tomcat插件的，因此，建立了一个Tomcat project<br>把Java源文件复制到web-inf\src下，<br>org.appfuse.dao<br>org.appfuse.model<br>org.appfuse.service<br>org.appfuse.util<br>org.appfuse.webapp（Webapp目录下）<br>另外，<br>common<br>decorators<br>images<br>scripts<br>styles<br>template<br>403.jsp<br>404.jsp<br>index.jsp.......<br>还有web-inf目录下的：<br>数10个配置文件和lib目录下数10个jar文件<br><br>11. 启动Tomcat插件，在浏览器中浏览：http://localhost:8080/appfuse/index.jsp<br>用户:admin 密码：admin<br>OK.<br><br>之所以，这么麻烦的折腾，主要是想在appfuse应用中，打断点，进行逐步跟踪。充分了解认知演习appfuse的细节。</p><img src ="http://www.blogjava.net/usherlight/aggbug/135365.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-08-08 22:37 <a href="http://www.blogjava.net/usherlight/archive/2007/08/08/135365.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>appfuse 1.9.4 学习心得 －Ant脚本简化-AppGen</title><link>http://www.blogjava.net/usherlight/archive/2007/03/19/104705.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Mon, 19 Mar 2007 04:10:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/03/19/104705.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/104705.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/03/19/104705.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/104705.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/104705.html</trackback:ping><description><![CDATA[<p>AppGen<br />1、在AppGen中没有能够生成Struts的Form<br />在gen的target的中，添加生成Struts Form的子任务<br />        &lt;!-- generate struts forms --&gt;<br />        &lt;xdoclet destdir="${build.dir}/${gen.dir}/web" excludedtags="@version,@author"<br />            addedtags="@xdoclet-generated at ${TODAY}" force="${xdoclet.force}" <br />            mergedir="metadata/web"&gt;<br />            &lt;fileset dir="F:\\Java\\Eclipse\\Space\\appfuse\\WEB-INF\\src"/&gt;</p>
		<p>            &lt;configParam name="basePackageName" value="org.appfuse"/&gt;</p>
		<p>            &lt;!-- generate struts forms --&gt;<br />            &lt;actionform templateFile="${template.dir}/generic/struts_form.xdt"&gt;<br />                &lt;packageSubstitution packages="model" substituteWith="webapp.form"/&gt;<br />            &lt;/actionform&gt;<br />        &lt;/xdoclet&gt;</p>
		<p>2、在AppGen中没有能够生成struts-config.xml<br />在gen的target中添加生成Struts-config.xml的子任务。<br />        &lt;taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask"&gt;<br />            &lt;classpath&gt;<br />                &lt;path refid="xdoclet.classpath"/&gt;<br />                &lt;path refid="web.libs.classpath"/&gt;<br />            &lt;/classpath&gt;<br />        &lt;/taskdef&gt;<br />        &lt;webdoclet destdir="build/gen/web/WEB-INF" force="true"<br />            mergedir="metadata/web" excludedtags="@version,@author" verbose="true"&gt;<br />            &lt;fileset dir="${model.src.dir}"/&gt;<br />            &lt;strutsconfigxml validateXML="true" version="1.2"/&gt;<br />            &lt;strutsvalidationxml version="1.1.3"/&gt;<br />        &lt;/webdoclet&gt;<br />其中需要注意的是web.libs.classpath，一开始我没有添加这些库，结果无法正确生成配置文件。<br />在Appfuse中，大多数的Action是继承BaseAction的，只有UploadAction是直接继承Struts的Action；在没有添加库文件时，生成的struts-config.xml只包含一个UploadAction的映射。<br />添加完整的库文件后，才能生成正确的配置文件。<br /><br />最后整理一下，使用AppGen生成的文件：<br /><br />1、ApplicationContext-hibernate.xml中添加personDao的配置，ApplicationContext-service.xml中添加personManager的配置<br />2、PersonDaoHibernate.java，PersonManager.java，PersonManagerImpl.java，PersonAction.java，PersonForm.java，PersonAction.java<br />3、PersonForm.jsp，PersonList.jsp<br />4、struts-config.xml覆盖<br />5、menu-config-Person.xml合并到menu-config.xml中，menu-Person.jsp添加到common\menu.jsp中<br />6、sample-data-Person.xml，用于测试的数据</p><img src ="http://www.blogjava.net/usherlight/aggbug/104705.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-03-19 12:10 <a href="http://www.blogjava.net/usherlight/archive/2007/03/19/104705.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>appfuse 1.9.4 学习心得 －Ant脚本简化</title><link>http://www.blogjava.net/usherlight/archive/2007/03/15/104115.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Thu, 15 Mar 2007 15:23:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/03/15/104115.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/104115.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/03/15/104115.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/104115.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/104115.html</trackback:ping><description><![CDATA[<p>Appfuse中与数据库有关的有用的脚本只有少数的几个，其他还有一些新建、编译、打包、部署、安装等等，由于我是在Eclipse环境下，使用Tomcat插件进行开发，对于这些其实不需要特别的关心。<br />列举一下我认为有用的：<br />1、hibernatedoclet<br />使用xdoclet生成Hibernate的映射文件hbm.xml。<br />2、db-prepare<br />使用hbm2ddl使用并执行create-table.sql，根据hbm在数据库中建立数据表。要注意的是，生成过程还需要POJO的class。<br />3、db-load<br />使用dbunit将Xml格式的数据insert到数据库中。</p>
		<p>目前我的build.xml中只包含这几个target。</p>
		<p>另外，AppGen的build.xml中，我认为有用的也主要是init和gen这两个target。<br />其中init用于交互输入参数，而gen是使用xdoclet根据模板生成Actions/Controllers, Action/Controller Tests, test data, i18n keys and JSPs。</p><img src ="http://www.blogjava.net/usherlight/aggbug/104115.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-03-15 23:23 <a href="http://www.blogjava.net/usherlight/archive/2007/03/15/104115.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>appfuse 1.9.4 学习心得 －创建新的Manager</title><link>http://www.blogjava.net/usherlight/archive/2007/03/14/103794.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Wed, 14 Mar 2007 07:09:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/03/14/103794.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/103794.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/03/14/103794.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/103794.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/103794.html</trackback:ping><description><![CDATA[<p>这几天在作Raible的Tutorial，前两天做了Create Dao &amp; POJO， 今天做Create Manager。<br />中间有一些过程与大家分享一下：<br />在PersonManagerTest的单元测试中，在Raible的教程中，说需要在applicationContext-service.xml中添加PersonManager这个bean的配置，但是实际上我没有添加配置，单元测试就成功了，为什么？<br />原因：在教程中的Test使用了Mock，好像并没有真正的使用其他关联的类，现在采用真正的测试类，下面注释掉的是教程中的测试类。：<br /><br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #0000ff">package</span>
				<span style="COLOR: #000000"> org.appfuse.service;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">import java.util.List;</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> org.appfuse.model.Person;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> org.springframework.context.support.ClassPathXmlApplicationContext;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> org.springframework.dao.DataAccessException;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> org.springframework.context.ApplicationContext;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_331_1791_Open_Image" onclick="this.style.display='none'; Codehighlighter1_331_1791_Open_Text.style.display='none'; Codehighlighter1_331_1791_Closed_Image.style.display='inline'; Codehighlighter1_331_1791_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_331_1791_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_331_1791_Closed_Text.style.display='none'; Codehighlighter1_331_1791_Open_Image.style.display='inline'; Codehighlighter1_331_1791_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> PersonManagerTest </span>
				<span style="COLOR: #0000ff">extends</span>
				<span style="COLOR: #000000"> BaseManagerTestCase </span>
				<span id="Codehighlighter1_331_1791_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_331_1791_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">private</span>
						<span style="COLOR: #000000"> Person person </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">private</span>
						<span style="COLOR: #000000"> PersonManager mgr </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_451_657_Open_Image" onclick="this.style.display='none'; Codehighlighter1_451_657_Open_Text.style.display='none'; Codehighlighter1_451_657_Closed_Image.style.display='inline'; Codehighlighter1_451_657_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_451_657_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_451_657_Closed_Text.style.display='none'; Codehighlighter1_451_657_Open_Image.style.display='inline'; Codehighlighter1_451_657_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">protected</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> setUp() </span>
						<span style="COLOR: #0000ff">throws</span>
						<span style="COLOR: #000000"> Exception </span>
						<span id="Codehighlighter1_451_657_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_451_657_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">super</span>
								<span style="COLOR: #000000">.setUp();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        ApplicationContext ctx </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> ClassPathXmlApplicationContext(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">org/appfuse/service/applicationContext-*.xml</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        mgr </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> (PersonManager) ctx.getBean(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">personManager</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
								<img id="Codehighlighter1_707_759_Open_Image" onclick="this.style.display='none'; Codehighlighter1_707_759_Open_Text.style.display='none'; Codehighlighter1_707_759_Closed_Image.style.display='inline'; Codehighlighter1_707_759_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_707_759_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_707_759_Closed_Text.style.display='none'; Codehighlighter1_707_759_Open_Image.style.display='inline'; Codehighlighter1_707_759_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">protected</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> tearDown() </span>
						<span style="COLOR: #0000ff">throws</span>
						<span style="COLOR: #000000"> Exception </span>
						<span id="Codehighlighter1_707_759_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_707_759_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">super</span>
								<span style="COLOR: #000000">.tearDown();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        mgr </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">null</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img id="Codehighlighter1_815_905_Open_Image" onclick="this.style.display='none'; Codehighlighter1_815_905_Open_Text.style.display='none'; Codehighlighter1_815_905_Closed_Image.style.display='inline'; Codehighlighter1_815_905_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_815_905_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_815_905_Closed_Text.style.display='none'; Codehighlighter1_815_905_Open_Image.style.display='inline'; Codehighlighter1_815_905_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> testGetPerson() </span>
						<span style="COLOR: #0000ff">throws</span>
						<span style="COLOR: #000000"> Exception </span>
						<span id="Codehighlighter1_815_905_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_815_905_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        person </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> mgr.getPerson(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        assertNotNull(person.getFirstName());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
								<img id="Codehighlighter1_958_1124_Open_Image" onclick="this.style.display='none'; Codehighlighter1_958_1124_Open_Text.style.display='none'; Codehighlighter1_958_1124_Closed_Image.style.display='inline'; Codehighlighter1_958_1124_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_958_1124_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_958_1124_Closed_Text.style.display='none'; Codehighlighter1_958_1124_Open_Image.style.display='inline'; Codehighlighter1_958_1124_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> testSavePerson() </span>
						<span style="COLOR: #0000ff">throws</span>
						<span style="COLOR: #000000"> Exception </span>
						<span id="Codehighlighter1_958_1124_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_958_1124_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        person </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> mgr.getPerson(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">1</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        person.setFirstName(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">test</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        mgr.savePerson(person);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        assertEquals(person.getFirstName(), </span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">test</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
								<img id="Codehighlighter1_1185_1789_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1185_1789_Open_Text.style.display='none'; Codehighlighter1_1185_1789_Closed_Image.style.display='inline'; Codehighlighter1_1185_1789_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_1185_1789_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1185_1789_Closed_Text.style.display='none'; Codehighlighter1_1185_1789_Open_Image.style.display='inline'; Codehighlighter1_1185_1789_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> testAddAndRemovePerson() </span>
						<span style="COLOR: #0000ff">throws</span>
						<span style="COLOR: #000000"> Exception </span>
						<span id="Codehighlighter1_1185_1789_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_1185_1789_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        person </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> Person();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        person </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> (Person) populate(person);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        mgr.savePerson(person);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        assertEquals(person.getFirstName(), </span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Bill</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        assertNotNull(person.getId());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        log.debug(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">removing person, personId: </span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">+</span>
								<span style="COLOR: #000000"> person.getId());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        mgr.removePerson(person.getId().toString());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_1522_1641_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1522_1641_Open_Text.style.display='none'; Codehighlighter1_1522_1641_Closed_Image.style.display='inline'; Codehighlighter1_1522_1641_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1522_1641_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1522_1641_Closed_Text.style.display='none'; Codehighlighter1_1522_1641_Open_Image.style.display='inline'; Codehighlighter1_1522_1641_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">try</span>
								<span style="COLOR: #000000"> </span>
								<span id="Codehighlighter1_1522_1641_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.blogjava.net/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_1522_1641_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            person </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> mgr.getPerson(person.getId().toString());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            fail(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">Person found in database</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">);<br /><img id="Codehighlighter1_1675_1783_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1675_1783_Open_Text.style.display='none'; Codehighlighter1_1675_1783_Closed_Image.style.display='inline'; Codehighlighter1_1675_1783_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1675_1783_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1675_1783_Closed_Text.style.display='none'; Codehighlighter1_1675_1783_Open_Image.style.display='inline'; Codehighlighter1_1675_1783_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">catch</span>
								<span style="COLOR: #000000"> (DataAccessException dae) </span>
								<span id="Codehighlighter1_1675_1783_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.blogjava.net/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_1675_1783_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            log.debug(</span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000">Expected exception: </span>
										<span style="COLOR: #000000">"</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #000000">+</span>
										<span style="COLOR: #000000"> dae.getMessage());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            assertNotNull(dae);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
		<p>
				<br />
				<br />
		</p>
		<p>现在如果不在applicationContext-service.xml中添加bean的配置后，JUnit报错说找不到personManager。另外还需要把applicationContext-hibernate.xml和applicationContext-resources.xml也拷贝到WEB-INF/src/org/appfuse/service目录下，这样Context才能Load成功。<br />现在运行Test，GetPerson和SavePerson都测试通过，而AddAndRemovePerson报了一个NullPointerExceptoin错误。原来缺少了PersonManagerTest.properties这个文件，这个文件是用于populate初始化Person实例的。</p><img src ="http://www.blogjava.net/usherlight/aggbug/103794.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-03-14 15:09 <a href="http://www.blogjava.net/usherlight/archive/2007/03/14/103794.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>appfuse 1.9.4 学习心得 III</title><link>http://www.blogjava.net/usherlight/archive/2007/03/08/102540.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Thu, 08 Mar 2007 01:51:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/03/08/102540.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/102540.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/03/08/102540.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/102540.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/102540.html</trackback:ping><description><![CDATA[<p>index.jsp重定向到mainMenu.html，但其实mainMenu.html并不是一个真正的存在的Html页面。<br />在appfuse中，Struts的Action的后缀使用的是不是常见的.do，而使用的是.html。<br />见Web.xml：<br /><br />    &lt;servlet-mapping&gt;<br />        &lt;servlet-name&gt;action&lt;/servlet-name&gt;<br />        &lt;url-pattern&gt;*.html&lt;/url-pattern&gt;<br />    &lt;/servlet-mapping&gt;<br /><br /><br />因此，查看struts-config.xml，发现/menuMenu只是简单地Forward到/WEB-INF/pages/mainMenu.jsp。<br />所以，在此处显示的内容是mainMenu.jsp的内容。<br /><br />mainMenu.jsp页面中的内容不多，只有一个简单的列表，包含两个链接：编辑信息、上传文件。</p>
		<p>现在需要仔细研究一下菜单的显示了。可以看到在menuMenu.jsp和login.jsp中都没有菜单的定义和显示。其实菜单的定义和显示还是在前面说到的default.jsp中。<br />default.jsp中如下一段代码：</p>
		<p>            &lt;c:set var="currentMenu" scope="request"&gt;&lt;decorator:getProperty property="meta.menu"/&gt;&lt;/c:set&gt;<br />            &lt;c:if test="${currentMenu == 'AdminMenu'}"&gt;<br />            &lt;div id="sub"&gt;<br />                &lt;menu:useMenuDisplayer name="Velocity" config="WEB-INF/classes/cssVerticalMenu.vm" permissions="rolesAdapter"&gt;<br />                    &lt;menu:displayMenu name="AdminMenu"/&gt;<br />                &lt;/menu:useMenuDisplayer&gt;<br />            &lt;/div&gt;<br />            &lt;/c:if&gt;</p>
		<p>            &lt;div id="nav"&gt;<br />                &lt;div class="wrapper"&gt;<br />                    &lt;h2 class="accessibility"&gt;Navigation&lt;/h2&gt;<br />                    &lt;jsp:include page="/common/menu.jsp"/&gt;<br />                &lt;/div&gt;<br />                &lt;hr /&gt;<br />            &lt;/div&gt;&lt;!-- end nav --&gt;</p>
		<p>首先从页面中取出meta.menu的值，这个值在login.jsp中是： &lt;meta name="menu" content="Login"/&gt;<br />在mainMenu.jsp中是：&lt;meta name="menu" content="MainMenu"/&gt;<br />所以，login.jsp中 test="${currentMenu == 'AdminMenu'}" 都不通过。每一部分的内容在这两个页面中都不显示。</p>
		<p>下面的一部分是common/menu.jsp，主要是一个menu:useMenuDisplayer<br />显示的菜单第一个进行了判断，&lt;c:if test="${empty pageContext.request.remoteUser}"&gt;<br />查看Jsp容器中维护的认证中当前用户是否为空，如果成功登录，则这个值即为登录用户名，否则为空。<br />也就是说，如果没有成功登录，则会显示登录菜单&lt;li&gt;&lt;a href="&lt;c:url value="/login.jsp"/&gt;" class="current"&gt;&lt;fmt:message key="login.title"/&gt;&lt;/a&gt;&lt;/li&gt;。<br /><br />除了刚才的第一个登录项以外，还有5条菜单菜单项，这5个菜单项使用的是struts-menu的标准用法，而不是象刚才那样直接HTML的输出。<br />    &lt;menu:displayMenu name="MainMenu"/&gt;<br />    &lt;menu:displayMenu name="UserMenu"/&gt;<br />    &lt;menu:displayMenu name="FileUpload"/&gt;<br />    &lt;menu:displayMenu name="AdminMenu"/&gt;<br />    &lt;menu:displayMenu name="Logout"/&gt;<br />查看menu-config.xml，可以发现，只有第一的菜单项MainMenu没有定义角色<br /><br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">MenuConfig</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Displayers</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Displayer </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="Velocity"</span>
				<span style="COLOR: #ff0000"> type</span>
				<span style="COLOR: #0000ff">="net.sf.navigator.displayer.VelocityMenuDisplayer"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">Displayers</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Menus</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Menu </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="MainMenu"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="mainMenu.title"</span>
				<span style="COLOR: #ff0000"> page</span>
				<span style="COLOR: #0000ff">="/mainMenu.html"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Menu </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="UserMenu"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="menu.user"</span>
				<span style="COLOR: #ff0000"> description</span>
				<span style="COLOR: #0000ff">="User Menu"</span>
				<span style="COLOR: #ff0000"> forward</span>
				<span style="COLOR: #0000ff">="editProfile"</span>
				<span style="COLOR: #ff0000"> roles</span>
				<span style="COLOR: #0000ff">="admin,user"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Menu </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="FileUpload"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="menu.selectFile"</span>
				<span style="COLOR: #ff0000"> description</span>
				<span style="COLOR: #0000ff">="File Upload"</span>
				<span style="COLOR: #ff0000"> width</span>
				<span style="COLOR: #0000ff">="100"</span>
				<span style="COLOR: #ff0000"> forward</span>
				<span style="COLOR: #0000ff">="selectFile"</span>
				<span style="COLOR: #ff0000"> roles</span>
				<span style="COLOR: #0000ff">="admin,user"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Menu </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="AdminMenu"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="menu.admin"</span>
				<span style="COLOR: #ff0000"> description</span>
				<span style="COLOR: #0000ff">="Admin Menu"</span>
				<span style="COLOR: #ff0000"> roles</span>
				<span style="COLOR: #0000ff">="admin"</span>
				<span style="COLOR: #ff0000"> width</span>
				<span style="COLOR: #0000ff">="120"</span>
				<span style="COLOR: #ff0000"> forward</span>
				<span style="COLOR: #0000ff">="viewUsers"</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Item </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="ViewUsers"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="menu.admin.users"</span>
				<span style="COLOR: #ff0000"> forward</span>
				<span style="COLOR: #0000ff">="viewUsers"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Item </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="ActiveUsers"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="mainMenu.activeUsers"</span>
				<span style="COLOR: #ff0000"> action</span>
				<span style="COLOR: #0000ff">="activeUsers"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Item </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="ReloadContext"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="menu.admin.reload"</span>
				<span style="COLOR: #ff0000"> action</span>
				<span style="COLOR: #0000ff">="reload"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Item </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="FlushCache"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="menu.flushCache"</span>
				<span style="COLOR: #ff0000"> action</span>
				<span style="COLOR: #0000ff">="flush"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Item </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="Clickstream"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="menu.clickstream"</span>
				<span style="COLOR: #ff0000"> page</span>
				<span style="COLOR: #0000ff">="/clickstreams.jsp"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">Menu</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">Menu </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="Logout"</span>
				<span style="COLOR: #ff0000"> title</span>
				<span style="COLOR: #0000ff">="user.logout"</span>
				<span style="COLOR: #ff0000"> page</span>
				<span style="COLOR: #0000ff">="/logout.jsp"</span>
				<span style="COLOR: #ff0000"> roles</span>
				<span style="COLOR: #0000ff">="admin,user"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">Menus</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">MenuConfig</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
		<p>
				<br />因此，在login.jsp页面也能显示此菜单项。<br />而剩下需要角色的菜单，就需要登录后，根据角色的设置来显示相应的菜单了。<br /><br />比如：mraible用户是admin角色，可以显示全部菜单。tomcat用户是user角色，就看不到AdminMenu了。</p>
		<p> </p><img src ="http://www.blogjava.net/usherlight/aggbug/102540.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-03-08 09:51 <a href="http://www.blogjava.net/usherlight/archive/2007/03/08/102540.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>appfuse 1.9.4 学习心得 II</title><link>http://www.blogjava.net/usherlight/archive/2007/03/07/102492.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Wed, 07 Mar 2007 15:46:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/03/07/102492.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/102492.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/03/07/102492.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/102492.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/102492.html</trackback:ping><description><![CDATA[这次详细地说明一下Appfuse的认证过程：<br />1. 在Web.xml中定义了FilterChainProxy，<br />2. 在Security.xml中对FilterChain进行了详细定义。<br />3. 其中AuthenticationManager的Providers包含了DaoAuthenticationProvider，而此Provider的UserDetailsService引用了userDao。<br />4. 在applicationContext-hibernate.xml中定义了userDao，是org.appfuse.dao.hibernate.UserDaoHibernate。 <br />5. 而UserDaoHibernate实现了UserDetailsService接口，主要是实现了loadUserByUsername(String)方法，其中参数是String类型的用户名，而返回一个UserDetails类型的对象。<br />6. 在LoadUserByUsername方法中，使用getHibernateTemplate().find来获得了一个org.appfuse.model.User类型的List，其中User类型实现了UserDetails。<img src ="http://www.blogjava.net/usherlight/aggbug/102492.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-03-07 23:46 <a href="http://www.blogjava.net/usherlight/archive/2007/03/07/102492.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>appfuse 1.9.4 学习心得</title><link>http://www.blogjava.net/usherlight/archive/2007/03/04/101792.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Sun, 04 Mar 2007 15:08:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/03/04/101792.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/101792.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/03/04/101792.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/101792.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/101792.html</trackback:ping><description><![CDATA[<p>1、编译部署成功后，在地址栏中输入：<a href="http://localhost:8080/appfuse">http://localhost:8080/appfuse</a>，即可看到首页－登录页<br /><br />2、第一个页面是login.jsp，此页面使用include包含了taglibs.jsp和loginForm.jsp<br />其中taglibs.jsp是一个公共页面，定义了页面中使用到的taglibs<br />而loginForm.jsp则是用户登录Form定义的页面<br /><br />3、现在会发现一点：此时浏览器中显示的内容比login.jsp的内容要多，包括最上方的语言切换行，下面的标题行，最下文的版本信息行等。<br />这是因为Appfuse使用了Sitemesh的Decorator。<br />在WEB-INF目录下，有两个Xml文件：sitemesh.xml和decorators.xml<br />在Web.xml中定义了sitemesh的Filter<br />在decorators目录下有default.jsp这个布局文件。<br />Sitemesh的作用就是对定义的文件进行装饰。<br />在Appfuse中，会对所有的文件作为Body安放到default.jsp这个布局文件中。<br /><br />4、查看login.jsp，发现他的Form的Action是比较奇怪的：j_security_check<br />这并不是一个真实存在的URL<br />在security.xml中可以发现，这个是authenticationProcessingFilter的filterProcessesUrl属性<br />这就是Spring中使用Acegi安全认证服务，在Appfuse1.9.4中使用的是Acegi的基于表单的身份认证<br />filterProcessUrll告诉AuthenticationProcessingFilter应该拦截哪个URL<br />属性authenticationFailureUrl指定当身份验证失败时用户应该被送往哪里<br />defaultTargetUrl定义登陆成功时转向的页面<br /><br />5、用户登录成功后，转到defaultTargeUrl所指定的路径：/ 根路径<br />而此路径的Welcome file是index.jsp, 而index.jsp又redirect到了mainMenum.html<br />因此会显示mainMenu.html页面。</p><img src ="http://www.blogjava.net/usherlight/aggbug/101792.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-03-04 23:08 <a href="http://www.blogjava.net/usherlight/archive/2007/03/04/101792.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>appfuse在Eclipse中的应用 II</title><link>http://www.blogjava.net/usherlight/archive/2007/03/01/101253.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Wed, 28 Feb 2007 16:49:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/03/01/101253.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/101253.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/03/01/101253.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/101253.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/101253.html</trackback:ping><description><![CDATA[（续昨日）<br />页面乱码的问题，今天看了一下，是资源文件的问题。<br />原来appfuse提供的资源文件没有用native2ascii处理过。<br /><br />学习心得：<br />1、Appfuse的页面基本上都包含了commom\taglibs.jsp，在此文件中定义了taglib<br />在Tomcat5以上的版本中，不再需要在Web.xml中定义Taglib了，只需要在WEB-INF\lib目录下放置standard.jar就可以了。<img src ="http://www.blogjava.net/usherlight/aggbug/101253.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-03-01 00:49 <a href="http://www.blogjava.net/usherlight/archive/2007/03/01/101253.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>appfuse在Eclipse中的应用</title><link>http://www.blogjava.net/usherlight/archive/2007/02/28/101043.html</link><dc:creator>云自无心水自闲</dc:creator><author>云自无心水自闲</author><pubDate>Tue, 27 Feb 2007 16:52:00 GMT</pubDate><guid>http://www.blogjava.net/usherlight/archive/2007/02/28/101043.html</guid><wfw:comment>http://www.blogjava.net/usherlight/comments/101043.html</wfw:comment><comments>http://www.blogjava.net/usherlight/archive/2007/02/28/101043.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/usherlight/comments/commentRss/101043.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/usherlight/services/trackbacks/101043.html</trackback:ping><description><![CDATA[<p>目前网上有一些介绍如何在Eclipse中应用Appfuse的文章，但因为Appfuse本身附带了强大的Ant任务，Eclipse在其中如Raible据说更多充当的是文本编辑器的作用。编译/部署都使用Ant完成，也比较方便。但是，无法跟踪调试源码，有些不爽，因此，想把Appfuse进行提炼完全整合到Eclipse中。</p>
		<p>一、运行Ant New<br />1. 不知道为什么，此项任务会到jre的lib目录下寻找tools.jar，没有仔细地查找原因，简单地把jdk\lib\tools.jar拷贝过来<br />2. 需要定义CATALINA_HOME这个环境变量<br />OK, 完成上述两个步骤后，Ant命令执行成功，命令过程中有数个选项可以选择，比如：应用名称，数据库名称，Package名称，这些关系都不大。<br />有一个选项比较重要一些，是询问使用何种Web框架，有webwork, tapestry, spring, jsf等，我也是使用的默认选项：struts.</p>
		<p>二、启动MySql数据库，运行Ant setup-db<br />在数据库中生成mydb数据库，以及数据表</p>
		<p>三、在Eclipse中建立Tomcat Project名字与Ant New中输入的应用一致。</p>
		<p>四、将common, decorators, images, MATA-INF, scripts, styles这几个目录从ant new生成的目录复制到Eclipse项目的目录中.<br />将web-inf\pages目录下的jsp文件拷贝到Eclipse相同目录下。</p>
		<p>五、运行ant webdoclet, 生成Form目录下的3个Form的java源文件，以及model目录下的2个hibernate的xml映射文件</p>
		<p>六、将org.appfuse.webapp，org.appfuse.sercies, org.appfuse.dao以及model和util目录所包含的所有Java源文件复制到Eclipse项目所在的文件夹web-inf\src中。</p>
		<p>七、将lib复制到web-inf\lib目录下<br />acegi-security-1.0.2.jar<br />activation.jar<br />antlr-2.7.6.jar<br />antlr.jar<br />asm.jar<br />aspectjweaver-1.5.2.jar<br />cglib-2.1.3.jar<br />clickstream-1.0.2.jar<br />commons-beanutils.jar<br />commons-codec-1.3.jar<br />commons-collections.jar<br />commons-dbcp.jar<br />commons-digester.jar<br />commons-fileupload.jar<br />commons-io.jar<br />commons-lang.jar<br />commons-logging-1.1.jar<br />commons-pool.jar<br />commons-validator.jar<br />displaytag-1.1.jar<br />dom4j-1.6.1.jar<br />dwr.jar<br />ehcache-1.2.3.jar<br />hibernate3.jar<br />itext-1.4.jar<br />jakarta-oro.jar<br />jstl.jar<br />jta.jar<br />log4j-1.2.11.jar<br />mail.jar<br />mysql-connector-java-5.0.3-bin.jar<br />oscache-2.3.2.jar<br />sitemesh-2.2.1.jar<br />spring.jar<br />standard.jar<br />struts-el.jar<br />struts-menu-2.4.2.jar<br />struts.jar<br />urlrewrite-3.0-beta.jar<br />velocity-1.4.jar<br />velocity-tools-view-1.1.jar</p>
		<p>八、启动Sysdeo Tomcat, 在浏览器中输入<a href="http://locallhost:8080/myapp">http://locallhost:8080/myapp</a>, 出现页面，输入mraible/tomcat，登录成功。</p>
		<p>九、还有一个问题就是目前所有的页面都是乱码，明天再解决了，今天要睡觉了。</p>
		<p> </p><img src ="http://www.blogjava.net/usherlight/aggbug/101043.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/usherlight/" target="_blank">云自无心水自闲</a> 2007-02-28 00:52 <a href="http://www.blogjava.net/usherlight/archive/2007/02/28/101043.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>