<?xml version="1.0" encoding="GB2312"?>
<rss version="2.0">
<channel>
<title><![CDATA[JavaEE开源博客－阿Q]]></title>
<link>http://zhan.zhmy.com/index.html</link>
<description><![CDATA[JavaEE开源博客－阿Q]]></description>
<item>
<title><![CDATA[小蚂蚁-CAS单点登录系列]]></title>
<link>http://zhan.zhmy.com/archives/2010/159739.html</link>
<description><![CDATA[<P><A href="http://zhanjia.javaeye.com/blog/733341">小蚂蚁-CAS单点登录系列(1)-基础知识</A><BR><BR><A href="http://zhanjia.javaeye.com/blog/735072">小蚂蚁-CAS单点登录系列(2)-初步认识CAS</A><BR><BR><A href="http://zhanjia.javaeye.com/blog/737592">小蚂蚁-CAS单点登录系列(3)-简单实施SSO</A><BR><BR><A href="http://zhanjia.javaeye.com/blog/738808">小蚂蚁-CAS单点登录系列(4)-使用RDBMS认证</A><BR></P>
<P><A href="http://zhanjia.javaeye.com/blog/746437">小蚂蚁-CAS单点登录系列(5)-简单实施SSO之二</A></P>
<P>&nbsp;</P>]]></description>
<author>sam</author>
<pubDate>2010-8-17 0:50:00</pubDate>
</item>
<item>
<title><![CDATA[ORACLE 中ROWNUM用法总结! [精]]]></title>
<link>http://zhan.zhmy.com/archives/2010/159540.html</link>
<description><![CDATA[<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对于 Oracle 的 rownum 问题，很多资料都说不支持&gt;,&gt;=,=,between...and，只能用以上符号(&lt;、&lt;=、!=)，并非说用&gt;,&amp; gt;=,=,between..and 时会提示SQL语法错误，而是经常是查不出一条记录来，还会出现似乎是莫名其妙的结果来，其实您只要理解好了这个 rownum 伪列的意义就不应该感到惊奇，同样是伪列，rownum 与 rowid 可有些不一样，下面以例子说明<BR><BR>假设某个表 t1(c1) 有 20 条记录<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 如果用 select rownum,c1 from t1 where rownum &lt; 10, 只要是用小于号，查出来的结果很容易地与一般理解在概念上能达成一致，应该不会有任何疑问的。<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 可如果用 select rownum,c1 from t1 where rownum &gt; 10 (如果写下这样的查询语句，这时候在您的头脑中应该是想得到表中后面10条记录)，你就会发现，显示出来的结果要让您失望了，也许您还会怀疑是不谁删了一些记录，然后查看记录数，仍然是 20 条啊？那问题是出在哪呢？<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <STRONG>先好好理解 rownum 的意义吧。因为ROWNUM是对结果集加的一个伪列，即先查到结果集之后再加上去的一个列 (强调：先要有结果集)。简单的说 rownum 是对符合条件结果的序列号。它总是从1开始排起的。所以你选出的结果不可能没有1，而有其他大于1的值。所以您没办法期望得到下面的结果集</STRONG>：<BR><BR>11 aaaaaaaa<BR>12 bbbbbbb<BR>13 ccccccc<BR>.................<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rownum &gt;10 没有记录，因为第一条不满足去掉的话，第二条的ROWNUM又成了1，所以永远没有满足条件的记录。或者可以这样理解：<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ROWNUM是一个序列，是oracle数据库从数据文件或缓冲区中读取数据的顺序。它取得第一条记录则rownum值为1，第二条为2，依次类推。如果你用&gt;,&gt;=,=,between...and这些条件，因为从缓冲区或数据文件中得到的第一条记录的rownum为1，则被删除，接着取下条，可是它的rownum还是1，又被删除，依次类推，便没有了数据。<BR><BR>有了以上从不同方面建立起来的对 rownum 的概念，那我们可以来认识使用 rownum 的几种现像<BR><BR>1. select rownum,c1 from t1 where rownum != 10 为何是返回前9条数据呢？它与 select rownum,c1 from tablename where rownum &lt; 10 返回的结果集是一样的呢？<BR>&nbsp;&nbsp;&nbsp; 因为是在查询到结果集后，显示完第 9 条记录后，之后的记录也都是 != 10,或者 &gt;=10,所以只显示前面9条记录。也可以这样理解，rownum 为9后的记录的 rownum为10，因条件为 !=10，所以去掉，其后记录补上，rownum又是10，也去掉，如果下去也就只会显示前面9条记录了<BR><BR>2. 为什么 rownum &gt;1 时查不到一条记录，而 rownum &gt;0 或 rownum &gt;=1 却总是显示所记录<BR>&nbsp;&nbsp; 因为 rownum 是在查询到的结果集后加上去的，它总是从1开始<BR><BR>3. 为什么 between 1 and 10 或者 between 0 and 10 能查到结果，而用 between 2 and 10 却得不到结果<BR>&nbsp;&nbsp; 原因同上一样，因为 rownum 总是从 1 开始<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 从上可以看出，<STRONG>任何时候想把 rownum = 1 这条记录抛弃是不对的，它在结果集中是不可或缺的</STRONG>，少了rownum=1 就像空中楼阁一般不能存在，所以你的 rownum 条件要包含到 1<BR><BR>但如果就是想要用 rownum &gt; 10 这种条件的话话就要用嵌套语句,把 rownum 先生成，然后对他进行查询。<BR>select *<BR>from (selet rownum as&nbsp; rn，t1.* from a where ...)<BR>where rn &gt;10<BR><BR>一般代码中对结果集进行分页就是这么干的。<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 另外：rowid 与 rownum 虽都被称为伪列，但它们的存在方式是不一样的，<STRONG>rowid 可以说是物理存在的，表示记录在表空间中的唯一位置ID，在DB中唯一</STRONG>。只要记录没被搬动过，rowid是不变的。rowid 相对于表来说又像表中的一般列，所以以 rowid 为条件就不会有 rownum那些情况发生。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 另外还要注意：<STRONG>rownum不能以任何基表的名称作为前缀</STRONG>。<BR><BR><BR></P>
<P>以上文章来自网络</P>]]></description>
<author>sam</author>
<pubDate>2010-6-22 15:04:00</pubDate>
</item>
<item>
<title><![CDATA[【转】使用BlazeDS实现Java和Flex通信之hello world]]></title>
<link>http://zhan.zhmy.com/archives/2010/158552.html</link>
<description><![CDATA[<P>新的项目对用户体验及用户互动要求较高，决定选用Flex作为前端的展现技术，整体框架仍然是Flex+Spring+Hibernate(考虑采用seam中)。作为入门，先从经典的Hello world开始，暂时不考虑Flex与Spring、Hibernate的集成。</P>
<P>Flex要实现与Java集成，开源项目<A onclick="javascript:pageTracker._trackPageview('/outbound/article/http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/');" href="http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/">BlazeDS</A>、<A onclick="http://vip.zhmy.com/javascript:pageTracker._trackPageview('/outbound/article/http://www.graniteds.org');" href="http://www.graniteds.org/">GraniteDS</A>、<A onclick="http://vip.zhmy.com/javascript:pageTracker._trackPageview('/outbound/article/http://www.exadel.com/web/portal/flamingo');" href="http://www.exadel.com/web/portal/flamingo">Flamingo</A>都提供了相应的解决方案，考虑到BlazeDS是Adobe官方的开源项目，因此采用BlazeDs作为Flex与Java通信的基础框架。什么是 BlazeDS呢，看看官方的介绍：</P>
<P><EM>BlazeDS is the server-based Java remoting and web messaging technology that enables developers to easily connect to back-end distributed data and push data in real-time to Adobe? Flex? and Adobe AIR? applications for more responsive rich Internet application (RIA) experiences.</EM></P>
<P>开发工具采用Eclipse+Flex Builder 3 Plug-in方式，不采用Flex Builder 3。先安装Eclipse，再安装Flex Builder 3 Plug-in，相关的安装配置不再赘述。</P>
<H3><STRONG>1、下载BlazeDS</STRONG></H3>
<P>下载BlazeDS Turnkey ：<A title=http://flexorg.wip3.adobe.com/blazeds/3.0.x/milestone/3978/blazeds-turnkey-3.2.0.3978.zip onclick="javascript:pageTracker._trackPageview('/outbound/article/http://flexorg.wip3.adobe.com/blazeds/3.0.x/milestone/3978/blazeds-turnkey-3.2.0.3978.zip');" href="http://flexorg.wip3.adobe.com/blazeds/3.0.x/milestone/3978/blazeds-turnkey-3.2.0.3978.zip">http://flexorg.wip3.adobe.com/blazeds/3.0.x/milestone/3978/blazeds-turnkey-3.2.0.3978.zip</A></P>
<P>由于BlazeDS Turnkey中包含BlazeDS的使用例子，对于入门熟悉Flex及BlazeDS都有较好的参考价值，因此建议下载BlazeDS Turnkey。</P>
<P>关于blazeds-turnkey 的目录说明：</P>
<P>docs：BlazeDS Javadoc</P>
<P>resources：BlazeDS的相关支持包，包括clustering（采用jgroups）、BlazeDS与ColdFusion 集成的配置文件、BlazeDS的配置文件、BlazeDS与AJAX集成的桥、Flex的SDK、Flex的java library、BlazeDS与Tomcat、Jboss、Websphere等security集成的支持包。</P>
<P>sampledb：hsqldb的启动脚本及样例数据库</P>
<P>tomcat：Tomcat 包</P>
<P>blazeds.war：最小化的BlazeDS 文件，可以作为空白项目来建立BlazeDS 应用程序。</P>
<P>sample.war：BlazeDS的demo例子（所谓的testdrive）。</P>
<P>ds-console.war ：BlazeDS的部署管理程序。</P>
<H3><STRONG>2、建立Java Web Project</STRONG></H3>
<P>File-&gt;New-&gt;Web Project 建立Java helloworld项目</P>
<P><A href="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds1.png"><IMG title=blazeds1 style="http://vip.zhmy.com/BORDER-TOP-WIDTH: 0px; DISPLAY: block; BORDER-LEFT-WIDTH: 0px; FLOAT: none; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; MARGIN-RIGHT: auto; BORDER-RIGHT-WIDTH: 0px" height=416 alt=blazeds1 src="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds1-thumb.png" width=417 border=0></A> 在helloworld/src下，新建com.yeeach.HelloWorldService类，内容如下：</P>
<P><EM>package com.yeeach; </EM></P>
<P><EM>public class HelloWorldService {<BR>public String hello(String var1) {<BR>return “hello ” + var1;<BR>}<BR>public String world(String var1) {<BR>return “world ” + var1;<BR>}<BR>}</EM></P>
<H3><STRONG>3、建立helloworld的BlazeDS开发环境</STRONG></H3>
<P>3.1、拷贝blazeds.war下的WEB-INF到helloworld的目录下，覆盖原有的WEB-INF</P>
<P>3.2、在helloworld下建立flex-src目录（与src同级），用于存放flex的相关代码</P>
<P><A href="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds2.png"><IMG title=blazeds2 style="http://vip.zhmy.com/BORDER-TOP-WIDTH: 0px; DISPLAY: block; BORDER-LEFT-WIDTH: 0px; FLOAT: none; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; MARGIN-RIGHT: auto; BORDER-RIGHT-WIDTH: 0px" height=359 alt=blazeds2 src="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds2-thumb.png" width=477 border=0></A> helloworld/src：用于存放项目的java代码</P>
<P>helloworld/flex-src：用于存放项目flex的相关代码</P>
<P>helloworld/WebRoot/WEB-INF/flex：存放flex的相关配置文件</P>
<P>3.3、设置Flex Project Nature</P>
<P><A href="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds3.png"><IMG title=blazeds3 style="http://vip.zhmy.com/BORDER-TOP-WIDTH: 0px; DISPLAY: block; BORDER-LEFT-WIDTH: 0px; FLOAT: none; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; MARGIN-RIGHT: auto; BORDER-RIGHT-WIDTH: 0px" height=358 alt=blazeds3 src="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds3-thumb.png" width=476 border=0></A></P>
<P><A href="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds4.png"><IMG title=blazeds4 style="http://vip.zhmy.com/BORDER-TOP-WIDTH: 0px; DISPLAY: block; BORDER-LEFT-WIDTH: 0px; FLOAT: none; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; MARGIN-RIGHT: auto; BORDER-RIGHT-WIDTH: 0px" height=356 alt=blazeds4 src="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds4-thumb.png" width=474 border=0></A></P>
<P><A href="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds5.png"><IMG title=blazeds5 style="http://vip.zhmy.com/BORDER-TOP-WIDTH: 0px; DISPLAY: block; BORDER-LEFT-WIDTH: 0px; FLOAT: none; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; MARGIN-RIGHT: auto; BORDER-RIGHT-WIDTH: 0px" height=368 alt=blazeds5 src="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds5-thumb.png" width=489 border=0></A></P>
<P>3.4、在helloworld/flex-src下，新建MXML Application ：helloworld.mxml&nbsp; ，内容如下：</P>
<P><EM>&lt;?xml version=”1.0″ encoding=”utf-8″?&gt;<BR>&lt;mx:Application xmlns:mx=”</EM><A onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.adobe.com/2006/mxml&quot;');" href="http://www.adobe.com/2006/mxml%22"><EM>http://www.adobe.com/2006/mxml”</EM></A><BR><EM>layout=”vertical”&gt;<BR>&lt;mx:RemoteObject destination=”com.yeeach.HelloWorldService”<BR>id=”helloWorldService”&gt;<BR>&lt;mx:method name=”hello”<BR>result=”sayHelloResult(event)”/&gt;<BR>&lt;mx:method name=”world”<BR>result=”sayWorldResult(event)”/&gt;<BR>&lt;/mx:RemoteObject&gt;<BR>&lt;mx:HBox&gt;<BR>&lt;mx:Label text=”输入：”/&gt;<BR>&lt;mx:TextInput id=”inputStr”/&gt;<BR>&lt;mx:Button label=”say hello”<BR>click=”sayHello(event);”/&gt;<BR>&lt;mx:Button label=”say world”<BR>click=”sayWorld(event);”/&gt;<BR>&lt;/mx:HBox&gt;<BR>&lt;mx:HBox&gt;<BR>&lt;mx:Label text=”结果：”/&gt;<BR>&lt;mx:TextArea id=”result”/&gt;<BR>&lt;/mx:HBox&gt; </EM></P>
<P><EM>&lt;mx:Script&gt; </EM></P>
<P><EM>&lt;![CDATA[<BR>import mx.rpc.events.FaultEvent;<BR>import mx.controls.Alert;<BR>import mx.rpc.events.ResultEvent; </EM></P>
<P><EM>function sayHello(event:Event):void<BR>{<BR>var inputVar:String=inputStr.text;<BR>helloWorldService.hello(inputVar); </EM></P>
<P><EM>} </EM></P>
<P><EM>function sayWorld(event:Event):void<BR>{<BR>var inputVar:String=inputStr.text;<BR>helloWorldService.world(inputVar); </EM></P>
<P><EM>} </EM></P>
<P><EM>private function sayHelloResult(event:ResultEvent):void<BR>{<BR>result.text=event.result.toString();<BR>Alert.show(event.result.toString(), "返回结果");<BR>} </EM></P>
<P><EM>private function sayWorldResult(event:ResultEvent):void<BR>{<BR>result.text=event.result.toString();<BR>Alert.show(event.result.toString(), "返回结果");<BR>}<BR>]]&gt;<BR>&lt;/mx:Script&gt;<BR>&lt;/mx:Application&gt;</EM></P>
<P>3.5、修改remoting-config.xml，增加对destination的说明</P>
<P>&lt;destination id=”com.yeeach.HelloWorldService”&gt;<BR>&lt;properties&gt;<BR>&lt;source&gt;com.yeeach.HelloWorldService&lt;/source&gt;<BR>&lt;/properties&gt;<BR>&lt;/destination&gt;</P>
<P>3.6、设置Flex Build Path等相关属性</P>
<P>1)右键-&gt;Properties,设置Flex Build Path属性，将Main source folder修改为flex-src，然后点击“OK”</P>
<P>2)右键-&gt;Properties,设置Flex Applications属性，添加flex-src下的其他Application，然后点击“OK”</P>
<P>如果需要添加flex-src子目录下的其他Application（例如helloworld/flex-src/com/yeeach /helloworld1.mxml），目前从UI界面似乎无法正确添加，可以直接修改.actionScriptProperties, 在&lt;applications&gt;&lt;/applications&gt;中间增加相应的Application</P>
<P>&lt;applications&gt;<BR>&lt;application path=”helloworld.mxml”/&gt;</P>
<P>&lt;application path=”com/yeeach.com/helloworld1.mxml”/&gt;<BR>&lt;/applications&gt;</P>
<P>3)右键-&gt;Properties,设置Flex Compiler属性，将Flex SDK version 修改为“Use default”或“Use a specific SDK”，指向正确的Flex SDK；确认“Additional compiler arguments”配置参数正确，然后点击“OK”</P>
<P><A href="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds6.png"><IMG title=blazeds6 style="http://vip.zhmy.com/BORDER-TOP-WIDTH: 0px; DISPLAY: block; BORDER-LEFT-WIDTH: 0px; FLOAT: none; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; MARGIN-RIGHT: auto; BORDER-RIGHT-WIDTH: 0px" height=400 alt=blazeds6 src="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds6-thumb.png" width=532 border=0></A> 4)右键-&gt;Properties,设置Flex Server属性，配置为正确的参数，然后点击“OK”</P>
<P><A href="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds7.png"><IMG title=blazeds7 style="http://vip.zhmy.com/BORDER-TOP-WIDTH: 0px; DISPLAY: block; BORDER-LEFT-WIDTH: 0px; FLOAT: none; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; MARGIN-RIGHT: auto; BORDER-RIGHT-WIDTH: 0px" height=394 alt=blazeds7 src="http://www.yeeach.com/wp-content/uploads/2009/07/blazeds7-thumb.png" width=525 border=0></A></P>
<P>3.7、部署helloworld 应用到Tomcat</P>
<P>通过<A onclick="javascript:pageTracker._trackPageview('/outbound/article/http://127.0.0.1:8080/helloworld/helloworld.swf');" href="http://127.0.0.1:8080/helloworld/helloworld.swf">http://127.0.0.1:8080/helloworld/helloworld.swf</A>来访问我们的hello world</P>
<P>3.8、分析helloworld.mxml</P>
<P><EM>&lt;?xml version=”1.0″ encoding=”utf-8″?&gt;<BR>&lt;mx:Application xmlns:mx=”</EM><A onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.adobe.com/2006/mxml&quot;');" href="http://www.adobe.com/2006/mxml%22"><EM>http://www.adobe.com/2006/mxml”</EM></A><BR><EM>layout=”vertical”&gt;<BR>&lt;mx:RemoteObject destination=”com.yeeach.HelloWorldService”<BR>id=”helloWorldService”&gt;</EM></P>
<P><EM>//此处的destination=”com.yeeach.HelloWorldService”与remoting- config.xml中的id=”com.yeeach.HelloWorldService”完全匹配</EM></P>
<P><EM>//id=”helloWorldService”用来在actionscript中标识</EM>destination=”com.yeeach.HelloWorldService”，后面的helloWorldService.hello(inputVar)等都使用此id;<BR><EM><BR>&lt;mx:method name=”hello”<BR>result=”sayHelloResult(event)”/&gt;</EM></P>
<P><EM>//mx:method 声明java类com.yeeah.com.HelloWorldService中的hello方法及响应结果回调函数sayHelloResult<BR>&lt;mx:method name=”world”<BR>result=”sayWorldResult(event)”/&gt;<BR>&lt;/mx:RemoteObject&gt;<BR>&lt;mx:HBox&gt;<BR>&lt;mx:Label text=”输入：”/&gt;<BR>&lt;mx:TextInput id=”inputStr”/&gt;<BR>&lt;mx:Button label=”say hello”<BR>click=”sayHello(event);”/&gt;<BR>&lt;mx:Button label=”say world”<BR>click=”sayWorld(event);”/&gt;<BR>&lt;/mx:HBox&gt;<BR>&lt;mx:HBox&gt;<BR>&lt;mx:Label text=”结果：”/&gt;<BR>&lt;mx:TextArea id=”result”/&gt;<BR>&lt;/mx:HBox&gt; </EM></P>
<P><EM>&lt;mx:Script&gt; </EM></P>
<P><EM>&lt;![CDATA[<BR>import mx.rpc.events.FaultEvent;<BR>import mx.controls.Alert;<BR>import mx.rpc.events.ResultEvent; </EM></P>
<P><EM>function sayHello(event:Event):void<BR>{<BR>var inputVar:String=inputStr.text;<BR>helloWorldService.hello(inputVar); </EM></P>
<P><EM>} </EM></P>
<P><EM>function sayWorld(event:Event):void<BR>{<BR>var inputVar:String=inputStr.text;<BR>helloWorldService.world(inputVar); </EM></P>
<P><EM>} </EM></P>
<P><EM>private function sayHelloResult(event:ResultEvent):void<BR>{<BR>result.text=event.result.toString();<BR>Alert.show(event.result.toString(), "返回结果");<BR>} </EM></P>
<P><EM>private function sayWorldResult(event:ResultEvent):void<BR>{<BR>result.text=event.result.toString();<BR>Alert.show(event.result.toString(), "返回结果");<BR>}<BR>]]&gt;<BR>&lt;/mx:Script&gt;<BR>&lt;/mx:Application&gt;</EM></P>
<P>代码文件：<A href="http://www.yeeach.com/upload/helloworld.rar">helloworld.rar</A> <EM><BR></EM></P>
<P><EM>源代码，包括Jar包：<A href="http://vip.zhmy.com/UploadFlies/2010-3/7014924767.rar">BlazeDsDemo</A></P></EM>]]></description>
<author>sam</author>
<pubDate>2010-3-6 11:41:00</pubDate>
</item>
<item>
<title><![CDATA[【转】使用BlazeDS实现Java和Flex通信]]></title>
<link>http://zhan.zhmy.com/archives/2010/158551.html</link>
<description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B><SPAN style="FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 楷体_GB2312">作者：</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; COLOR: blue"><FONT face="Times New Roman">Liceven,</FONT></SPAN></B><B><SPAN style="FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 楷体_GB2312">博客：</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; COLOR: blue"><A href="http://yexin218.cublog.cn/"><FONT face="http://vip.zhmy.com/Times New &#13;&#10;Roman" color=#800080>http://yexin218.cublog.cn</FONT></A><FONT face="Times New Roman"> </FONT></SPAN></B><B><SPAN style="FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 楷体_GB2312">日期：</SPAN></B><FONT face="Times New &#13;&#10;Roman"><?xml:namespace prefix = st1 /><st1:chsdate w:st="on" year="2008" month="6" day="3" islunardate="False" isrocdate="False"><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; COLOR: blue">2008-6-3</SPAN></B></st1:chsdate><B><SPAN lang=EN-US style="FONT-SIZE: 14pt; COLOR: blue"><?xml:namespace prefix = o /><o:p></o:p></SPAN></B></FONT></P>
<DIV><B><SPAN style="FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 楷体_GB2312">转载请注明来源。谢谢合作.</SPAN></B></DIV>
<DIV><SPAN style="FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 楷体_GB2312">
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT color=#000000><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeDS</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">是一个基于服务器的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Java </FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">远程控制</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">(remoting)</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Web</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">消息传递</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">(messaging)</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">技术，它能够使得后端的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Java</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">应用程序和运行在浏览器上的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Adobe Flex</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">应用程序相互通信。这篇文章中，我讲述一种方法（也许不是最好的）使得我能够成功地利用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeDS</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Flex</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">建立一个简单的程序。使用的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">IDE</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">eclipse,</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">而并非</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Flex Builder.</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">下面我将逐步介绍怎么实现这个简单的程序。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN><FONT face="Times New Roman"><FONT color=#000000>1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></FONT></SPAN></SPAN><FONT color=#000000><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">安装</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times &#13;&#10;New Roman">JDK </FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Tomcat,</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">并且实现成功配置。详细请见：</SPAN></FONT><LINK href="http://vip.zhmy.com/file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" rel=File-List> 
<STYLE>
<!--
 /* Font Definitions */
 @font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-alt:SimSun;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;
	mso-font-charset:134;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:3 135135232 16 0 262145 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	mso-pagination:none;
	font-size:10.5pt;
	mso-bidi-font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:宋体;
	mso-font-kerning:1.0pt;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
 /* Page Definitions */
 @page
	{mso-page-border-surround-header:no;
	mso-page-border-surround-footer:no;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:36.0pt;
	mso-footer-margin:36.0pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</STYLE>
<SPAN class=MsoHyperlink><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">http://blog.chinaunix.net/u/21684/showart_195064.html</SPAN></SPAN><FONT color=#000000><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312"></SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman"> <o:p></o:p></FONT></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN><FONT face="Times New Roman"><FONT color=#000000>2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></FONT></SPAN></SPAN><FONT color=#000000><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">安装</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times &#13;&#10;New Roman">Flex SDK. </FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">详细请见官方文档：</SPAN></FONT><SPAN lang=EN-US style="FONT-SIZE: 16pt"><A href="http://www.adobe.com/devnet/flex/?navID=gettingstarted"><FONT face="http://vip.zhmy.com/Times New Roman" color=#0000ff>http://www.adobe.com/devnet/flex/?navID=gettingstarted</FONT></A><FONT color=#000000><FONT face="Times New Roman"> <o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN><FONT face="Times New Roman"><FONT color=#000000>3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></FONT></SPAN></SPAN><FONT color=#000000><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">下载</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times &#13;&#10;New Roman">BlazeDS ,</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">下载地址和安装方法请参考：</SPAN></FONT><SPAN lang=EN-US style="FONT-SIZE: 16pt"><A href="http://opensource.adobe.com/wiki/display/blazeds/Release+Builds"><FONT face="http://vip.zhmy.com/Times New Roman" color=#0000ff>http://opensource.adobe.com/wiki/display/blazeds/Release+Builds</FONT></A><FONT face="Times New Roman" color=#000000> </FONT></SPAN><FONT color=#000000><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">。如果你使用的是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">turnkey </FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">版本（建议下载此版本）里面实际上包含了</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Tomcat</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">服务器了。但是本人因为之前已经装好了</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Tomcat<st1:chsdate w:st="on" year="1899" month="12" day="30" islunardate="False" isrocdate="False">6.0.16</st1:chsdate></FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">了，所以我的安装的是自己手动的了。如果你使用的是整合</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times &#13;&#10;New Roman">Tomcat</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">版本的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeDS,</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">那么请参</SPAN><SPAN style="FONT-SIZE: 16pt"><FONT face="Times New Roman"> </FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">考</SPAN></FONT><SPAN lang=EN-US style="FONT-SIZE: 16pt"><A href="http://opensource.adobe.com/wiki/display/blazeds/Installation+Guide"><FONT face="http://vip.zhmy.com/Times New Roman" color=#0000ff>http://opensource.adobe.com/wiki/display/blazeds/Installation+Guide</FONT></A><SPAN><FONT face="Times New Roman" color=#000000>&nbsp; </FONT></SPAN></SPAN><FONT color=#000000><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">。下面我介绍只安装</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeDS</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">web application</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">版本（但是仍然下载的是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Turnkey</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">版本）。下载的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">zip</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">包里面包含了：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman"> blazeds.war: </FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">主要的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeDS war </FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">文件，用来建立你的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeDS</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">应用程序。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Sample.war</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">就是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeDS</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">例子了。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Ds-console.war</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">，简单的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeDS</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">部署管理程序。每一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">war</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">程序都是独立的，假如你使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">J2EE</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">web</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">应用程序选项，那么你必须有一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">J2EE</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">应用服务器或者</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">servlet</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">容器。比如使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Tomcat.</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">而且必须把刚才的三个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">war</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">文件部署在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Tomcat_Home</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">（</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">tomcat</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">安装目录）下的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">webapps</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">目录下。然后重启</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Tomcat</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">服务器，在浏览器输入：</SPAN></FONT><SPAN lang=EN-US style="FONT-SIZE: 16pt"><A href="http://localhost:8080/samples"><FONT face="http://vip.zhmy.com/Times &#13;&#10;New Roman" color=#0000ff>http://localhost:8080/samples</FONT></A><FONT face="Times New Roman" color=#000000> </FONT></SPAN><FONT color=#000000><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">如果看到显示页面代表就成功了。如果你的应用程序需要使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times&#13;&#10; New Roman">HSWLDB</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">数据库，那么也拷贝</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">.zip</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">文件中的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">sampledb</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">目录到</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">webapps</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">目录下，然后启动数据库。启动方法很简单：到</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">sampledb</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">目录下，执行</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">startdb.bat</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">就可了</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">(windows OS)</FONT></SPAN></FONT><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312"><FONT color=#000000>。</FONT><SPAN style="COLOR: red">提示：可以的话，在你的</SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red"><FONT face="Times New Roman">Eclipse</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 楷体_GB2312">目录下，找到</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red"><FONT face="Times New&#13;&#10; Roman">eclipse.ini</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; COLOR: red; FONT-FAMILY: 楷体_GB2312">把最大内存数改成</SPAN><FONT face="Times New &#13;&#10;Roman"><SPAN lang=EN-US style="FONT-SIZE: 16pt; COLOR: red">512.</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><o:p></o:p></SPAN></FONT></P><FONT color=#000000><SPAN lang=EN-US style="FONT-SIZE: 16pt">4. (</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">可选</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">)</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">配置</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">Tomcat</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">的用户角色。即在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">Tomcat_Home/conf/tomat-users.xml</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">添加以下语句：</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'"><STRONG> </STRONG></SPAN></FONT></SPAN></DIV>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#999999 cellSpacing=0 cellPadding=0 width="95%" bgColor=#f1f1f1 border=1>
<TBODY>
<TR>
<TD>
<P style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN style="COLOR: rgb(0,0,0)"><SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>role rolename<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"manager"</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>user username<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"abhi"</SPAN> password<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"abhi"</SPAN> roles<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"manager"</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN></SPAN></CODE></P></TD></TR></TBODY></TABLE>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><FONT face="Times New Roman"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN>5.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><o:p>&nbsp;</o:p></SPAN></FONT><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">利用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">Eclipse</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">建立</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">Flex Project</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">。工程名字叫做</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt">BlazeApp.<IMG src="http://blog.baao.com/images/blog-yac/blaze-clock-webapp/Wizard1.png"></SPAN><SPAN lang=EN-US style="http://vip.zhmy.com/FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt">Application Type </SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">选择</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt">web application, </SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">服务器选择</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt">J2EE.</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">关联</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt">WTP,</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">至于代码文件保存目录自定义。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt">Next</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><o:p></o:p></SPAN></SPAN></P>
<P><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">6.设置</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">J2EE</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">服务器。我们选择</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">Tomcat,</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">可能需要手动配置</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">(new)</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">。然后选择</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">flex war</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">文件，即我们放在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">webapps</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">目录下的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt">blazeds.war.<IMG src="http://blog.baao.com/images/blog-yac/blaze-clock-webapp/Wizard2.png"><SPAN style="http://vip.zhmy.com/FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">然后</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">next.</SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN>7.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">接着，默认设置，也可自定义。<IMG src="http://blog.baao.com/images/blog-yac/blaze-clock-webapp/Wizard3.png"><SPAN style="http://vip.zhmy.com/FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">接着</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">next.</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">其实到这里已经完成了</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt; FONT-FAMILY: 'Times New Roman'">project</SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">建立.</SPAN></SPAN></P><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312"><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><FONT face="Times New Roman"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN>8.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN></SPAN></FONT><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN><FONT face="Times &#13;&#10;New Roman"><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">接下来你可以在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">eclipse</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">中可以看到整个工程的所有文件以及配置。在开发之前，可能需要修改</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">context root</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">配置。点击</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeApp</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">右键，选择属性，然后见到如图</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">,</FONT></SPAN><FONT color=#ff0000><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">修改</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">context root</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">值为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeApp.</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">（默认的是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">WebContent,</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">有人说不更改也可以，但我试过不更改调用java无效。自行测<FONT color=#ff0000>试</FONT></SPAN></FONT><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman" color=#ff0000>…</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312"><FONT color=#ff0000>）</FONT>。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312"></SPAN><IMG src="http://blog.baao.com/images/blog-yac/blaze-clock-webapp/ContextRoot.png"></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><FONT face="Times New Roman"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;</SPAN></SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><o:p>&nbsp;</o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN><FONT face="Times New Roman">9.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">创建</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">Java</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">文件。点击</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">src</FONT></SPAN><SPAN style="http://vip.zhmy.com/FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">文件夹，然后创建</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">java class. </FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">类的包为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">hello,</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">名字为</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">HelloWorld.<o:p></o:p></FONT></SPAN></P></SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><o:p></o:p></SPAN></SPAN>&nbsp; 
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#999999 cellSpacing=0 cellPadding=0 width="95%" bgColor=#f1f1f1 border=1>
<TBODY>
<TR>
<TD>
<P style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN style="COLOR: rgb(0,0,0)"><SPAN style="COLOR: rgb(0,0,255)">package</SPAN> hello<SPAN style="COLOR: rgb(0,0,204)">;</SPAN> <BR><SPAN style="COLOR: rgb(0,0,255)">public</SPAN> <SPAN style="COLOR: rgb(0,0,255)">class</SPAN> HelloWorld <SPAN style="COLOR: rgb(0,0,204)">{</SPAN><BR><SPAN style="COLOR: rgb(0,0,255)">public</SPAN> <SPAN style="COLOR: rgb(255,0,0)">String</SPAN> sayHelloTo<SPAN style="COLOR: rgb(0,0,204)">(</SPAN><SPAN style="COLOR: rgb(255,0,0)">String</SPAN> str<SPAN style="COLOR: rgb(0,0,204)">)</SPAN> <SPAN style="COLOR: rgb(0,0,204)">{</SPAN><BR><SPAN style="COLOR: rgb(255,0,0)">System</SPAN><SPAN style="COLOR: rgb(0,0,204)">.</SPAN>out<SPAN style="COLOR: rgb(0,0,204)">.</SPAN><SPAN style="COLOR: rgb(255,0,0)">println</SPAN><SPAN style="COLOR: rgb(0,0,204)">(</SPAN><SPAN style="COLOR: rgb(255,0,255)">"Hello "</SPAN> <SPAN style="COLOR: rgb(0,0,204)">+</SPAN> str<SPAN style="COLOR: rgb(0,0,204)">)</SPAN><SPAN style="COLOR: rgb(0,0,204)">;</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: rgb(0,0,255)">return</SPAN> <SPAN style="COLOR: rgb(255,0,255)">"Hello "</SPAN> <SPAN style="COLOR: rgb(0,0,204)">+</SPAN> str<SPAN style="COLOR: rgb(0,0,204)">;</SPAN> <SPAN style="COLOR: rgb(0,0,204)">}</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;<BR><SPAN style="COLOR: rgb(0,0,204)">}</SPAN><BR></SPAN></CODE></P></TD></TR></TBODY></TABLE>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 16pt"><SPAN><FONT face="Times New Roman">10.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">在</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">BlazeApp.mxml</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">文件中新建一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">text</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">和一个按钮，来显示从</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><FONT face="Times New Roman">HelloWorld</FONT></SPAN><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 楷体_GB2312">传回来的信息。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 16pt"><o:p></o:p></SPAN></P>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#999999 cellSpacing=0 cellPadding=0 width="95%" bgColor=#f1f1f1 border=1>
<TBODY>
<TR>
<TD>
<P style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN style="COLOR: rgb(0,0,0)"><SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">?</SPAN>xml <SPAN style="COLOR: rgb(255,0,0)">version</SPAN><SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"1.0"</SPAN> <SPAN style="COLOR: rgb(255,0,0)">encoding</SPAN><SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"utf-8"</SPAN><SPAN style="COLOR: rgb(255,0,255)">?</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR><SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>mx:Application xmlns:mx<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"http://www.adobe.com/2006/mxml"</SPAN> viewSourceURL<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"srcview/index.html"</SPAN><SPAN style="http://vip.zhmy.com/COLOR: rgb(0,0,204)">&gt;</SPAN> <BR><SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>mx:<SPAN style="COLOR: rgb(0,0,255)">Script</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>!<SPAN style="COLOR: rgb(0,0,204)">[</SPAN>CDATA<SPAN style="COLOR: rgb(0,0,204)">[</SPAN> import mx<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>rpc<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>events<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>FaultEvent<SPAN style="COLOR: rgb(0,0,204)">;</SPAN> <BR>&nbsp;&nbsp;&nbsp;import mx<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>rpc<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>events<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>ResultEvent<SPAN style="COLOR: rgb(0,0,204)">;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">[</SPAN>Bindable<SPAN style="COLOR: rgb(0,0,204)">]</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private var helloResult:String<SPAN style="COLOR: rgb(0,0,204)">;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private function sayHelloTo<SPAN style="COLOR: rgb(0,0,204)">(</SPAN><SPAN style="COLOR: rgb(0,0,204)">)</SPAN><SPAN style="COLOR: rgb(0,0,204)">:</SPAN>void <SPAN style="COLOR: rgb(0,0,204)">{</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ro<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>sayHelloTo<SPAN style="COLOR: rgb(0,0,204)">(</SPAN>inputText<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>text<SPAN style="COLOR: rgb(0,0,204)">)</SPAN><SPAN style="COLOR: rgb(0,0,204)">;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">}</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private function resultHandler<SPAN style="COLOR: rgb(0,0,204)">(</SPAN>event:ResultEvent<SPAN style="COLOR: rgb(0,0,204)">)</SPAN><SPAN style="COLOR: rgb(0,0,204)">:</SPAN>void <SPAN style="COLOR: rgb(0,0,204)">{</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;helloResult <SPAN style="COLOR: rgb(0,0,204)">=</SPAN> event<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>result as String<SPAN style="COLOR: rgb(0,0,204)">;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: rgb(0,0,204)">}</SPAN> <SPAN style="COLOR: rgb(0,0,204)">]</SPAN><SPAN style="COLOR: rgb(0,0,204)">]</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN>mx:<SPAN style="COLOR: rgb(0,0,255)">Script</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>mx:RemoteObject id<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"ro"</SPAN> destination<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"helloworld"</SPAN> result<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"resultHandler(event)"</SPAN> <SPAN style="COLOR: rgb(0,0,204)">/</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>mx:HBox width<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"100%"</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>mx:TextInput id<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"inputText"</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>mx:Button label<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"Submit"</SPAN> click<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"sayHelloTo()"</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN>mx:HBox<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>mx:Label text<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"{helloResult}"</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN>mx:Application<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR></SPAN></CODE></P></TD></TR></TBODY></TABLE>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 14pt"><SPAN><FONT face="Times New Roman">11.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">现在，我们要定义</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><FONT face="Times New Roman">remote object</FONT></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">来是的你的</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><FONT face="Times New Roman">flex</FONT></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">程序能够调用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><FONT face="Times New Roman">java </FONT></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">类。首先来配置</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><FONT face="Times New Roman">/WEB-INF/flex/remoting-config.xml</FONT></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">文件，添加以下粗体部分来新增一个</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><FONT face="Times New Roman">destionation—HelloWorld</FONT></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">类。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><o:p></o:p></SPAN></P>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#999999 cellSpacing=0 cellPadding=0 width="95%" bgColor=#f1f1f1 border=1>
<TBODY>
<TR>
<TD>
<P style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN style="COLOR: rgb(0,0,0)"><SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">?</SPAN>xml version<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"1.0"</SPAN> encoding<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"UTF-8"</SPAN><SPAN style="COLOR: rgb(255,0,255)">?</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR><SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>service <SPAN style="COLOR: rgb(255,0,0)">id</SPAN><SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"remoting-service"</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(255,0,0)">class</SPAN><SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"flex.messaging.services.RemotingService"</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>adapters<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>adapter-definition <SPAN style="COLOR: rgb(255,0,0)">id</SPAN><SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"java-object"</SPAN> <SPAN style="COLOR: rgb(255,0,0)">class</SPAN><SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"flex.messaging.services.remoting.adapters.JavaAdapter"</SPAN> default<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"true"</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN>adapters<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>default-channels<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>channel ref<SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"my-amf"</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN>default-channels<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR><SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>destination <SPAN style="COLOR: rgb(255,0,0)">id</SPAN><SPAN style="COLOR: rgb(0,0,204)">=</SPAN><SPAN style="COLOR: rgb(255,0,255)">"helloworld"</SPAN><SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>properties<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN>source<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN>hello<SPAN style="COLOR: rgb(0,0,204)">.</SPAN>HelloWorld<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN>source<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN>properties<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN> <BR>&nbsp;<SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN>destination<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR><SPAN style="COLOR: rgb(0,0,204)">&lt;</SPAN><SPAN style="COLOR: rgb(0,0,204)">/</SPAN>service<SPAN style="COLOR: rgb(0,0,204)">&gt;</SPAN><BR></SPAN></CODE></P></TD></TR></TBODY></TABLE><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">12. 到此，配置结束。然后选择</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: 'Times New Roman'">BlazeApp</SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">项目，选择在服务器上执行。即浏览地址为：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt; FONT-FAMILY: 'Times New Roman'"><A href="http://localhost:8080/BlazedApp/BlazedApp.html"><FONT color=#0000ff>http://localhost:8080/BlazedApp/BlazedApp.html</FONT></A> </SPAN><SPAN style="http://vip.zhmy.com/FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">如果你能在输入框输入字段之后，点击按钮能返回</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt">Hello,XXX</SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">的信息，就代表成功了。如图：<SPAN style="FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 楷体_GB2312"><IMG src="http://photo1.bababian.com/upload11/20080603/EB4C6D4DE1687EB327F0F0F131A53AED_500.jpg"></SPAN> 
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 14pt"><SPAN><FONT face="Times New Roman">13.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">（我使用的例子的工程名字叫做</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><FONT face="Times New Roman">DSTest</FONT></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">除此之外操作相同，另外附录中的程序也是使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><FONT face="Times New Roman">DSTest</FONT></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">。请自行参考。）</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 14pt"><SPAN><FONT face="Times New Roman">14.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT></SPAN></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">参考文献：</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><A href="http://blog.baao.com/blojsom/blog/yac/BlazeDS/BlazeDS-avec-Flex-builder-3-Tomcat-6-et-les-webtools?smm=y"><FONT face="http://vip.zhmy.com/Times New Roman" color=#800080>http://blog.baao.com/blojsom/blog/yac/BlazeDS/BlazeDS-avec-Flex-builder-3-Tomcat-6-et-les-webtools?smm=y</FONT></A><FONT face="Times New Roman"> </FONT></SPAN><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">以及</SPAN><SPAN lang=EN-US style="FONT-SIZE: 14pt"><A href="http://java-x.blogspot.com/2008/03/blazeds-for-java-flex-communication.html#sampleCode"><FONT face="http://vip.zhmy.com/Times New Roman" color=#800080>http://java-x.blogspot.com/2008/03/blazeds-for-java-flex-communication.html#sampleCode</FONT></A></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 14pt"><SPAN><SPAN style="TEXT-DECORATION: underline"></SPAN><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp; <BR></SPAN></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN lang=EN-US style="FONT-SIZE: 14pt"><SPAN><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp; </SPAN></SPAN></SPAN>&lt;!--[endif]--&gt;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt"><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY: 楷体_GB2312">附件：</SPAN><SPAN class=MsoHyperlink><SPAN lang=EN-US><A title=工程文件 href="http://download.csdn.net/source/482338" target=_blank><SPAN style="http://vip.zhmy.com/FONT-SIZE: 14pt">http://download.csdn.net/source/482338</SPAN></A><FONT color=#000000>&nbsp;</FONT></SPAN></SPAN></P>
<P><EM></EM>&nbsp;</P>
<P><EM>源代码，包括Jar包：<A href="http://vip.zhmy.com/UploadFlies/2010-3/7014924767.rar">BlazeDsDemo</A></P></EM></SPAN>]]></description>
<author>sam</author>
<pubDate>2010-3-6 11:15:00</pubDate>
</item>
<item>
<title><![CDATA[【转】Flex代码格式化插件（Eclipse插件）]]></title>
<link>http://zhan.zhmy.com/archives/2010/158550.html</link>
<description><![CDATA[<div class="blog_content">
    <div class="blog_content">
<div id="BlogArticleDetail" style="font-size: 14px;">
<p>这是一款针对于Flex/ActionScript 3.0格式化的插件（基于eclipse），可以方便的对source进行格式化操作。</p><p>下载地址：<a href="http://sourceforge.net/projects/flexformatter/">http://sourceforge.net/projects/flexformatter/</a><br></p>
<p>使用方法：</p>
<ol><li>Eclipse 
3.4：下载了FlexPrettyPrintCommand_0.6.19.jar文件后，将下载的jar放置到dropins文件夹下面，并且重启
Eclipse。</li><li>Eclipse 
3.3：下载了FlexPrettyPrintCommand_0.6.19.jar文件后，将下载的jar放置到plugins文件夹下面，并且重启
Eclipse。</li></ol>
<p>在线更新：可以使用<a href="http://flexformatter.googlecode.com/svn/trunk/FlexFormatter/FlexPrettyPrintCommandUpdateSite" target="http://vip.zhmy.com/_blank">http://flexformatter.googlecode.com/svn/trunk/FlexFormatter/FlexPrettyPrintCommandUpdateSite</a>
这个地址进行在线更新。</p>
<p>通过CVS工具你可以获得这个插件的源码，在SVN目录下没有源码存放。</p>
<p>这篇博客对这个插件做了介绍：<a href="http://www.herrodius.com/blog/165">http://www.herrodius.com/blog/165</a>
</p>
<p>FlexPrettyPrintCommand的官方地址：<a href="http://sourceforge.net/projects/flexformatter/">http://sourceforge.net/projects/flexformatter/</a>
</p>
<p>该插件还可以在FB中进行详细参数的设定，具体路径是：Window/Preferences…/Flex Formatting</p>
<p>这些设定的说明在这里：使用和说明文档：<a href="http://sourceforge.net/docman/?group_id=248408">http://sourceforge.net/docman/?group_id=248408</a>
</p>
<p>该工具的一个比较智能的设定是关于保存时自动格式化的选项，此外用过这个插件的人都知道，他的注释行默认是不缩进的，这也可以通过设置来修改。</p>
</div>
</div>
    
  </div>]]></description>
<author>sam</author>
<pubDate>2010-3-6 11:13:00</pubDate>
</item>
<item>
<title><![CDATA[【转】Flex Builder 3.0 for Eclipse]]></title>
<link>http://zhan.zhmy.com/archives/2010/158549.html</link>
<description><![CDATA[这两天准备学习Flex,于是下载了Flex Builder 3.0 For Eclipse plugin准备安装. <br>
但是安装后启动Eclipse,找了半天也没找到Flex.而且Flex Builder会把JRE也安装.觉得这样很不爽. <br><br>
所以我想到能不能来个Flex Builder绿色安装方法呢. <br><br>
想到就做.下面是我的安装过程.(前提是系统已经有JRE,且JAVA环境变量已经配置OK,此处略过该安装) <br><br>
一.首先下载安装Eclipse 3.3 解压到 D:\Program Files\eclipse 到算安装成功了. <br><br>
二.下载安装Flex Builder 3.0 <br>
http://trials.adobe.com/Applicat ... FB3_WWEJ_Plugin.exe <br>
1. 指定 Flex Builder 3.0 安装路径为D:\Program Files\eclipse\Flex Builder,进下一步. 
(你也可设为其它目录,但不要这样:D:\Program Files\eclipse) <br>
2. 指定 Eclipse 安装路径为 D:\Program Files\eclipse 进下一步. <br>
3. 选择是否安装浏览器 Flash Plyer 9 插件(可选安装) <br>
安装要花一点时间.大家慢慢等待...出现一些提示你不用管它. <br>
等安装完后运行 Eclipse.exe 你是看不到 Flex的..往下看我会帮你解决这个问题^_^ <br><br>
三. 绿化Flex Builder 这是重点. <br>
1. 把D:\Program Files\eclipse\Flex 
Builder\com.adobe.flexbuilder.update.site\下的 plugins、features、site.xml <br>
复制到 D:\Program Files\eclipse\ (如果你的eclipse目录已经有一个site.xml 
你只要把两个文件的feature节内容合并就好了.) <br><br>
2. 把D:\Program Files\eclipse\Flex Builder\eclipse\下的 
plugins、features(如果有的话,这是Eclipse的一些更新) <br>
复制到 D:\Program Files\eclipse\ <br><br>
3. 把D:\Program Files\eclipse\Flex Builder\sdks 复制到D:\Program 
Files\eclipse\ <br><br>
OK,Flex Builder安装完成,接下来就是启动Elipse <br>
我们现在已经可以找到Flex了.但还没完,请往下看. <br><br>
4. 进行Flex的配置. <br>
在Eclipse中.点击-&gt;Window-&gt;Preferences-&gt;Flex-&gt;Installed Flex SDKs
 <br>
修改Flex SDKs 2.0 和 Flex SDKs 3.0的路径（既前面的sdks目录下的sdk路径），点Apply让设置成效. <br><br>
重启Eclipse..你就可以开发Flex了. <br><br>
5. 现在你的Flex已经开始工作了.但之前安装的Flex Builder怎么办呢.哈哈. <br>
运行这个D:\Program Files\eclipse\Flex Builder\Uninstall Adobe Flex Builder 3
 Plug-in\Uninstall Adobe Flex Builder 3 Plug-in.exe就可以了. <br><br>
可是这鬼东西怎么玩呢..呵呵..大家一起学习交流吧..]]></description>
<author>sam</author>
<pubDate>2010-3-6 11:12:00</pubDate>
</item>
<item>
<title><![CDATA[[转]Subversion合并跟踪 – 基础]]></title>
<link>http://zhan.zhmy.com/archives/2010/158336.html</link>
<description><![CDATA[<P>Subversion 1.5支持合并跟踪，本文将对什么是合并跟踪，及其对你们组织具备的意义提供了高级的总体看法，我将会从许多基本的解释开始，如果你熟悉分支与合并，请掠过第1段。</P>
<P><STRONG><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">1. 什么是分支与合并？</SPAN> </STRONG></P>
<P>开发团队经常会在多个并行线上开发，叫做”分支”，一个分支从拷贝开发项目（或一个目录）所有的文件开始，然后开始单独的维护这个拷贝，文件开始都是相同的，但经过一段时间，它们将会不同，因为不同的开发者在不同分支做出了修改。</P>
<P>为什么分支？你或许在Subversion创建一个分支用来维护产品发布，同时为下一个版本工作。为什么？下一个版本会有新的特性，但是在维护分支你只接受bug修改。另一个用例是开发复杂的新特性，而它会将使得开发构建不稳定，通过在不同分支开发，你将其他开发者从可能的构建失败中分离出去。 Subversion自己的合并跟踪特性在一个分支上开发了差不多一年。</P>
<P>&nbsp;<IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://vip.zhmy.com/UploadFlies/2010-2/2136446876.bmp" border=0></P>
<P><SPAN style="COLOR: #999999">Graph 1. 两个分支的主线开发 (trunk)</SPAN> </P>
<P>Subversion一直支持分支，但与其他系统不同，它不会真正的拷贝文件，那样会快速加大版本库的体积。相反，Subversion会创建一个到原来已有目录的快速引用，只是记录分支和trunk的文件修改，这样的结果是创建分支非常迅速，版本库几乎不会增加大小。</P>
<P class=entry-more>有些时候，代码需要合并。例如，一个开发者在维护分支上修订了一个bug，你会希望将修改合并到主开发线上，否则，你的下个发布还会有这个bug。另一个例子是在分支上开发一个新特性。就像我们说的，Subversion自己的合并跟踪特性就是在分支上开发的，在2007年2月，这个特性足够稳定，然后合并到了trunk。</P>
<P>&nbsp;<IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" src="http://vip.zhmy.com/UploadFlies/2010-2/2136326301.bmp" border=0></P>
<P><SPAN style="COLOR: #999999">Graph 2. 合并代码</SPAN> </P>
<P class=entry-more>让我们看一个简单的合并实例，这是我们的代码：</P>
<DIV class=entry-more>
<TABLE cellSpacing=0 cellPadding=4 width=560 border=1>
<TBODY>
<TR>
<TD vAlign=top width=280>
<P><STRONG>trunk的代码 (主码基)</STRONG> </P></TD>
<TD vAlign=top width=280></TD></TR>
<TR>
<TD vAlign=top width=280><PRE>main()
{
    printf(”hello, wordn”);
}
</PRE></TD>
<TD vAlign=top width=280></TD></TR></TBODY></TABLE></DIV>
<P class=entry-more>现在我们做一个分支，从用户的角度会有两份代码：</P>
<DIV class=entry-more>
<TABLE cellSpacing=0 cellPadding=4 width=560 border=1>
<TBODY>
<TR>
<TD vAlign=top width=280>
<P><STRONG>trunk的代码 (主码基)</STRONG> </P></TD>
<TD vAlign=top width=280>
<P><STRONG>分支代码</STRONG> </P></TD></TR>
<TR>
<TD vAlign=top width=280><PRE>main()
{
 printf(”hello, wordn”);
}
</PRE></TD>
<TD vAlign=top width=280><PRE>main()
{
 printf(”hello, wordn”);
}
</PRE></TD></TR>
<TR>
<TD vAlign=top width=280></TD>
<TD vAlign=top width=280>
<P>“Word”实际上应该为”World”，我们有一个bug，开发者在分支上修改了它，文件现在已经不同了。</P></TD></TR>
<TR>
<TD vAlign=top width=280><PRE>main()
{
 printf(”hello, wordn”);
}
</PRE></TD>
<TD vAlign=top width=280><PRE>main()
{
 printf(”hello, worldn”);
}
</PRE></TD></TR>
<TR>
<TD vAlign=top width=280></TD>
<TD vAlign=top width=280>
<P>在某一时刻，bug修正合并到了trunk<BR>&gt;&gt;svn merge: Subversion将修改从分支合并到trunk。</P></TD></TR>
<TR>
<TD vAlign=top width=280><PRE>main()
{
 printf(”hello, worldn”);
}
</PRE></TD>
<TD vAlign=top width=280><PRE>main()
{
 printf(”hello, worldn”);
}
</PRE></TD></TR></TBODY></TABLE></DIV>
<P class=entry-more><STRONG><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">2. Subversion与合并</SPAN> </STRONG></P>
<P class=entry-more>就像分支，Subversion一直支持合并，如果你要求它可以自动完成许多工作。但是Subversion不会”记住”什么代码从什么分支在什么时候合并，尽管分支与合并在Subversion中工作很好，但是合并跟踪特性的添加解决了许多限制：</P>
<DIV class=entry-more>
<UL>
<LI>重复合并，假设你有一个特性分支与主干同步，没有合并跟踪时，你必须小心的（且手工的）记录哪些修订版本已经合并，这会非常乏味，而且如果你忘了合并特定修改或是创建叫做”伪造的冲突”的东西，这意味着文件没有正确的合并，结果修订版本有错误。 
<LI>审计。当你合并一个特性分支回trunk，trunk的历史只记录了合并的发生，但是不知道合并了什么，这样就很难准确找出合并了什么到trunk。 </LI></UL></DIV>
<P><STRONG><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">3. 这对你意味着什么？</SPAN> </STRONG></P>
<P>开发团队多年里成功使用Subversion分支和合并，但是合并跟踪提供了许多好处：</P>
<UL>
<LI>合并跟踪添加了审计/跟踪能力（那些代码合并了，何时，何地？）。许多组织因为管理目的需要这个特性。 
<LI>合并跟踪减少了错误和管理费用。团队会因为Subversion的合并跟踪功能提高生产力。 
<LI>经常合并很重要。两个开始相同的文件会随着时间变得很不一样，不同的越多，越难以合并。如果经常合并，增量的区别会比较小，会易于合并。合并跟踪可以使得易于经常合并。 
<LI>许多选择Subversion的公司采用限制分支的策略，他们不能从好的分支策略和并行开发中得到好处，例如：他们选择在主开发线开发一个风险很大的新特性，结果就是项目成员要处理经常的构建错误。 
<LI>最终的好处：一些公司还没有使用Subversion，而使用传统的昂贵的工具，他们在等待合并跟踪。 </LI></UL>
<P><STRONG><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">4. Subversion 1.5的合并跟踪</SPAN> </STRONG></P>
<P>Subversion 1.5记录合并时发生的事情：它会跟踪合并，所以下一次Subversion会记住上一次合并的事情，这个特性支持了下面的用例：</P>
<UL>
<LI>重复合并：本周将分支合并到另一个分支，下一周再做一遍。Subversion会记住已经合并的东西，而且只合并新的修改。 
<LI>冲突解决的自动合并。Subversion可以自动完成合并的大多数工作，但是合并不可避免的带来冲突，Subversion的内部合并算法不能解决。如果这样，Subversion会告诉用户手工解决冲突。<A href="http://blogs.open.collab.net/svn/2007/07/subversion-15--.html"><FONT color=#006600>Mark Phippard的讲了这个问题</FONT></A> 。 
<LI>Cherry picking：合并只针对一个或部分修改，而不是所有的修改。 
<LI>记录手工合并：有时候用户会手工合并一些东西（使用编辑器从一个文件拷贝代码到另一个文件），Subversion 1.5具备明确添加手工合并的能力，所以合并跟踪信息依然完整。 
<LI>合并回退：取消一个合并。合并经常不是很完美，你会发现一些事情出了问题，Subversion允许你取消合并。 
<LI>合并审计：合并数据会自动添加到提交日志（<A href="http://blogs.open.collab.net/svn/2007/06/merge_auditing_.html"><FONT color=#006600>Mark Phippard也讲了这个问题</FONT></A> ）。 </LI></UL>
<P>&nbsp;</P>
<P><STRONG><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">5. GUI客户端和合并跟踪</SPAN> </STRONG></P>
<P>如果Subversion的GUI客户端支持它，合并跟踪会真的非常强大。GUI客户端会利用合并跟踪特性让合并易于使用，而且对所有用户都更加接近。CollabNet在一个Eclipse的合并跟踪客户端上工作，未来的几天可能会有一个预览，openCollabNet这里。</P>
<P>Subversion 1.5对客户端有一个反馈，例如：有时候Subversion不能自动合并两个文件，需要开发者解决”合并冲突”，Subversion会告诉客户，由客户来决定怎样做，例如Subclipse会将冲突文件发送到Eclipse的图形化diff工具，所以用户可以解决这个冲突（它实际上进行了3方 diff，但是那超出了本文的范围）。</P>
<P><STRONG><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">6. 合并跟踪早期采用计划</SPAN> </STRONG></P>
<P>为了加快Subversion 1.5的合并跟踪特性的开发，CollabNet在openCollabNet开始了一个<A href="http://merge-tracking.open.collab.net/"><FONT color=#006600>Merge Tracking Early Adopter Program</FONT></A> ，在这个程序里你可以看到：</P>
<UL>
<LI>Subversion合并跟踪设计文档。 
<LI>包含合并跟踪特性的Subversion 1.5预发布程序 
<LI>一个包含合并跟踪历史的实例Subversion版本库 
<LI>一个与CollabNet的Subversion提交者和其他人讨论这个特性的论坛 
<LI>缺陷报告和改进请求 
<LI>很快也会发布GUI客户端 </LI></UL>
<P>你可以在这里找到程序：<A href="http://merge-tracking.open.collab.net/"><FONT color=#006600>http://merge-tracking.open.collab.net</FONT></A> </P>
<P><STRONG><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">7. 下面是什么？</SPAN> </STRONG></P>
<P>合并跟踪的主张很直接：”Subversion以前没有这个功能，现在有了”，你准备好了吗？</P>
<P>&nbsp;</P>
<UL>
<LI>如果你正在因为不想处理麻烦的手工合并跟踪而为分支踌躇，你或许可以重新思考一下分支策略，来充分利用在不同分支并行开发的好处。在9月26 日，CollabNet会组织一个关于分支策略的webinar，CollabNet的Subversion顾问Bob Jenkins和Auke Jilderda会解释不同的分支策略，并展示Subversion 1.5如何支持他们。<A href="http://w.on24.com/r.htm?e=92421&amp;amp;s=1&amp;amp;k=D1AEC864A46FB30A4FBB52EDC8EDBB15&amp;amp;partnerref=1240"><FONT color=#006600>这里注册</FONT></A> 。 
<LI>合并跟踪改进了合并的质量，添加了跟踪能力。加入Merge Tracking Early Adopter program，现在就开始学习这个新特性。下载我们的客户端并使用，它将会帮助我们为Subversion 1.5做好准备。 
<LI>如果你因为等待合并跟踪而还没有部署Subversion，现在是你离开你的遗留工具而使用Subversion的时候了。 </LI></UL>
<P><STRONG><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">8. 背景：CollabNet与合并跟踪</SPAN> </STRONG></P>
<P>CollabNet强烈的投入到合并跟踪特性的开发：</P>
<UL>
<LI>CollabNet组织了需求收集的客户峰会（2006年1月）。 
<LI>CollabNet雇员编写了大多数规格。 
<LI>CollabNet领导了合并跟踪特性的开发力量。 
<LI>我们开始了Merge Tracking Early Adopter Program。 
<LI>CollabNet开发了合并跟踪的GUI客户端 </LI></UL>
<P>&nbsp;</P>
<P>来源：<A href="http://yangzb.javaeye.com/blog/256310">http://yangzb.javaeye.com/blog/256310</A></P>]]></description>
<author>sam</author>
<pubDate>2010-2-2 13:10:00</pubDate>
</item>
<item>
<title><![CDATA[[转]关于在Eclipse下使用Subversion教程]]></title>
<link>http://zhan.zhmy.com/archives/2010/158335.html</link>
<description><![CDATA[<DIV style="TEXT-INDENT: 31.5pt; TEXT-ALIGN: left">工具：</DIV>
<DIV style="TEXT-INDENT: 31.5pt; TEXT-ALIGN: left"><SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">svn</FONT></SPAN>-1.3.2-setup.exe …………………………………… <SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">SVN</FONT></SPAN>服务端</DIV>
<DIV style="TEXT-INDENT: 31.5pt; TEXT-ALIGN: left">TortoiseSVN-1.3.5.6804-<SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">svn</FONT></SPAN>-1.3.2.msi ……………… <SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">SVN</FONT></SPAN>客户端</DIV>
<DIV style="TEXT-INDENT: 31.5pt; TEXT-ALIGN: left">LanguagePack-1.3.5.6804-win32-zh_CN.exe …………中文语言包</DIV>
<DIV style="TEXT-INDENT: 31.5pt; TEXT-ALIGN: left">Subclipse ………………………………………………<SPAN class=hilite1><SPAN class=hilite1><FONT style="BACKGROUND-COLOR: #ffff00">Eclipse</FONT></SPAN></SPAN> 插件</DIV>
<DIV style="TEXT-ALIGN: left">使用步骤：</DIV>
<DIV style="TEXT-ALIGN: left">&nbsp;</DIV>
<DIV style="TEXT-ALIGN: left">第一步：建立推荐的虚拟目录结构：例如：我建了一个这样的目录：D:\temp\New\, 并且, 在这个目录下创建三个文件夹，名称依次为：trunk，branches，tags。 接着把我们要控制的项目复制到trunk中。(trunk中保存)</DIV>
<DIV style="TEXT-ALIGN: left">第二步：创建Subversion仓库：例如：我在D盘建了一个名称为<SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">SVN</FONT></SPAN>的文件夹，再鼠标右击， 选中TortoiseSVN-&gt;create restore here , 在点击确定即可</DIV>
<DIV style="TEXT-ALIGN: left">注：</DIV>
<DIV style="TEXT-INDENT: 10.5pt; TEXT-ALIGN: left">Subversion的使用主要在于创建服务器端的仓库，其中关键文件在于conf文件夹中的</DIV>
<DIV style="TEXT-INDENT: 10.5pt; TEXT-ALIGN: left">authz, svnserve.conf, passwd三个文件</DIV>
<DIV style="TEXT-ALIGN: left">其中authz用于部署访问权限，passwd文件存放访问者密码，svnserve.conf属于基本的配置文件，用于配置访问其他文件。</DIV>
<DIV style="TEXT-ALIGN: left">第三步：修改配置文件， 在Subversion仓库中的conf文件夹中的authz 中依次修改为：</DIV>
<DIV style="TEXT-ALIGN: left">[groups]</DIV>
<DIV style="TEXT-ALIGN: left">harry_and_sally = harry,sally</DIV>
<DIV style="TEXT-ALIGN: left">&nbsp;</DIV>
<DIV style="TEXT-ALIGN: left"># [/foo/bar]</DIV>
<DIV style="TEXT-ALIGN: left">harry = rw</DIV>
<DIV style="TEXT-ALIGN: left">* =</DIV>
<DIV style="TEXT-ALIGN: left">&nbsp;</DIV>
<DIV style="TEXT-ALIGN: left">[/]</DIV>
<DIV style="TEXT-ALIGN: left">@harry_and_sally = rw</DIV>
<DIV style="TEXT-ALIGN: left">* = r</DIV>
<DIV style="TEXT-ALIGN: left">在passwd中依次修改为：</DIV>
<DIV style="TEXT-ALIGN: left">[users]</DIV>
<DIV style="TEXT-ALIGN: left">harry = harry</DIV>
<DIV style="TEXT-ALIGN: left">sally = sally</DIV>
<DIV style="TEXT-ALIGN: left">在svnserve.conf中依次修改为：</DIV>
<DIV style="TEXT-ALIGN: left">[general]</DIV>
<DIV style="TEXT-ALIGN: left">anon-access = none</DIV>
<DIV style="TEXT-ALIGN: left">auth-access = write</DIV>
<DIV style="TEXT-ALIGN: left">password-db = passwd</DIV>
<DIV style="TEXT-ALIGN: left">authz-db = authz</DIV>
<DIV style="TEXT-ALIGN: left">第四步：启动服务器：在命令行中依次输入：svnserve&nbsp;–d&nbsp;–r&nbsp;创建Subversion仓库，</DIV>
<DIV style="TEXT-ALIGN: left">我的路径是D:\<SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">SVN</FONT></SPAN></DIV>
<DIV style="TEXT-ALIGN: left">第五步：导入数据：将刚才建的虚拟目录的内容导入到Subversion仓库，按照我的例子</DIV>
<DIV style="TEXT-ALIGN: left">就应该是在New文件夹下右击，选择check out, 如图：</DIV>
<DIV style="TEXT-ALIGN: left"><A href="http://www.pcdog.com/ArtImage/20070130/wx36_1.png" target=_blank><IMG height=318 alt=关于在Eclipse下使用Subversion教程（图一） src="http://www.pcdog.com/ArtImage/20070130/wx36_1.png" width=448 border=0><FONT color=#006600> </FONT></A></DIV>
<DIV style="TEXT-ALIGN: left">这将会在Subversion仓库中创建这些内容,我们可以在<SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">SVN</FONT></SPAN>文件夹上右击，选中TortoiseSVN-&gt; Repo-brower 就会看到如图的内容：</DIV>
<DIV style="TEXT-ALIGN: left"><A href="http://www.pcdog.com/ArtImage/20070130/wx36_2.png" target=_blank><IMG alt=关于在Eclipse下使用Subversion教程（图二） src="http://www.pcdog.com/ArtImage/20070130/wx36_2.png" width=590 border=0><FONT color=#006600> 点击查看大图</FONT></A> </DIV>
<DIV style="TEXT-ALIGN: left">（注意开始的时候里面文件的版本都为1， 我这是对它操作以后的截图， 不好意思哦）</DIV>
<DIV style="TEXT-ALIGN: left">第五步：在<SPAN class=hilite1><SPAN class=hilite1><FONT style="BACKGROUND-COLOR: #ffff00">Eclipse</FONT></SPAN></SPAN> 中装上Subclipse插件，装好之后， 在<SPAN class=hilite1><SPAN class=hilite1><FONT style="BACKGROUND-COLOR: #ffff00">Eclipse</FONT></SPAN></SPAN> 中选择Windows-&gt; Show View-&gt;others 就会出现如图：</DIV>
<DIV style="TEXT-ALIGN: left"><A href="http://www.pcdog.com/ArtImage/20070130/wx36_3.png" target=_blank><IMG height=377 alt=关于在Eclipse下使用Subversion教程（图三） src="http://www.pcdog.com/ArtImage/20070130/wx36_3.png" width=276 border=0><FONT color=#006600> </FONT></A>选中<SPAN class=hilite2><FONT style="http://vip.zhmy.com/BACKGROUND-COLOR: #55ff55">SVN</FONT></SPAN>资源库，再在控制台上右击，选择新建-&gt; 数据库位置， 就会出现：</DIV>
<DIV style="TEXT-ALIGN: left"><A href="http://www.pcdog.com/ArtImage/20070130/wx36_4.png" target=_blank><IMG height=412 alt=关于在Eclipse下使用Subversion教程（图四） src="http://www.pcdog.com/ArtImage/20070130/wx36_4.png" width=525 border=0><FONT color=#006600> </FONT></A></DIV>
<DIV style="TEXT-ALIGN: left">点Finish之后，就会在控制台上看到如图： <IMG height=3 alt=关于在Eclipse下使用Subversion教程（图五） src="http://www.pcdog.com/ArtImage/20070130/wx36_5.png" width=3 border=0> <A href="http://www.pcdog.com/ArtImage/20070130/wx36_6.png" target=_blank><IMG alt=关于在Eclipse下使用Subversion教程（图六） src="http://www.pcdog.com/ArtImage/20070130/wx36_6.png" width=590 border=0><FONT color=#006600> </FONT></A></DIV>
<P>
<TABLE class=zhi14 style="HEIGHT: 317px; TEXT-ALIGN: left" cellSpacing=0 cellPadding=0 width=688 border=0>
<TBODY>
<TR height=1>
<TD width=686 height=1><FONT color=#006600></FONT></TD>
<TR height=6>
<TD width=686><FONT color=#006600></FONT></TD>
<TR>
<TD vAlign=top width=686 height=25>
<P align=right><FONT color=#006600></FONT>&nbsp;</P></TD></TR>
<TR>
<TD vAlign=top width=686 height=25>
<P>　　&nbsp;<SPAN id=span_text999><BR></SPAN></P>
<DIV>点Finish之后，就会在控制台上看到如图： <IMG height=3 alt=关于在Eclipse下使用Subversion教程（图五） src="http://www.pcdog.com/ArtImage/20070130/wx36_5.png" width=3 border=0> <A href="http://www.pcdog.com/ArtImage/20070130/wx36_6.png" target=_blank><IMG alt=关于在Eclipse下使用Subversion教程（图六） src="http://www.pcdog.com/ArtImage/20070130/wx36_6.png" width=590 border=0><FONT color=#006600> 点击查看大图</FONT></A> 
<P align=center>&nbsp;</P></DIV>
<DIV>第六步：选中truck ,右击选中取出为：如图所示：</DIV>
<DIV><A href="http://www.pcdog.com/ArtImage/20070130/wx36_7.png" target=_blank><IMG height=412 alt=关于在Eclipse下使用Subversion教程（图七） src="http://www.pcdog.com/ArtImage/20070130/wx36_7.png" width=525 border=0><FONT color=#006600> </FONT></A></DIV>
<DIV>选中Finish之后就在<SPAN class=hilite1><SPAN class=hilite1><FONT style="BACKGROUND-COLOR: #ffff00">Eclipse</FONT></SPAN></SPAN> 中加入了一个工作副本</DIV>
<DIV>如图所示：</DIV>
<DIV><A href="http://www.pcdog.com/ArtImage/20070130/wx36_8.png" target=_blank><IMG alt=关于在Eclipse下使用Subversion教程（图八） src="http://www.pcdog.com/ArtImage/20070130/wx36_8.png" width=590 border=0><FONT color=#006600> 点击查看大图</FONT></A> </DIV>
<DIV>这个时候相当于在磁盘的某一个位置上建立了一个客户端，默认在<SPAN class=hilite1><SPAN class=hilite1><FONT style="BACKGROUND-COLOR: #ffff00">Eclipse</FONT></SPAN></SPAN> 的 workspace下的某一个文件夹下</DIV>
<DIV>第七步：建立分支与标记：单击需要分支与标记的项目；选中Team-&gt; 分支/标记, 会出现如图：</DIV>
<DIV><A href="http://www.pcdog.com/ArtImage/20070130/wx36_9.png" target=_blank><IMG height=482 alt=关于在Eclipse下使用Subversion教程（图九） src="http://www.pcdog.com/ArtImage/20070130/wx36_9.png" width=576 border=0><FONT color=#006600> </FONT></A></DIV>
<DIV>
<DIV>点OK 之后，就会在控制台出现：Copy-rHEADsvn://localhost/trunk/News &nbsp;<SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">svn</FONT></SPAN>://localhost/branches/branches_4.1 </DIV>
<DIV>表示已经建立了这个分支，和上面相同，在建立一个标记副本 <BR><A href="http://www.pcdog.com/ArtImage/20070130/wx36_10.png" target=_blank><IMG height=482 alt=关于在Eclipse下使用Subversion教程（图十） src="http://www.pcdog.com/ArtImage/20070130/wx36_10.png" width=576 border=0><FONT color=#006600> </FONT></A></DIV>
<DIV>
<DIV>就会在控制台出现：copy -rHEAD <SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">svn</FONT></SPAN>://localhost/trunk/News <SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">svn</FONT></SPAN>://localhost/tags/tags_4.1</DIV>
<DIV>第八步：建立切换，作用在于对此分支的操作不会影响到对tunck中的程序了</DIV>
<DIV>&nbsp;选中刚才建立分支的文件夹，右击选择Team-&gt;切换 如图所示：</DIV>
<DIV>&nbsp;<A href="http://www.pcdog.com/ArtImage/20070130/wx36_11.png" target=_blank><IMG alt=关于在Eclipse下使用Subversion教程（图十一） src="http://www.pcdog.com/ArtImage/20070130/wx36_11.png" width=590 border=0><FONT color=#006600> 点击查看大图</FONT></A> &nbsp;</DIV>
<DIV>&nbsp;点OK 之后， 就会在控制台上显示：switch <SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">svn</FONT></SPAN>://localhost/trunk/News E:/javaStady/trunk/News -rHEAD </DIV>
<DIV>第九步：合并操作. 对某些文件就可以进行一下同步了， 将新版本改变的内容整合到trunk中，在控制台上我们可以看到：merge -rHEAD:HEAD <SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">svn</FONT></SPAN>://localhost/branches/branches_4.1 E:/javaStady/trunk/News</DIV>
<DIV>&nbsp;&nbsp;&nbsp; Merge complete.</DIV>
<DIV>merge -rHEAD:HEAD <SPAN class=hilite2><FONT style="BACKGROUND-COLOR: #55ff55">svn</FONT></SPAN>://localhost/branches/branches_4.1 E:/javaStady/trunk/News</DIV>
<DIV style="TEXT-INDENT: 21pt">Merge complete.</DIV>
<DIV style="TEXT-INDENT: 21pt">&nbsp;</DIV>
<DIV style="TEXT-INDENT: 21pt">最后我们看一下TortoiseSVN-&gt; Repo-brower中的变化：</DIV>
<DIV style="TEXT-INDENT: 21pt"><A href="http://www.pcdog.com/ArtImage/20070130/wx36_12.png" target=_blank><IMG alt=关于在Eclipse下使用Subversion教程（图十二） src="http://www.pcdog.com/ArtImage/20070130/wx36_12.png" width=590 border=0><FONT color=#006600> 点击查看大图</FONT></A> </DIV>
<DIV>&nbsp;merge实际是比较前后两个版本之间的差别，然后将这些差别应用到工作拷贝上的一个操作，根据源与目的版本号的先后，出现了“合并”、“撤销”等不同效果，然后通过提交（commit）来将这些效果保存到服务器端中。</DIV></DIV></DIV></TD></TR></TBODY></TABLE></P>
<P>&nbsp;</P>
<P>来源：<A href="http://johnnhe.javaeye.com/blog/285588">http://johnnhe.javaeye.com/blog/285588</A></P>]]></description>
<author>sam</author>
<pubDate>2010-2-2 13:01:00</pubDate>
</item>
<item>
<title><![CDATA[[转]SVN使用教程之-分支/标记 合并 subeclipse]]></title>
<link>http://zhan.zhmy.com/archives/2010/158334.html</link>
<description><![CDATA[<P><A href="http://energykey.javaeye.com/blog/512745">http://energykey.javaeye.com/blog/512745</A></P>]]></description>
<author>sam</author>
<pubDate>2010-2-2 12:58:00</pubDate>
</item>
<item>
<title><![CDATA[Dom4j下载及使用Dom4j读写XML简介]]></title>
<link>http://zhan.zhmy.com/archives/2010/158147.html</link>
<description><![CDATA[<P><FONT size=2>要使用dom4j读写XML文档,需要先下载dom4j包,dom4j官方网站在 http://www.dom4j.org/<BR>目前最新dom4j包下载地址:http://nchc.dl.sourceforge.net/sourceforge/dom4j/dom4j-1.6.1.zip</FONT></P>
<P><FONT size=2>解开后有两个包,仅操作XML文档的话把dom4j-1.6.1.jar加入工程就可以了,如果需要使用XPath的话还需要加入包jaxen-1.1-beta-7.jar.</FONT></P>
<P><FONT size=2>以下是相关操作:</FONT></P>
<P><STRONG><FONT size=2>一.Document对象相关</FONT></STRONG></P>
<P><FONT size=2>1.读取XML文件,获得document对象.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SAXReader reader = new SAXReader();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Document&nbsp; document = reader.read(new File("input.xml"));</FONT></P>
<P><FONT size=2>2.解析XML形式的文本,得到document对象.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String text = "&lt;members&gt;&lt;/members&gt;";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Document document = DocumentHelper.parseText(text);<BR>3.主动创建document对象.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Document document = DocumentHelper.createDocument();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element root = document.addElement("members");// 创建根节点<BR><STRONG></STRONG></FONT></P>
<P><STRONG><FONT size=2>二.节点相关</FONT></STRONG></P>
<P><FONT size=2>1.获取文档的根节点.<BR>Element rootElm = document.getRootElement();<BR>2.取得某节点的单个子节点.<BR>Element memberElm=root.element("member");// "member"是节点名<BR>3.取得节点的文字<BR>String text=memberElm.getText();<BR>也可以用:<BR>String text=root.elementText("name");这个是取得根节点下的name字节点的文字.</FONT></P>
<P><FONT size=2>4.取得某节点下名为"member"的所有字节点并进行遍历.<BR>List nodes = rootElm.elements("member");</FONT></P>
<P><FONT size=2>for (Iterator it = nodes.iterator(); it.hasNext();) {<BR>&nbsp;&nbsp; Element elm = (Element) it.next();<BR>&nbsp;&nbsp; // do something<BR>}<BR>5.对某节点下的所有子节点进行遍历.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(Iterator it=root.elementIterator();it.hasNext();){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element element = (Element) it.next();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // do something<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>6.在某节点下添加子节点.<BR>Element ageElm = newMemberElm.addElement("age");<BR>7.设置节点文字.<BR>ageElm.setText("29");<BR>8.删除某节点.<BR>parentElm.remove(childElm);// childElm是待删除的节点,parentElm是其父节点<BR><STRONG></STRONG></FONT></P>
<P><FONT size=2><STRONG>三.属性相关.</STRONG><BR>1.取得某节点下的某属性<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element root=document.getRootElement();&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Attribute attribute=root.attribute("size");// 属性名name<BR>2.取得属性的文字<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String text=attribute.getText();<BR>也可以用:<BR>String text2=root.element("name").attributeValue("firstname");这个是取得根节点下name字节点的属性firstname的值.</FONT></P>
<P><FONT size=2>3.遍历某节点的所有属性<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element root=document.getRootElement();&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(Iterator it=root.attributeIterator();it.hasNext();){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Attribute attribute = (Attribute) it.next();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String text=attribute.getText();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(text);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>4.设置某节点的属性和文字.<BR>newMemberElm.addAttribute("name", "sitinspring");<BR>5.设置属性的文字<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Attribute attribute=root.attribute("name");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attribute.setText("sitinspring");<BR>6.删除某属性<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Attribute attribute=root.attribute("size");// 属性名name<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root.remove(attribute);<BR><STRONG></STRONG></FONT></P>
<P><FONT size=2><STRONG>四.将文档写入XML文件.</STRONG><BR>1.文档中全为英文,不设置编码,直接写入的形式.<BR>XMLWriter writer = new XMLWriter(new FileWriter("output.xml"));<BR>writer.write(document);<BR>writer.close();<BR>2.文档中含有中文,设置编码格式写入的形式.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputFormat format = OutputFormat.createPrettyPrint();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format.setEncoding("GBK");&nbsp;&nbsp;&nbsp; // 指定XML编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XMLWriter writer = new XMLWriter(new FileWriter("output.xml"),format);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer.write(document);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer.close();<BR><STRONG></STRONG></FONT></P>
<P><FONT size=2><STRONG>五.字符串与XML的转换</STRONG><BR>1.将字符串转化为XML<BR>String text = "&lt;members&gt; &lt;member&gt;sitinspring&lt;/member&gt; &lt;/members&gt;";<BR>Document document = DocumentHelper.parseText(text);<BR>2.将文档或节点的XML转化为字符串.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SAXReader reader = new SAXReader();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Document&nbsp; document = reader.read(new File("input.xml"));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element root=document.getRootElement();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String docXmlText=document.asXML();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String rootXmlText=root.asXML();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element memberElm=root.element("member");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String memberXmlText=memberElm.asXML();<BR><STRONG></STRONG></FONT></P>
<P><FONT size=2><STRONG>六.使用XPath快速找到节点.</STRONG><BR>读取的XML文档示例<BR>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<BR>&lt;projectDescription&gt;<BR>&nbsp; &lt;name&gt;MemberManagement&lt;/name&gt;<BR>&nbsp; &lt;comment&gt;&lt;/comment&gt;<BR>&nbsp; &lt;projects&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;project&gt;PRJ1&lt;/project&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;project&gt;PRJ2&lt;/project&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;project&gt;PRJ3&lt;/project&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;project&gt;PRJ4&lt;/project&gt;<BR>&nbsp; &lt;/projects&gt;<BR>&nbsp; &lt;buildSpec&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;buildCommand&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;name&gt;org.eclipse.jdt.core.javabuilder&lt;/name&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;arguments&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/arguments&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/buildCommand&gt;<BR>&nbsp; &lt;/buildSpec&gt;<BR>&nbsp; &lt;natures&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;nature&gt;org.eclipse.jdt.core.javanature&lt;/nature&gt;<BR>&nbsp; &lt;/natures&gt;<BR>&lt;/projectDescription&gt;</FONT></P>
<P><FONT size=2>使用XPath快速找到节点project.<BR>&nbsp;public static void main(String[] args){<BR>&nbsp;&nbsp;&nbsp; SAXReader reader = new SAXReader();<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; try{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Document&nbsp; doc = reader.read(new File("sample.xml"));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List projects=doc.selectNodes("/projectDescription/projects/project");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Iterator it=projects.iterator();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while(it.hasNext()){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element elm=(Element)it.next();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(elm.getText());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; catch(Exception ex){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ex.printStackTrace();<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }</FONT></P>
<P><FONT size=2></FONT>&nbsp;</P>
<P><FONT size=2>来源：</FONT><A href="http://www.blogjava.net/junglesong/archive/2008/02/21/181196.html"><FONT size=2>http://www.blogjava.net/junglesong/archive/2008/02/21/181196.html</FONT></A></P>]]></description>
<author>sam</author>
<pubDate>2010-1-12 17:42:00</pubDate>
</item>

</channel>
</rss>
