??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲三级中文字幕,亚洲天堂中文字幕在线,在线精品自拍亚洲第一区http://m.tkk7.com/ericli1982/学习探讨开源和web开?/description>zh-cnSun, 11 May 2025 02:52:47 GMTSun, 11 May 2025 02:52:47 GMT60数码摄媄中的光及用光技?http://m.tkk7.com/ericli1982/archive/2006/10/02/73191.htmlericliericliMon, 02 Oct 2006 06:32:00 GMThttp://m.tkk7.com/ericli1982/archive/2006/10/02/73191.htmlhttp://m.tkk7.com/ericli1982/comments/73191.htmlhttp://m.tkk7.com/ericli1982/archive/2006/10/02/73191.html#Feedback2http://m.tkk7.com/ericli1982/comments/commentRss/73191.htmlhttp://m.tkk7.com/ericli1982/services/trackbacks/73191.html阅读全文

ericli 2006-10-02 14:32 发表评论
]]>
数码摄媄入门之六 名家名言http://m.tkk7.com/ericli1982/archive/2006/09/27/72288.htmlericliericliWed, 27 Sep 2006 05:49:00 GMThttp://m.tkk7.com/ericli1982/archive/2006/09/27/72288.htmlhttp://m.tkk7.com/ericli1982/comments/72288.htmlhttp://m.tkk7.com/ericli1982/archive/2006/09/27/72288.html#Feedback0http://m.tkk7.com/ericli1982/comments/commentRss/72288.htmlhttp://m.tkk7.com/ericli1982/services/trackbacks/72288.html国摄媄家维利·奎克的看法Q几乎所有的人都能够通过应用一些基本法则,辑ֈh相当水^的摄影构图能力。ؓ此,他提Z一些简单的Ҏ(gu)。他认ؓQ依据这些方法,M人都能在短时间内学会拍出较好的照片?

有些人或许对构图有天赋。不q,Ҏ(gu)国摄媄家维利·奎克的看法Q几乎所有的人都能够通过应用一些基本法则,辑ֈh相当水^的摄影构图能力。ؓ此,他提Z一些简单的Ҏ(gu)。他认ؓQ依据这些方法,M人都能在短时间内学会拍出较好的照片。?/p>

l利·奎克指出Q摄p最易犯的错误是拍摄点取得过高,与被摄体d太远Q致使画面出现各U各样与拍摄目的毫无关系的东ѝ?/p>

他说Q“请CQ画家是 把东西画q画面,而摄p则是从画面L一些东ѝ?他说Q“一张照片应该只有一个趣味中心,画面上不能有无用的东ѝ如果你Ҏ(gu)个物体是否有助于画面抱有怀疑,你就应尽可能地把它放弃掉。?q里是Z常说的摄影是“减法的艺术?/p>

奎克认ؓQ“这q不是说Q趣味中心非得准地|于交叉点上不可。正因ؓ如此Q实际上味中心常出现在交叉炚wq。”?/p>

奎克指出Q“每一q照片都应保持一定的q。这是_对主要被摄体的安排,不能使画、面出现向分量大的一边們ր。但qq不意味着两个同样大和同等形状的东西置于对U的位置。这里的关系Q只要你看一下在玩؜h的孩子就知道了。؜h两边的孩子,些的一个必定坐在离中央q些的地方,而大的孩子肯定坐在靠q中央的地方。”?/p>

奎克认ؓQ“把H出的线条安排,指向味中心Q是拍摄一q?zhn)目照片的另一个要素。这些线条被UCؓdU,有效地利用主导线Q可以创造出惊h的照片。把dU安排成对角U,会生有力的动感。?/p>

“线条常常在照片中提供一个边框。这可以通过选择视点来进行,例如在树下通过树枝框住画面上的被摄M。此旉常使用光圈,以整幅照片清晰。这样做Q也有可能Ҏ(gu)q于H出Q但安排适当Q会得到好照片。?br />“在一q照片中Q地q线的位|会lh以强烈的印象。拍摄时Q地q线要尽量避免处在照片的{比U上Q因样做会把照片均分Z半,lh以呆板的感觉。?/p>

地^U处在画面下方,会给Z宁静的感觉,而处于上方,lh的感觉则是活泹{有力的?“此外,横幅画面可以产生安宁、^静的感觉Q而竖直画面则会生动态效果。”?/p>

奎克认ؓQ以上方法如果运用得好,你的照片会出现明显的改观,而且随着旉的推U,你很快就会学会鉴赏构图,从而ؓ你增Lq乐趣。?br />

达柯 认ؓQ有时“如果线条与视觉产生了共鸣,一线条本w就能成Z个主体”?/p>

国摄媄家LQ小雅各希斯认ؓQ“构图是从摄p的心灵的眼睛做L。构囄q程也被UCؓ‘预见’,是在未拍摄某一物体之前或正在拍摄的时候,p在脑中形成一个图像或印象。通过l常析自己和别h的作品的构图Q就会自己的这U预见本领更加娴熟,变成一U本能。”这是我常说的用脑子拍照?/p>

U条构成画面

奥地利摄影家伊涅斯特·哈斯Ҏ(gu)也有同感Q对于构图,他己辑ֈ手中无剑Q剑在心中的境界Q他认ؓ、“构囑֜于^衡,每个人对q的处理都各有不同。”正如同武功辑ֈ最高境界时Q已没有招式名称Q只凭自q功力d解。他认ؓQ“你能忘记你的器材Q就能集中你的题材和构图,q时相机只是你眼睛的延箋Q再没有其他意义。?雅各布斯还认ؓQ“构囄最基本的因素是U条、Ş式、质感以及这些因素之间的I间。当然色彩同样也是不可忽略的因素。会聚的U条一般能说明透视关系Q但q不是所有的照片都非要表现出透视的深度不可。许多杰出的作品都是q面图案。在取景器中的某个景物或人物的肖像,都是Ҏ(gu)摄媄者个人的感受q行安排的。就是所谓摄影里所有的控制是服务于你想表达的情l?/p>

色彩的^衡很重要

“在大多数情况下Q每q照片中都有一个或一lŞ状或形式起主g用,而照片中的色彩、体U、位|和其他形状{,都是Z导因素服务的。……构图中的对比,是指大与、明与暗、近与远、主动与被动、^滑与_糙、色彩的艳与轻淡等{的Ҏ(gu)。要多利用这些相互对立的因素Q通过它门使主体媄响整个构图。例如,恰当地利用对比法则,照片׃h强大的魅力。”?/p>

摄媄家瓦特·德h鲁伊特对摄媄构图作阐q。他认ؓQ“每一U构N是以排列ơ序为基的,像我们从哥士达心理学和信息学原理中所了解到的那样Q构囑֏以用多种Ҏ(gu)获得。它产生于相g物的l合以及对相反事物的。排列次序ƈ不是千篇一律的QŞ态和色彩的疏密和Ҏ(gu)也会产生排列ơ序。排列次序是以一U美学上的均衡ؓ基础的,而均衡则从复杂、矛监֒动态之中造就和谐。?/p>

U条的引g用,所有的U条汇聚C心主?/font>

他说Q“Q何hQ只要懂得把照片分成单个的构图成分,借以得出它在学上的一致性和合理性来审查照片的具体效果,都会成功地创作出好的作品? 

"要获得o人满意的照片构图Q须l常分析照片。?他提出的分析照片构图的最重要标准是: 

1Qh物和环境的关pM及反差情c?2.照片所传递的信息的h(hun)g及类g物?3Q照明和U|?.H出的线条和照片的画q?/p>

对于如何获得较好的摄影构图,格鲁伊特提出了以下重要徏议:

aQ画面所提供的信息不能造成视觉上的混ؕ。?/p>

bQh物和环境的关p要有助于传辄片的意图。?/p>

cQ应当避免由于h物和环境之间的含p关p而可能生的错觉?/p>

dQ明与暗的关pL者彩色对比的关系是非帔R要的。?/p>

eQ除了h物和环境在Ş式上的关pM外,对h物和环境的心理上的权衡也?十分重要的,因ؓ每个视觉印象都立即作出喜Ƣ或不喜Ƣ的判断。无偏好的估h味着Ҏ(gu)没有反应。?/p>

茉莉mm的“光l?/font>

fQ表C我们熟?zhn)的物体相cM的东西,使hҎ(gu)辨认Q从而能比较q速地予以理解。因此,重复内容是必要的?/p>

gQ照片的复杂E度一定不能太?感官刺激不够)Q也不能太高(感官刺激q分) 

hQ每个hҎ(gu)q照片的学评h(hun)L不一LQ而且q种评h(hun)是受感情支配的。它在很大程度上取决于观众的认识Q他的经历和他的敏感性。?/p>

iQŞ式主义和旉风尚是不能持久的。这U缺乏独创性的~点Q是不可能用技术补偿的。?/p>

jQ照明、透视、重叠和q的层ơ变化,有助于在二维I间的^面上体现出明昄U|感?/p>

kQ不d的透视效果Q有助于使照片生动活泹{?/p>

lQ有意识C用突出的方向U和选择适合M的画q,会加强照片的效果?/p>

更多名家名言和作者发表的个h看法Q请讉KQ?/p>



ericli 2006-09-27 13:49 发表评论
]]>
一些摄影方面的术语http://m.tkk7.com/ericli1982/archive/2006/09/25/71751.htmlericliericliMon, 25 Sep 2006 07:00:00 GMThttp://m.tkk7.com/ericli1982/archive/2006/09/25/71751.htmlhttp://m.tkk7.com/ericli1982/comments/71751.htmlhttp://m.tkk7.com/ericli1982/archive/2006/09/25/71751.html#Feedback0http://m.tkk7.com/ericli1982/comments/commentRss/71751.htmlhttp://m.tkk7.com/ericli1982/services/trackbacks/71751.html CCD:
中文译ؓ"?sh)子耦合lg"(charged coupled device)Q它?yu)像传统相机的底片一P是感应光U的?sh)\装置Q可以将它想象成一颗颗微小的感应粒子,铺满在光学镜头后方,当光U与囑փ从镜头透过、投到ccd表面Ӟccd׃产生甉|Q将感应到的内容转换成数码资料储存v来。ccd的尺寸其实是说感光器件的面积大小,ccd像素数目多、单一像素寸大Q捕L光子多Q感光性能好Q信噪比低,攉到的囑փ׃清晰。因此,管ccd数目q不是决定图像品质的唯一重点Q我们仍然可以把它当成相机等U的重要判准之一?

CMOS: 
互补性氧化金属半gCMOSQComplementary Metal-Oxide SemiconductorQ和CCD一样同为在数码相机中可记录光线变化的半g。CMOS的制造技术和一般计机芯片没什么差别,主要是利用硅和锗q两U元素所做成的半gQ其在CMOS上共存着带NQ带–电(sh)Q??PQ带+?sh))U的半导体,q两个互补效应所产生的电(sh)即可被处理芯片U录和解L影像。同PCMOS的尺寸大媄响感光性能的效果,面积大感光性能好。CMOS的缺点就是太Ҏ(gu)出现杂点, q主要是因ؓ早期的设计CMOS在处理快速变化的影像Ӟ׃甉|变化q于频繁而会产生q热的现象?br />光学变焦倍数:光学变焦是依靠光学镜头结构来实现变焦Q变焦方式与35mm相机差不多,是通过摄像头的镜片Ud来放大与~小需要拍摄的景物Q光学变焦倍数大Q能拍摄的景物就远。如今的数码相机的光学变焦倍数大多?倍-5倍之_也有一些码相机拥有10倍的光学变焦效果。而家用摄像机的光学变焦倍数?0?25倍,能比较清楚地拍到70c_的东ѝ?br />
光圈:
光圈英文名称为ApertureQ光圈是一个用来控制光UK过镜头Q进入机w内感光面的光量的装|,也是相机一个极光要的指标参数Q它通常是在镜头内。它的大决定着通过镜头q入感光元g的光U的多少。表辑օ圈大我们是用F倹{光圈F?= 镜头的焦?/ 镜头口径的直径从以上的公式可知要辑ֈ相同的光圈F|长焦距镜头的口径要比短焦距镜头的口径大?br />
    我们qx所说的光圈值F2.8、F8、F16{是光圈“系数”,是相对光圈,q光圈的物理孔径,与光圈的物理孔径及镜头到感光器gQ胶片或CCD或CMOSQ的距离有关?br />
    当光圈物理孔径不变时Q镜头中心与感光器g距离愈远QF数愈,反之Q镜头中心与感光器g距离愈近Q通过光孔到达感光器g的光密度愈高QF数就愈大。完整的光圈值系列如下: F1Q?F1.4Q?F2Q?F2.8Q?F4Q?F5.6Q?F8Q?F11Q?F16Q?F22Q?F32Q?F44Q?F64?br />
噪点:
噪点产生的原因:

1、长旉曝光产生的图像噪?br />
    q种现像主要大部分出现在拍摄夜景Q在囑փ的黑暗的夜空中,出线了一些孤立的亮点。可以说其原因是׃CCD无法处理较慢的快门速度所带来的巨大的工作量,致一些特定的像素失去控制而造成的。ؓ了防止生这U图像噪韻I部分数码相机中配备了被称?降噪"的功能?

    如果使用降噪功能Q在记录囑փ之前׃利用数字处理Ҏ(gu)来消除图像噪韻I因此在保存完毕以前就需要花费一炚w外的旉?br />
2、用JPEG格式对图像压~而生的囑փ噪音

    ׃JPEG格式的图像在~小囑փ寸后图像仍昑־很自Ӟ因此可以利用特D的Ҏ(gu)来减图像数据。此Ӟ它就会以上下左右8×8个像素ؓ一个单位进行处理。因此尤其是?×8个像素边~的位置׃与下一?×8个像素单位发生不自然的结合?

    由JPEG格式压羃而生的囑փ噪音也被UCؓ马赛克噪韻IBlock NoiseQ,压羃率越高,囑փ噪音p明显?

    虽然把图像羃?yu)后q种噪音也会变得看不出来Q但攑֤打印后,一q行色彩补偿p现得非常明显。这U图像噪韛_以通过利用可能高的画质或者利用JPEG格式以外的方法来记录囑փ而得以解冟?br />
3、模p过滤造成的图像噪?br />
    模糊qo造成的图像噪韛_JPEG一P在对囑փq行处理旉成的图像噪韟뀂有时是在数码相机内部处理过E中产生的,有时是利用图像润色Y件进行处理时产生的。对于尺寸较?yu)的囑փQؓ了囑փ昑־更清晰而强调其色彩边缘时就会生图像噪韟?

    所谓的清晰处理是指数码相机具有的囑փ色彩边缘的功能和囑փ~辑软g的“模p过滤(Unsharp MaskQ”功能。在不同Ƒּ的数码相Z也有一些相ZҎ(gu)个图像进行色彩边~的。而处理以后就会在原来的边~外侧出现其他颜色的色线?

   如果图像尺寸羃?yu)以后用于因特网的话Q图像不是总觉得会变得模糊不清吗?此时如果利用“模p过滤”功能对囑փq行清晰处理Q图像看h效果׃好一些。不q由于生了囑փ噪音Q在q行W二ơ或W三ơ处理时Q这U图像噪韛_昑־很麻烦。切忌不要因为处理过度而囑փ昑־q于_糙。?br />
    q里值得一题的是光圈F值愈,在同一单位旉内的q光量便愈多Q而且上一U的q光量刚是下一U的一倍,例如光圈从F8调整到F5.6Q进光量便多一倍,我们也说光圈开大了一U。多数非专业数码相机镜头的焦距短、物理口径很,F8时光圈的物理孔径已经很小了,l箋~小׃发生衍射之类的光学现象,影响成像。所以一般非专业数码相机的最光圈都在F8至F11Q而专业型数码相机感光器g面积大,镜头距感光器件距远Q光圈值可以很。对于消费型数码相机而言Q光圈F值常总于F2.8 - F16。此外许多数码相机在调整光圈Ӟ可以?/3U的调整?


ericli 2006-09-25 15:00 发表评论
]]>
SQL优化原则http://m.tkk7.com/ericli1982/archive/2006/09/13/69459.htmlericliericliWed, 13 Sep 2006 12:25:00 GMThttp://m.tkk7.com/ericli1982/archive/2006/09/13/69459.htmlhttp://m.tkk7.com/ericli1982/comments/69459.htmlhttp://m.tkk7.com/ericli1982/archive/2006/09/13/69459.html#Feedback3http://m.tkk7.com/ericli1982/comments/commentRss/69459.htmlhttp://m.tkk7.com/ericli1982/services/trackbacks/69459.html
 SQL优化原则
 
1、用烦引来更快地遍历表?
~省情况下徏立的索引是非集索引Q但有时它ƈ不是最佳的。在非群集烦引下Q数据在物理上随机存攑֜数据上。合理的索引设计要徏立在
对各U查询的分析和预上。一般来_
a.有大量重复倹{且l常有范围查询( > ,< Q?gt; =,< =Q和order by、group by发生的列Q可?
虑徏立群集烦引;
b.l常同时存取多列Q且每列都含有重复值可考虑建立l合索引Q?
c.l合索引要尽量关键查询形成索引覆盖Q其前导列一定是使用最频繁的列。烦引虽有助于提高性能但不是烦引越多越好,恰好相反q多的烦引会Dpȝ低效。用户在表中每加q一个烦引,l护索引集合p做相应的更新工作?
2、在量查询时尽量少用格式{换?
3、ORDER BY和GROPU BY使用ORDER BY和GROUP BY短语QQ何一U烦引都有助于SELECT的性能提高?
7、Q何对列的操作都将D表扫描,它包括数据库函数、计表辑ּ{等Q查询时要尽可能操作移至等号右辏V?
4、IN、OR子句怼使用工作表,使烦引失效。如果不产生大量重复|可以考虑把子句拆开。拆开的子句中应该包含索引?

Sql的优化原?Q?
1、只要能满你的需求,应尽可能使用更小的数据类型:例如使用MEDIUMINT代替INT
2、尽量把所有的列设|ؓNOT NULLQ如果你要保存NULLQ手动去讄它,而不是把它设为默认倹{?
3、尽量少用VARCHAR、TEXT、BLOBcd
4、如果你的数据只有你所知的量的几个。最好用ENUMcd
5、正如graymice所讲的那样Q徏立烦引?
以下是我做的一个实验,可以发现索引能极大地提高查询的效率:

我有一个会员信息表usersQ里Ҏ(gu)37365条用戯录:

在不加烦引的时候进行查询:
sql语句A:
select * from users where username like ???
在Mysql-Front中的8ơ查询时长ؓQ?.40,0.54,0.54,0.54,0.53,0.55,0.54 共找?60条记?

sql语句B:
select * from users where username like ’许%?
在Mysql-Front中的8ơ查询时长ؓQ?.53,0.53,0.53,0.54,0.53,0.53,0.54,0.54 共找?36条记?

sql语句C:
select * from users where username like ?许?
在Mysql-Front中的8ơ查询时长ؓQ?.51,0.51,0.52,0.52,0.51,0.51,0.52,0.51 共找?条记?

为username列添加烦?
create index usernameindex on users(username(6));

再次查询Q?
sql语句A:
select * from users where username like ???
在Mysql-Front中的8ơ查询时长ؓQ?.35,0.34,0.34,0.35,0.34,0.34,0.35,0.34 共找?60条记?

sql语句B:
select * from users where username like ’许%?
在Mysql-Front中的8ơ查询时长ؓQ?.06,0.07,0.07,0.07,0.07,0.07,0.06,0.06 共找?36条记?

sql语句C:
select * from users where username like ?许?
在Mysql-Front中的8ơ查询时长ؓQ?.32,0.31,0.31,0.32,0.31,0.32,0.31,0.31 共找?条记?

在实验过E中Q我没有另开ME序Q以上的数据说明在单表查询中Q徏立烦引的可以极大地提高查询速度?
另外要说的是如果建立了烦引,对于like ’许%’类型的查询Q速度提升是最明显的。因此,我们在写sql语句的时候也量采用q种方式查询?

对于多表查询我们的优化原则是Q?

量烦引徏立在Qleft join on/right join on ... Q条Ӟ的条件语句中所涉及的字D上?

多表查询比单表查询更能体现烦引的优势?

6、烦引的建立原则Q?
如果一列的中数据的前缀重复值很,我们最好就只烦引这个前~。Mysql支持q种索引。我在上面用到的索引Ҏ(gu)是对username最左边?个字W进行烦引。烦引越短,占用?

盘I间少Q在索过E中q旉也越。这Ҏ(gu)可以Ҏ(gu)多左255个字W进行烦引?

在很多场合,我们可以l徏立多列数据徏立烦引?

索引应该建立在查询条件中q行比较的字D上Q而不是徏立在我们要找出来q且昄的字D上

7、限制烦引的使用的避归?br />7.1  IN、OR子句怼使用工作表,使烦引失效?br />如果不生大量重复|可以考虑把子句拆开。拆开的子句中应该包含索引。这句话怎么理解冻I请D个例?

例子如下:
如果在fields1和fields2上同时徏立了索引Qfields1Z索引
以下sql会用到烦?
select * from tablename1 where fields1=’value1?and fields2=’value2?
以下sql不会用到索引
select * from tablename1 where fields1=’value1?or fields2=’value2?
7.2 使用IS NULL 或IS NOT NULL
         使用IS NULL 或IS NOT NULL同样会限制烦引的使用。因为NULL值ƈ没有被定义。在SQL语句中用NULL会有很多的麻烦。因此徏议开     发h员在Ӟ把需要烦引的列设成NOT NULL。如果被索引的列在某些行中存在NULL|׃会用这个烦引(除非索引是一个位囄引,关于位图索引在稍后在详细讨论Q?/p>

7.3 使用函数
如果不用基于函数的索引Q那么在SQL语句的WHERE子句中对存在索引的列使用函数Ӟ会优化器忽略掉q些索引。下面的查询不会使用索引Q只要它不是Z函数的烦引)
   select empno,ename,deptno
          from   emp
          where  trunc(hiredate)='01-MAY-81';
          把上面的语句Ҏ(gu)下面的语句,q样可以通过索引q行查找?br />          select empno,ename,deptno
          from   emp
          where  hiredate<(to_date('01-MAY-81')+0.9999);

7.4 比较不匹配的数据cd
比较不匹配的数据cd也是比较难于发现的性能问题之一。注意下面查询的例子Qaccount_number是一个VARCHAR2cdQ在account_number字段上有索引。下面的语句执行全表扫描?br />         select bank_name,address,city,state,zip
         from   banks
         where  account_number = 990354;
         Oracle可以自动把where子句变成to_number(account_number)=990354Q这样就限制了烦引的使用,Ҏ(gu)下面的查询就可以使用索引Q?br />         select bank_name,address,city,state,zip
         from   banks
         where  account_number ='990354';
     特别注意Q不匚w的数据类型之间比较会让Oracle自动限制索引的用,即便对这个查询执行Explain Plan也不能让(zhn)明白ؓ什么做了一               ơ“全表扫描”?/p>

补充:
1.索引带来查询上的速度的大大提?但烦引也占用了额外的盘I间(当然现在一般硬盘空间不成问?,而且往表中插入新记录时索引也要随着更新q也需要一定时?
有些表如果经常insert,而较?yu)select,׃用加索引?不然每次写入数据都要重新改写索引,p旉;
q个视实际情况而定,通常情况下烦引是必需?
2.我在Ҏ(gu)询效率有怀疑的时?一般是直接用Mysql的Explain来跟t查询情?
你用Mysql-Front是通过旉来比?我觉得如果从查询时扫描字D늚ơ数来比较更_一?

 

 



ericli 2006-09-13 20:25 发表评论
]]>
取当前日??前3个月的sql记录 怎么?/title><link>http://m.tkk7.com/ericli1982/archive/2006/09/13/69458.html</link><dc:creator>ericli</dc:creator><author>ericli</author><pubDate>Wed, 13 Sep 2006 12:24:00 GMT</pubDate><guid>http://m.tkk7.com/ericli1982/archive/2006/09/13/69458.html</guid><wfw:comment>http://m.tkk7.com/ericli1982/comments/69458.html</wfw:comment><comments>http://m.tkk7.com/ericli1982/archive/2006/09/13/69458.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/ericli1982/comments/commentRss/69458.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/ericli1982/services/trackbacks/69458.html</trackback:ping><description><![CDATA[ <p>select * from t where 日期字段名字>DATEADD ( mm, -3, getdate()) </p> <p>//t 是你的表?/p> <p> </p> <p> </p> <p> <br />现在E序里得到当前时间和3个月前的旉<br />Date nowDate=new Date();<br />Date oldDate=new Date();<br />oldDate.setMonth(oldDate.getMonth()-3);</p> <p>select * from tab where 日期字段>oldDate and 日期字段<newDate</p> <img src ="http://m.tkk7.com/ericli1982/aggbug/69458.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/ericli1982/" target="_blank">ericli</a> 2006-09-13 20:24 <a href="http://m.tkk7.com/ericli1982/archive/2006/09/13/69458.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts初始?/title><link>http://m.tkk7.com/ericli1982/archive/2006/09/13/69457.html</link><dc:creator>ericli</dc:creator><author>ericli</author><pubDate>Wed, 13 Sep 2006 12:24:00 GMT</pubDate><guid>http://m.tkk7.com/ericli1982/archive/2006/09/13/69457.html</guid><wfw:comment>http://m.tkk7.com/ericli1982/comments/69457.html</wfw:comment><comments>http://m.tkk7.com/ericli1982/archive/2006/09/13/69457.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/ericli1982/comments/commentRss/69457.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/ericli1982/services/trackbacks/69457.html</trackback:ping><description><![CDATA[ <p>我在几个月前曄发表q一个帖子,是和大家一起学习struts源代码。成Z名合格的E序员,阅读大量的优UE序是必不可的。只看书是不会让你水qx很大提高的,要多看多写?br />本来是打等下面几篇文章写好后一起发布的Q这样大家可能才能看得明白些Q但是根据我现在的状况,估计q要一、两个月。所以,Z防止在struts源代码发生过大变化后我的文章没有太大h(hun)gQ所以就提前发表了,霍霍~~~<br />我的email为:<a href="mailto:mariah_fan@hotmail.com">mariah_fan@hotmail.com</a>Q有什么不对的地方请大家指正:Q?br />struts作ؓJ2EE的MVC框架已经取得了很大的成功Q下面将分几文章说明struts源程序的l构?br />W一?struts的初始化</p> <p>struts 的核心类是org.apache.struts.action.ActionServletQ这个类会在strutsW一ơ用时Q?br />作ؓservlet初始化ƈ存入tomcat容器。很昄的,初始化将会调用initҎ(gu)初始化相应的数据?/p> <p>一、initInternal()Ҏ(gu)Q?br />    通过调用MessageResources.getMessageResources(internalName)Ҏ(gu)生成一?br />    MessageResourcesc,getMessageResources是通过调用MessageResourcesFactory.<br />    createResources(config)来实现的。至于MessageResourcesFactory是一个abstractc,M<br />    l承自它的类都要实现createResourcesҎ(gu)Q生成MessageResources对象。整个程序生?br />    MessageResourcesFactory使用了如下技巧:<br />    MessageResourcesFactory.factoryClass = factoryClass;<br />    MessageResourcesFactory.clazz = null;<br />    首先会通过factoryClass来定义一个类全名Q然后通过ClassLoader.loadClass<br />    (factoryClass)Ҏ(gu)来生成这个类Qƈ赋给clazzQ然后通过newInstance来生成一个对象?br />    在本E序中,生成MessageResources对象实际是对如下属性进行了初始化:<br />    this.factory = factory;("org.apache.struts.util.PropertyMessageResourcesFactory")<br />    this.config = config;("org.apache.struts.action.ActionResources")<br />    this.returnNull = returnNull;(true/false)</p> <p>    对于MessageResourcescȝ作用是根据不同的Locate来格式化相应的string。或者把你需要改?br />    的string存放到数l中Q然后通过getMessage(Locale locale, String key, Object args[])<br />    Ҏ(gu)来格式化。然后把格式好的string存放到HashMap里,q样可以ؓ以后重用。这里的key?br />    使用的locale.toString() + "." + key</p> <p>    在PropertyMessageResources中的loadLocaleҎ(gu)用来dresource的初始化信息。首先它?br />    通过一个HashMap这个localKey相关的message是否已经被初始化了,如果被初始化q就?br />    出,的Ҏ(gu)是locales.get(localeKey) != null?br />    然后会读取如下一个文Ӟ<br />    org/apache/struts/action/ActionResources_(localKey).propertiesQ然后进行如下操作:<br />    Properties props = new Properties();<br />    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();<br />    is = classLoader.getResourceAsStream(name);<br />    props.load(is);<br />    Iterator names = props.keySet().iterator();<br />        while (names.hasNext()) {<br />            String key = (String) names.next();<br />            if (log.isTraceEnabled()) {<br />                log.trace("  Saving message key '" + messageKey(localeKey, key));<br />            }<br />            messages.put(messageKey(localeKey, key), props.getProperty(key));<br />    }</p> <p>    PropertyMessageResources 是通过上面的loadLocaleҎ(gu)查找与Locale locale, String key<br />    相对对应的Message.查找的次序如下locale.toString()Q然后是<br />    localeKey = localeKey.substring(0, underscore)Q然后是defaultLocaleQ然后是key?/p> <p>    最后,resourcecȝl构如下Q?br />    PropertyMessageResources extends MessageResources<br />    PropertyMessageResourcesFactory extends MessageResourcesFactory</p> <p>二、initOther()Ҏ(gu)Q?br />    从servlet中获取config和debug两个参数Q然后初始化ConvertUtils对象。由?br />    ConvertUtils.deregister()的初始化Q所有的Converter都是有初始值的Q所以这里Struts自己<br />    把这些初始D|ؓnullQ即转换出错的时候返回nullQ而不是初始倹{用ConvertUtilscȝ<br />    原因是由于从form传输q来的都是Stringcd的|所以我们要把它们{换成相应的类型?/p> <p>    提到几个技巧:<br />    *public boolean isIndexed() {<br />         if (type == null) {<br />             return (false);<br />         //技巧一Q判断是否是一个ArraycȝҎ(gu)<br />         } else if (type.isArray()) {<br />             return (true);<br />         //技巧二Q判断type是否是List的一个父cL者父接口Q或者与List为同一个类<br />         //要注意如果List是另一个primitive的TYPEc,那么type必须也是q个cL?br />         //q回trueQ否则都是false。注意long.TYPE与Long.class是不同的<br />         } else if (List.class.isAssignableFrom(type)) {<br />             return (true);<br />         } else {<br />            return (false);<br />         }<br />     }</p> <p>    *//componentType为ArraycL存储的元素的cd <br />     Class componentType = indexedProperty.getClass().getComponentType();<br />     //生成一个新的Array<br />     Object newArray = Array.newInstance(componentType, (index + 1));<br />     System.arraycopy(indexedProperty, 0, newArray, 0, length);<br />     indexedProperty = newArray;<br />     set(name, indexedProperty);<br />     int newLength = Array.getLength(indexedProperty);<br />     for (int i = length; i < newLength; i++) {<br />        Array.set(indexedProperty, i, createProperty(name+"["+i+"]", componentType));<br />     }</p> <p>三、initServlet()Ҏ(gu)Q?br />    q个Ҏ(gu)主要是通过digesterc解析web.xmlQ对String servletMapping属性进行初始化。对?br />    digester说明如下Q这是一个基于DOM的SAX实现的类Q它是事件触发的Q根据xml文g的结构,<br />    每次d一个节点元素就会触发一个事件?/p> <p>    InputStream input = getServletContext().getResourceAsStream("/WEB-INF/web.xml");<br />    q是一个比较少见的Ҏ(gu)。首先通过this.servletName = getServletConfig().<br />    getServletName()获取servlet的名Uͼ然后Ҏ(gu)<br />    if (servletName.equals(this.servletName)) {<br />        this.servletMapping = urlPattern;<br />    }<br />    来判断当前读到的servlet名称是否是我们运行的servlet的名Uͼ如果是,把url-pattern作ؓ<br />    我们的servletMapping?/p> <p>四、getServletContext().setAttribute(Globals.ACTION_SERVLET_KEY, this)<br />    把自己存储到servletContext中,属性名为Globals.ACTION_SERVLET_KEY?/p> <p>五、ModuleConfig moduleConfig = initModuleConfig("", config)<br />    q个Ҏ(gu)使用由initOther()Ҏ(gu)获取的configgؓ要解析的xml路径Q用来初始化ModuleConfig?br />    它首先采用与生成MessageResourcesFactory同样的方法生一个MessageResourcesFactory对象Q?br />    MessageResourcesFactoryZ个抽象类Q每一个承它的类都要实现<br />    createModuleConfig(String prefix)Ҏ(gu)。本E序使用的缺省的MessageResourcesFactorycMؓ<br />    org.apache.struts.config.impl.DefaultModuleConfigFactoryQ它<br />    的createModuleConfig(String prefix)Ҏ(gu)会生成一个ModuleConfigImplcR?/p> <p>    ModuleConfigImplcȝ当于一个JavaBeanQ用来存放一个web模块q行时所需要的配置信息。当<br />    Ӟ一个web模块可以拥有多个ModuleConfigQ但是缺省的是prefix长度?的ModuleConifg。它<br />    的每个属性几乎都是由HashMapl成的,它通过一个configured布尔值来描述当前的ModuleConfig<br />    是否已经被初始化完毕Q在每存放一个属性的时候都会监这个倹{如果初始化完毕而还要改?br />    里面的属性|则会报出IllegalStateException("Configuration is frozen")异常Q现在对?br />    的属性简单说明如下:<br />    * protected HashMap actionConfigsQ?br />      q个HashMap用来存储ActionConfig对象?br />    * protected HashMap dataSources<br />      q个HashMap用来存储DataSourceConfig对象?br />    * protected HashMap exceptions<br />      q个HashMap用来存储ExceptionConfig对象?br />    * protected HashMap formBeans<br />      q个HashMap用来存储FormBeanConfig对象?br />    * protected HashMap forwards<br />      q个HashMap用来存储ForwardConfig对象?br />    * protected HashMap messageResources<br />      q个HashMap用来存储MessageResourcesConfig对象?br />    * protected ArrayList plugIns<br />      q个HashMap用来存储PlugInConfig对象?br />    * protected ControllerConfig controllerConfig<br />      ControllerConfigc?br />    * protected boolean configured<br />      标志q个ModuleConfig?true)?false)配置完成?br />    * protected String prefix<br />      用来标志和区分ModuleConfigc,同时在用上面的configcd始化相应的资源以后,也是?br />      q这个prefix来区分所属的不同的web模块?br />    * protected String actionMappingClass = "org.apache.struts.action.ActionMapping"<br />      ActionMappingcdQ缺省ؓorg.apache.struts.action.ActionMapping?/p> <p>    初始化ModuleConfig的方法如下:<br />    首先是用getServletConfig().getInitParameter("mapping")来获取设定的ActionMappingc?br />    名,然后通过initConfigDigester()Ҏ(gu)来生成一个digester。最后用","分隔configQ对每一<br />    块调用parseModuleConfigFile(prefix, paths, config, digester, path)Ҏ(gu)解析。注意,q?br />    个方法实际上只有两个参数是有意义的:path为我们要解析的xml文gQconfig用来初始化完?br />    后保存到servletContext中?/p> <p>    如果ModuleConfig中存攄FormBeanConfig为DydamiccdQ那么就调用<br />    DynaActionFormClass.createDynaActionFormClass(FormBeanConfig)初始?br />    DynaActionFormClassQƈ存放到DynaActionFormClass.dynaClasses ?static HashMap中。这<br />    里的key为FormBeanConfig.getName() + moduleConfig.getPrefix()?br />    <br />    如果当前的ModuleConfig为缺省的ModuleConfigQ那么将会调用如下几个方法:<br />    defaultControllerConfig(config)<br />    defaultMessageResourcesConfig(config)<br />    defaultFormBeansConfig(config)<br />    defaultForwardsConfig(config)<br />    defaultMappingsConfig(config)<br />    在struts1.1以后Q这个特例将会被废弃Q?/p> <p>    defaultControllerConfig(config)为ControllerConfig通过getInitParameter(s)Ҏ(gu)初始化如<br />    下几个属性:bufferSizeQcontentQlocale(true/false)QmaxFileSizeQnocache(true/false)<br />    QmultipartClassQtempDir?/p> <p>    defaultMessageResourcesConfig(config)为MessageResourcesConfig通过getInitParameter(s)<br />    Ҏ(gu)初始化如下几个属性:applicationQfactoryQnull(true/false)?/p> <p>    其它的几个方法就是获取不同的对象Q然后把它们相应的存储到servlet中。关心如下:<br />    ActionFormBeans=>FormBeanConfigQActionForwards=>ForwardConfigQ?br />    ActionMappings=>ActionConfig?/p> <p>六、initModuleMessageResources(ModuleConfig config)<br />    通过存储在ModuleConfig中的MessageResourcesConfig对象Q逐个初始化MessageResourceQ?br />    然后再把初始化好的MessageResources存放到ServletContext中,attributeName?br />    MessageResourcesConfig.getKey() + ModuleConfig.getPrefix()?/p> <p>七、initModuleDataSources(ModuleConfig config)<br />    通过存储在ModuleConfig中的DataSourceConfig对象Q逐个初始化DataSource。然后对于每一?br />    DateSource通过BeanUtils.populate(ds, dscs[i].getProperties())Ҏ(gu)初始化其属性。再把初<br />    始化好的DateSource存放到ServletContext中,attributeName?br />    DataSourceConfig.getKey() + ModuleConfig.getPrefix()。同时也存放到名位dataSources?br />    FastHashMap中,key为DataSourceConfig.getKey()?/p> <p>    q里q会Ҏ(gu)生成的DateSource对象是否是GenericDataSourcecdQ如果是则调?br />    GenericDataSource.open()Ҏ(gu)。GenericDataSource是一个非常简单的数据库连接池Q它?br />    open()Ҏ(gu)用来初始化连接池Q生成最数目的GenericConnectionQ这里的open()Ҏ(gu)Ҏ(gu)<br />    String driver变量是否为null来判断是否已l被初始化过。需要仔l说明的是getConnection()<br />    Ҏ(gu)Q它首先从连接池中取出GenericConnection对象Q然后检查其是否是可链接的,如果是就<br />    q回Q否则l取出,同时activeCount-1。如果没有取刎ͼ则会查当前可使用?br />    GenericConnection是否辑ֈ最大?activeCount < maxCount)Q如果没有,调用<br />    createConnection()Ҏ(gu)声成一个新的GenericConnectionQ然后检查其是否是可链接Q如果可?br />    则返回。returnConnection(GenericConnection conn)Ҏ(gu)则是通过把GenericConnection攑֛?br />    q接池,然后activeCount-1?/p> <p>    q个Ҏ(gu)中用到了ServletContextWriterc,DateSource的log信息通过q个cd入。对q个<br />    c说明如下:<br />    它承自PrintWriterQ而PrintWriter又承自Writer。WritercL作的事情是在同步的情况?br />    调用abstractҎ(gu)Qabstract public void write(char cbuf[], int off, int len)Q这个方?br />    会Ҏ(gu)调用者的需要由调用者实现?br />    PrintWriter则首先通过ensureOpen()Ҏ(gu)验这个类中是否有写入的对?WritercL其子c?Q?br />    如果有则Ҏ(gu)不同的情况调用这个写入对象的writeҎ(gu)(out.write(....))。这个类的print(...)<br />    Ҏ(gu)是据不同的情况调用相应的write(...)Ҏ(gu)。而println(...)与之的区别就是每ơ多写入一<br />    个换行字W串。还有一个区别是println(...)会根据是否需要autoflushq行flushQ而write(...)<br />    Ҏ(gu)不会?br />    ServletContextWritercȝ作用是把字符写入ServletContext中。ServletContextWritercL法中<br />    真正实现了writeҎ(gu)Q?br />    public void write(char c) {<br />        if (c == '\n')<br />            flush();<br />        else if (c != '\r')<br />            buffer.append(c);<br />    }<br />    public void flush() {<br />        if (buffer.length() > 0) {<br />            context.log(buffer.toString());<br />            buffer.setLength(0);<br />        }<br />    }</p> <p>八、initModulePlugIns(moduleConfig)<br />    通过存储在ModuleConfig中的PlugInConfig对象Q逐个初始化PlugIn对象Q存攑ֈ一个数l中Q?br />    然后再把q个数组存放到ServletContext中,attributeName?br />    Globals.PLUG_INS_KEY + ModuleConfig.getPrefix()?/p> <p>    Ҏ(gu)一个生成的PlugIn对象通过<br />    BeanUtils.populate(plugIns[i], plugInConfigs[i].getProperties())Ҏ(gu)初始化其属性。然?br />    再把PlugInConfig对象存放到由其生成的PlugIn对象中?/p> <p>    最后,通过plugIns[i].init(this, (ModuleConfig) config)初始化这个plugIn对象?/p> <p>?ji)、初始化l束<br />    完成了这个初始化以后Q会调用ModuleConfig.freeze()令这个ModuleConfig变得不可改变。然?br />    会遍历ServletConfig中的initParameterNamesQ如果有?config/"开头的Q则通过q个parameter<br />    的值l初始化其它的ModuleConfigQ且q个ModuleConfig的prefix?config/"后的字符丌Ӏ?br />    <br />    同样调用如下Ҏ(gu)Q?br />    initModuleMessageResources(moduleConfig);<br />    initModuleDataSources(moduleConfig);<br />    initModulePlugIns(moduleConfig);<br />    moduleConfig.freeze();</p> <p>    最后调用destroyConfigDigester()释放内存?/p> <img src ="http://m.tkk7.com/ericli1982/aggbug/69457.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/ericli1982/" target="_blank">ericli</a> 2006-09-13 20:24 <a href="http://m.tkk7.com/ericli1982/archive/2006/09/13/69457.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts1.1源码解析http://m.tkk7.com/ericli1982/archive/2006/09/13/69455.htmlericliericliWed, 13 Sep 2006 12:23:00 GMThttp://m.tkk7.com/ericli1982/archive/2006/09/13/69455.htmlhttp://m.tkk7.com/ericli1982/comments/69455.htmlhttp://m.tkk7.com/ericli1982/archive/2006/09/13/69455.html#Feedback0http://m.tkk7.com/ericli1982/comments/commentRss/69455.htmlhttp://m.tkk7.com/ericli1982/services/trackbacks/69455.htmlStruts1.1b3部分源代码分?
作者:     文章来源Q?br />讉Kơ数Q?ơ  ?加入旉Q?006-05-12
 
Struts1.1部分源代码分?br />一Q说?br />本文针对Struts1.1b3做分析,主要希望通过Ҏ(gu)代码的分析阐qStruts1.1的工作方式?br />本文不适合初学者参考,适合h一定基于Struts开发的E序员参考?br />下面的描qͼ里面会对ActionServlet,RequestProcessor,ModuleConfig{几个类做一?br />说明。以注释源代码的方式Q说明取工作程?br />特别xQStruts1.1代码版权属于Apache遵@The Apache Software License, Version 1.1.
本文版权属于孤魂一W个人所有,M个h或组l希望{载,请与我联pRƈ获得我的授权
方可转蝲?/p>

二:ActionServlet分析
我们先来看一下用Struts的配|文件?/p>


action
org.apache.struts.action.ActionServlet


definitions-config
/WEB-INF/tiles-defs.xml,/WEB-INF/tiles-tests-defs.xml,/WEB-INF/tiles-tutorial-defs.xml,
/WEB-INF/tiles-examples-defs.xml


definitions-debug
0


definitions-parser-details
0


definitions-parser-validate
true

 

config
/WEB-INF/struts-config.xml

 

config/examples
/WEB-INF/struts-examples-config.xml

 

config/test
/WEB-INF/struts-tests-config.xml

 

config/tutorial
/WEB-INF/struts-tutorial-config.xml


validate
true


debug
2


detail
2

 

application
org.apache.struts.webapp.tiles.dev1-1.ApplicationResources


2

 


action
*.do

 

接下来我们来看一下ActionServlet的具体?br />javax.servlet.http.HttpServlet
|
|-->org.apache.struts.action.ActionServlet
所以本质上ActionServlet是一个普通的servletQ负责处?do为后~的Httph.
servlet在执行doGet(),doPost(),之前先调用init(),
以下我们先分析一下init()Ҏ(gu)
/**
* Initialize this servlet. Most of the processing has been factored into
* support methods so that you can override particular functionality at a
* fairly granular level.

* servlet初始化操?注意初始化顺?br />* @exception ServletException if we cannot configure ourselves correctly
*/
public void init() throws ServletException {
//注意初始化的序
//Initialize our internal MessageResources bundle
initInternal();
//Initialize other global characteristics of the controller servlet
//处理一些全局变量的设|如QdebugQdetail{?br />initOther();
//Initialize the servlet mapping under which our controller servlet
//is being accessed. This will be used in the &html:form>
//tag to generate correct destination URLs for form submissions
//主要是注册DTD文g以及解析web.xml关于ActionServlet的配|。如后缀名等.
// Configure the processing rules that we need
// digester.addCallMethod("web-app/servlet-mapping",
// "addServletMapping", 2);
// digester.addCallParam("web-app/servlet-mapping/servlet-name", 0);
// digester.addCallParam("web-app/servlet-mapping/url-pattern", 1);
//initServlet()的上面一D将把Struts默认的后~名从web.xml中解析得?br />//也就是web.xml中的如下配置Q?br />//
//action
//*.do
//默认?dol尾的请求都由Struts来处理,你可以自׃?br />//
initServlet();

// Initialize modules as needed
//在Attribute中保存类实例
getServletContext().setAttribute(Globals.ACTION_SERVLET_KEY, this);
//Ҏ(gu)配置文g生成ModuleConfig,q是很重要的一?下面会专门分?br />//在tiles的配|中先解析注释ؓ"Mark 0"的一个配|文?/WEB-INF/struts-config.xml
//使用initModuleConfigҎ(gu)解析XML文g.
//参数为prefixQ?",paths:"/WEB-INF/struts-config.xml"
ModuleConfig moduleConfig = initModuleConfig("", config);
//初始化Message
initModuleMessageResources(moduleConfig);
//初始化JDBC DataSource
initModuleDataSources(moduleConfig);
//初始化PlunIn
initModulePlugIns(moduleConfig);

moduleConfig.freeze();
//在Struts1.1以后可以使用多个配置文g,在解析完默认的配|文件也是上面提到?br />//注释?Mark 0"的一个配|文?/WEB-INF/struts-config.xml后解析其他的配置文g
Enumeration names = getServletConfig().getInitParameterNames();
//依次解析注释?Mark 1"?Mark 2"?Mark 3"对应配置文g
while (names.hasMoreElements()) {
//每一个配|文件的文g?br />String name = (String) names.nextElement();
if (!name.startsWith("config/")) {
continue;
}
//
String prefix = name.substring(6);
moduleConfig = initModuleConfig
(prefix, getServletConfig().getInitParameter(name));

initModuleMessageResources(moduleConfig);
initModuleDataSources(moduleConfig);
initModulePlugIns(moduleConfig);
moduleConfig.freeze();
}
destroyConfigDigester();

}
/**
* 此方法用Digester解析XML,关于使用Digester的介l参看我的另外一文?br />*
Initialize the application configuration information for the
* specified module.


*
* @param prefix Module prefix for this module
* @param paths Comma-separated list of context-relative resource path(s)
* for this modules's configuration resource(s)
*
* @exception ServletException if initialization cannot be performed
* @since Struts 1.1
*/
protected ModuleConfig initModuleConfig
(String prefix, String paths) throws ServletException {

if (log.isDebugEnabled()) {
log.debug("Initializing module path '" + prefix +
"' configuration from '" + paths + "'");
}

// Parse the configuration for this module
ModuleConfig config = null;
InputStream input = null;
String mapping = null;
try {
//工厂Ҏ(gu)创徏ModuleConfig标记为:prefix
ModuleConfigFactory factoryObject =
ModuleConfigFactory.createFactory();
config = factoryObject.createModuleConfig(prefix);

// Support for module-wide ActionMapping type override
mapping = getServletConfig().getInitParameter("mapping");
if (mapping != null) {
config.setActionMappingClass(mapping);
}

// Configure the Digester instance we will use
//得到解析XML的digester
Digester digester = initConfigDigester();

// Process each specified resource path
while (paths.length() > 0) {
//开始解析指定\径文件名的文?br />digester.push(config);
String path = null;
//文g是否为多个ƈ且?,"分割
int comma = paths.indexOf(',');
//存在多个配置文g
if (comma >= 0) {
//先解析第一?br />path = paths.substring(0, comma).trim();
//paths存放剩余的文件名下次再处?br />paths = paths.substring(comma + 1);
} else {
//当前只存在一?br />path = paths.trim();
//没有剩余,下次循环Ҏ(gu)上面一句将会在唯一的@环退出点"point break"
//退出@?br />paths = "";
}
//全部解析完成跛_循环
//point break
if (path.length() < 1) {
break;
}
//Ҏ(gu)文g名取文g
URL url = getServletContext().getResource(path);
InputSource is = new InputSource(url.toExternalForm());
input = getServletContext().getResourceAsStream(path);
is.setByteStream(input);
digester.parse(is);
//全局变量的Ş式把解析生成的ModuleConfig实例保存h
//?Mark 1"处标记的"config/examples",
//key为:"org.apache.struts.action.MODULEexamples"
//Globals.MODULE_KEYgؓ:org.apache.struts.action.MODULE
getServletContext().setAttribute
(Globals.MODULE_KEY + prefix, config);
input.close();
}

} catch (Throwable t) {
log.error(internal.getMessage("configParse", paths), t);
throw new UnavailableException
(internal.getMessage("configParse", paths));
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
;
}
}
}

// Force creation and registration of DynaActionFormClass instances
// for all dynamic form beans we wil be using
//Ҏ(gu)ModuleConfig实例得到配置的FormBean的配|?br />//注意Q因为在Struts整个q行当中FormBean的实例要在Action的实例创Z前先创徏
//因ؓAction执行perform(1.1以前)QexecuteQ?.1Q需要用到FormBean
FormBeanConfig fbs[] = config.findFormBeanConfigs();
for (int i = 0; i < fbs.length; i++) {
if (fbs[i].getDynamic()) {
DynaActionFormClass.createDynaActionFormClass(fbs[i]);
}
}

// Special handling for the default module (for
// backwards compatibility only, will be removed later)
//下面是生成一些实?br />if (prefix.length() < 1) {
defaultControllerConfig(config);
defaultMessageResourcesConfig(config);
defaultFormBeansConfig(config);
defaultForwardsConfig(config);
defaultMappingsConfig(config);
}

// Return the completed configuration object
//config.freeze(); // Now done after plugins init
return (config);

}

到此初始化工作基本结束,下面处理具体的Httph。在Servlet协议中所有的postҎ(gu)调?br />以下Ҏ(gu)来处?br />public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {}
getҎ(gu)也调用类似的Ҏ(gu)来处?

在Struts中post,getҎ(gu)都调用同一个方?br />process(request, response);来处理具体的h
如下Q?br />/**
* Ҏ(gu)一个提交过来的Actionq行处理
* Perform the standard request processing for this request, and create
* the corresponding response.
*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception is thrown
*/
protected void process(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
//讄或删除Attribute
RequestUtils.selectModule(request, getServletContext());
//具体的处理交lRequestProcessord理HttpRequest,HttpResponse
//q是一个很典型的设计模?br />//下面我们详l来分析RequestProcessorQ很Ҏ(gu)理解Struts的运行方?br />getRequestProcessor(getModuleConfig(request)).process(request, response);
}

?RequestProcessor分析
通过前面的分析我们知道Struts中对HttpRequest,HttpResponse的处理都交给RequestProcessor
的processQ)Ҏ(gu)来处理。下面我们来看看processҎ(gu)
/**
*
Process an HttpServletRequest and create the
* corresponding HttpServletResponse.


*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a processing exception occurs
*/
public void process(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {

// Wrap multipart requests with a special wrapper
//如果是upload,q回一个MultipartRequestWrapper()
request = processMultipart(request);

// Identify the path component we will use to select a mapping
//对requestq行分析得到提交q来的Form Action
String path = processPath(request, response);
if (path == null) {
return;
}
if (log.isInfoEnabled()) {
log.info("Processing a '" + request.getMethod() +
"' for path '" + path + "'");
}

// Select a Locale for the current user if requested
//本地化处?br />processLocale(request, response);

// Set the content type and no-caching headers if requested
processContent(request, response);
//讄Cache不保?br />processNoCache(request, response);

// General purpose preprocessing hook
if (!processPreprocess(request, response)) {
return;
}

// Identify the mapping for this request
//得到path以后Q根据配|文?struts-config.xml)的相关配|来得到一?br />//ActionMapping的实?br />//ActionMappingl承ActionConfig
//仔细看一下ActionMapping的代码就能发玎ͼ
//下面的一D将解析影射一个ActionMapping的实?br />//在ActionServlet在初始化的时候实际上已经把所有的ActionMapping的实?br />//都已l创建好了。processMappingҎ(gu)实际上是从Attribute中去得到已经
//保存好的ActionMapping的实例,可以理解为在Tomcat启动的时候已l?br />//把所有的ActionMapping保存在Attribute里面。所以在Tomcat启动的时?br />//比较慢,如果Struts-config.xml有问题启动就会出错?br />/***

type="org.apache.struts.webapp.tiles.test.TestActionTileAction">

 

**/
//****注意得到创徏实例的顺?br />//ActionMapping实例已经创徏好了Q现在从Atribute中取?br />ActionMapping mapping = processMapping(request, response, path);
if (mapping == null) {
return;
}

// Check for any role required to perform this action
if (!processRoles(request, response, mapping)) {
return;
}

// Process any ActionForm bean related to this request
//Ҏ(gu)mapping得到ActionForm的实例?br />//同名ActionForm在系l中只会创徏一ơ?br />ActionForm form = processActionForm(request, response, mapping);
//压栈
processPopulate(request, response, form, mapping);
//处理校验,调用ActionForm的validateҎ(gu)
//假如出错会q回到前一面
//也就是说在Actionq没有创Z前就做校验
if (!processValidate(request, response, form, mapping)) {
return;
}

// Process a forward or include specified by this mapping
if (!processForward(request, response, mapping)) {
return;
}
if (!processInclude(request, response, mapping)) {
return;
}

// Create or acquire the Action instance to process this request
//在得到ActionMapping、ActionForm的实例后接下来得到Action实例
//实例如果已经创徏从Map里面d如果没有创徏一个ƈ保存在Map里面
//对保存Action实例的Map 实现U程同步
Action action = processActionCreate(request, response, mapping);
if (action == null) {
return;
}

// Call the Action instance itself
//在ActionMapping、ActionForm、Action实例创徏好以?br />//调用Action的execute()Ҏ(gu)得到一个ActionForward
//因ؓ所有的可执行Action都必Loverride Action的execute()/perform()Ҏ(gu)
ActionForward forward =
processActionPerform(request, response,
action, form, mapping);

// Process the returned ActionForward instance
//Action已经正常执行Q执行结束后返回到另外一个页?br />processActionForward(request, response, forward);

}

仔细阅读上面的代码,要特别注意ActionMapping、ActionForm、Action的实例是依次创徏的?br />创徏完以后才L行Action的execute()Ҏ(gu)。ؓ什么要依次创徏ActionMapping、ActionForm
、Action??????


?ModuleConfig分析
现在我们很有必要了解一下ModuleConfigq个c,因ؓ太多地方用到了?br />实际上ModuleConfig是一个接口有一个实现。org.apache.struts.config.impl.ModuleConfigImpl
具体实现我就没有不要d析了。我们来看看q个接口?/p>

package org.apache.struts.config;

/**
*
The collection of static configuration information that describes a
* Struts-based module. Multiple modules are identified by
* a prefix at the beginning of the context
* relative portion of the request URI. If no module prefix can be
* matched, the default configuration (with a prefix equal to a zero-length
* string) is selected, which is elegantly backwards compatible with the
* previous Struts behavior that only supported one module.


*
* @author Rob Leland
* @version $Revision: 1.2 $ $Date: 2002/12/22 05:31:14 $
* @since Struts 1.1
*/
public interface ModuleConfig {
/**
* Has this module been completely configured yet. Once this flag
* has been set, any attempt to modify the configuration will return an
* IllegalStateException.
*/
boolean getConfigured();

/**
* The controller configuration object for this module.
*/
ControllerConfig getControllerConfig();
/**
* The controller configuration object for this module.
* @param cc The controller configuration object for this module.
*/

void setControllerConfig(ControllerConfig cc);

/**
* The prefix of the context-relative portion of the request URI, used to
* select this configuration versus others supported by the controller
* servlet. A configuration with a prefix of a zero-length String is the
* default configuration for this web module.
*/
String getPrefix();

/**
* The prefix of the context-relative portion of the request URI, used to
* select this configuration versus others supported by the controller
* servlet. A configuration with a prefix of a zero-length String is the
* default configuration for this web module.
*/
public void setPrefix(String prefix);
/**
* The default class name to be used when creating action mapping
* instances.
*/
String getActionMappingClass();
/**
* The default class name to be used when creating action mapping
* instances.
* @param actionMappingClass default class name to be used when creating action mapping
* instances.
*/

void setActionMappingClass(String actionMappingClass);

/**
* Add a new ActionConfig instance to the set associated
* with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addActionConfig(ActionConfig config);

/**
* Add a new DataSourceConfig instance to the set associated
* with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addDataSourceConfig(DataSourceConfig config);

/**
* Add a new ExceptionConfig instance to the set associated
* with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addExceptionConfig(ExceptionConfig config);

/**
* Add a new FormBeanConfig instance to the set associated
* with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addFormBeanConfig(FormBeanConfig config);

/**
* Add a new ForwardConfig instance to the set of global
* forwards associated with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addForwardConfig(ForwardConfig config);

/**
* Add a new MessageResourcesConfig instance to the set
* associated with this module.
*
* @param config The new configuration instance to be added
*
* @exception IllegalStateException if this module configuration
* has been frozen
*/
void addMessageResourcesConfig(MessageResourcesConfig config);

/**
* Add a newly configured {@link org.apache.struts.config.PlugInConfig} instance to the set of
* plug-in Actions for this module.
*
* @param plugInConfig The new configuration instance to be added
*/
void addPlugInConfig(PlugInConfig plugInConfig);

/**
* Return the action configuration for the specified path, if any;
* otherwise return null.
*
* @param path Path of the action configuration to return
*/
ActionConfig findActionConfig(String path);

/**
* Return the action configurations for this module. If there are
* none, a zero-length array is returned.
*/
ActionConfig[] findActionConfigs();

/**
* Return the data source configuration for the specified key, if any;
* otherwise return null.
*
* @param key Key of the data source configuration to return
*/
DataSourceConfig findDataSourceConfig(String key);

/**
* Return the data source configurations for this module. If there
* are none, a zero-length array is returned.
*/
DataSourceConfig[] findDataSourceConfigs();

/**
* Return the exception configuration for the specified type, if any;
* otherwise return null.
*
* @param type Exception class name to find a configuration for
*/
ExceptionConfig findExceptionConfig(String type);

/**
* Return the exception configurations for this module. If there
* are none, a zero-length array is returned.
*/
ExceptionConfig[] findExceptionConfigs();

/**
* Return the form bean configuration for the specified key, if any;
* otherwise return null.
*
* @param name Name of the form bean configuration to return
*/
FormBeanConfig findFormBeanConfig(String name);

/**
* Return the form bean configurations for this module. If there
* are none, a zero-length array is returned.
*/
FormBeanConfig[] findFormBeanConfigs();

/**
* Return the forward configuration for the specified key, if any;
* otherwise return null.
*
* @param name Name of the forward configuration to return
*/
ForwardConfig findForwardConfig(String name);

/**
* Return the form bean configurations for this module. If there
* are none, a zero-length array is returned.
*/
ForwardConfig[] findForwardConfigs();

/**
* Return the message resources configuration for the specified key,
* if any; otherwise return null.
*
* @param key Key of the data source configuration to return
*/
MessageResourcesConfig findMessageResourcesConfig(String key);

/**
* Return the message resources configurations for this module.
* If there are none, a zero-length array is returned.
*/
MessageResourcesConfig[] findMessageResourcesConfigs();

/**
* Return the configured plug-in actions for this module. If there
* are none, a zero-length array is returned.
*/
PlugInConfig[] findPlugInConfigs();

/**
* Freeze the configuration of this module. After this method
* returns, any attempt to modify the configuration will return
* an IllegalStateException.
*/
void freeze();

/**
* Remove the specified action configuration instance.
*
* @param config ActionConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeActionConfig(ActionConfig config);

/**
* Remove the specified exception configuration instance.
*
* @param config ActionConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeExceptionConfig(ExceptionConfig config);

/**
* Remove the specified data source configuration instance.
*
* @param config DataSourceConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeDataSourceConfig(DataSourceConfig config);

/**
* Remove the specified form bean configuration instance.
*
* @param config FormBeanConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeFormBeanConfig(FormBeanConfig config);

/**
* Remove the specified forward configuration instance.
*
* @param config ForwardConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeForwardConfig(ForwardConfig config);

/**
* Remove the specified message resources configuration instance.
*
* @param config MessageResourcesConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeMessageResourcesConfig(MessageResourcesConfig config);
}


上面的注释已l非常清C。我׃L费大家的旉了,再想仔细看就ȝ他的实现?br />其实主要是对HashMap()的处理?/p>

五:ActionMapping分析
最后我们实现很有必要看一下ActionMapping,因ؓ你如果想清楚的了解Struts-config.xml
q个配置文g的作用,你应该要知道ActionMapping
前面已经说过ActionMappingl承ActionConfig
以下是ActionMapping加的四个Ҏ(gu)?br />/**
*
Find and return the ExceptionConfig instance defining
* how exceptions of the specified type should be handled. This is
* performed by checking local and then global configurations for the
* specified exception's class, and then looking up the superclass chain
* (again checking local and then global configurations). If no handler
* configuration can be found, return null.


*
* @param type Exception class for which to find a handler
* @since Struts 1.1
*/
public ExceptionConfig findException(Class type) {

}


/**
*
Find and return the ForwardConfig instance defining
* how forwarding to the specified logical name should be handled. This is
* performed by checking local and then global configurations for the
* specified forwarding configuration. If no forwarding configuration
* can be found, return null.


*
* @param name Logical name of the forwarding instance to be returned
*/
public ActionForward findForward(String name) {

}


/**
*
Return the logical names of all locally defined forwards for this
* mapping. If there are no such forwards, a zero-length array
* is returned.
*/
public String[] findForwards() {
}


/**
*

Create (if necessary) and return an {@link ActionForward} that
* corresponds to the input property of this Action.
*
* @since Struts 1.1b2
*/
public ActionForward getInputForward() {

}

q是看以下他的基cActionConfig?br />public class ActionConfig implements Serializable {

/**
* Has configuration of this component been completed?
*/
protected boolean configured = false;

/**
* The set of exception handling configurations for this
* action, if any, keyed by the type property.
*/
protected HashMap exceptions = new HashMap();

/**
* The set of local forward configurations for this action, if any,
* keyed by the name property.
*/
protected HashMap forwards = new HashMap();

/**
* The module configuration with which we are associated.
*/
protected ModuleConfig moduleConfig = null;

/**
* The request-scope or session-scope attribute name under which our
* form bean is accessed, if it is different from the form bean's
* specified name.
*/
protected String attribute = null;

/**
* Context-relative path of the web application resource that will process
* this request via RequestDispatcher.forward(), instead of instantiating
* and calling the Action class specified by "type".
* Exactly one of forward, include, or
* type must be specified.
*/
protected String forward = null;

/**
* Context-relative path of the web application resource that will process
* this request via RequestDispatcher.include(), instead of instantiating
* and calling the Action class specified by "type".
* Exactly one of forward, include, or
* type must be specified.
*/
protected String include = null;

/**
* Context-relative path of the input form to which control should be
* returned if a validation error is encountered. Required if "name"
* is specified and the input bean returns validation errors.
*/
protected String input = null;

/**
* Fully qualified Java class name of the
* MultipartRequestHandler implementation class used to
* process multi-part request data for this Action.
*/
protected String multipartClass = null;

/**
* Name of the form bean, if any, associated with this Action.
*/
protected String name = null;

/**
* General purpose configuration parameter that can be used to pass
* extra iunformation to the Action instance selected by this Action.
* Struts does not itself use this value in any way.
*/
protected String parameter = null;

/**
* Context-relative path of the submitted request, starting with a
* slash ("/") character, and omitting any filename extension if
* extension mapping is being used.
*/
protected String path = null;

/**
* Prefix used to match request parameter names to form ben property
* names, if any.
*/
protected String prefix = null;

/**
* Comma-delimited list of security role names allowed to request
* this Action.
*/
protected String roles = null;

/**
* Identifier of the scope ("request" or "session") within which
* our form bean is accessed, if any.
*/
protected String scope = "session";

/**
* Suffix used to match request parameter names to form bean property
* names, if any.
*/
protected String suffix = null;

/**
* Fully qualified Java class name of the Action class
* to be used to process requests for this mapping if the
* forward and include properties are not set.
* Exactly one of forward, include, or
* type must be specified.
*/
protected String type = null;

/**
* Should the validate() method of the form bean associated
* with this action be called?
*/
protected boolean validate = true;
}

其实ActionConfig是一个很典型的ValueObject.所以其他的get/setҎ(gu)我就不写出来了?br />看这个代码一定要和struts-config.xml一h看,Ҏ(gu)struts-config.xmlL?br />每一D配|文件最l要生成一个ActionConfig,他们之间的对应关pR?br />如果你想扩展Struts,ActionMapping估计你一定要修改。还有ActionServlet你也要修攏V?/p>

六:l束?br />分析了一些代码下面做一些概q。先来整体的了解一下Struts的工作流E?
在实C个基于Struts的运用之前我们首先是做环境设|,Struts正常工作需要至两?br />配置文gweb.xml,struts-config.xml.
web.xml告诉App Server所有以.dol尾的请求最l提交给ActionServletd理?br />2p定ActionServlet是在App Server启动的时?br />创徏的ƈ且一直存在?br />ActionServlet在创建的时候会做如下的工作Q?br />保存一些后面需要用的实例在Attribute(内存)里面?br />Ҏ(gu)web.xml的配|解析struts-config.xml文g?br />Ҏ(gu)struts-config.xml的配|生成ActionMapping实例q且保存?/p>

ActionServlet在生命周期就一直等待Http h
每一?dol尾的Http h都由ActionServlet先截L后根据请求\径得到具体调用那
一个Actiond理,在这之前生成、处理ActionForm。具体知道那一个Actiond理请?br />后调用Action的execute()/perform()处理完成Q返回?/p>


 



ericli 2006-09-13 20:23 发表评论
]]>
Toad中出现问?/title><link>http://m.tkk7.com/ericli1982/archive/2006/09/13/69454.html</link><dc:creator>ericli</dc:creator><author>ericli</author><pubDate>Wed, 13 Sep 2006 12:21:00 GMT</pubDate><guid>http://m.tkk7.com/ericli1982/archive/2006/09/13/69454.html</guid><wfw:comment>http://m.tkk7.com/ericli1982/comments/69454.html</wfw:comment><comments>http://m.tkk7.com/ericli1982/archive/2006/09/13/69454.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/ericli1982/comments/commentRss/69454.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/ericli1982/services/trackbacks/69454.html</trackback:ping><description><![CDATA[ toadq接出现问题Q?br />可能是一些环境变量被修改了,比如昨天我碰到的问题 <br />d:\oracle\ora92\BIN 被修改了Q在path 里面其配置好,可以了<br />正常的配|信息如下: <br /> (Oracle Root)<br />  ORACLE_HOME = d:\oracle\ora92<br />  ORACLE_SID = <br />  NLS_LANG = NA<br />  SQLPATH = <br />  d:\oracle\ora92\BIN is in system PATH<br />  d:\oracle\ora92\BIN does exist<br />  Client dll found oci.dll<br />  oci.dll version: 9.2.0.1.0   <br />  (Oracle Root) is valid<br />HOME0<br />  ORACLE_HOME_NAME = OraHome92<br />  ORACLE_HOME = d:\oracle\ora92<br />  ORACLE_SID = NHOALG<br />  NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK<br />  SQLPATH = d:\oracle\ora92\dbs<br />  d:\oracle\ora92\BIN is in system PATH<br />  d:\oracle\ora92\BIN does exist<br />  Client dll found oci.dll<br />  oci.dll version: 9.2.0.1.0<br />  HOME0 is valid<br />$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$<br />同事遇到问题Qtoad安装好一ơ后Q就打不开?br />是版本的问题Q换了一个版本就好了<br />7.6--8.0 <br /> <img src ="http://m.tkk7.com/ericli1982/aggbug/69454.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/ericli1982/" target="_blank">ericli</a> 2006-09-13 20:21 <a href="http://m.tkk7.com/ericli1982/archive/2006/09/13/69454.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse ShortCuthttp://m.tkk7.com/ericli1982/archive/2006/09/13/69453.htmlericliericliWed, 13 Sep 2006 12:20:00 GMThttp://m.tkk7.com/ericli1982/archive/2006/09/13/69453.htmlhttp://m.tkk7.com/ericli1982/comments/69453.htmlhttp://m.tkk7.com/ericli1982/archive/2006/09/13/69453.html#Feedback0http://m.tkk7.com/ericli1982/comments/commentRss/69453.htmlhttp://m.tkk7.com/ericli1982/services/trackbacks/69453.html?Eclipse 3.0 RC2 熱鍵?(中英照版,Default) ?

AuthorQsungo
DateQ?004/06/16 (?


◎閱讀說明Q冒?( : )後的藍色標註熱鍵為Eclipse預設的標準熱鍵,I?
白即表示Eclipse並未該項目a熱鍵;紅色標註達R表示常用或重要熱
鍵;淡粉紅色標註達RQ表C可以啟動該熱鍵的範圍?

◎熱鍵修改處Q?
Window->Preference->Workbench->Keys

◎FAQQ如果沒a熱늚功能要如何啟動?
Ҏ(gu)一.自己增設熱鍵?
Ҏ(gu)?熱鍵a定裡的達RQ其實功能表大部分都有,可以由功能表中直接點選?

◎所有在看這篇文章的朋友:
T55555ZJavaWorld週年慶把DG2拿出來了Q為了效法他的精,所以我決定?
我的W一ơ也貢獻ZQ加入JavaWorld這半q來我第一ơ打這麼L文章...XD
。本來打?.0 ReleaseZ後再整理熱鍵表,?.0 RCpd架構已經於q穩Q?
ReleaseZ也不會有多大的變動,所以就先整理了。熱鍵表所列的功能Q只要?zhn)?
全部實際操作過一遍,會為?zhn)在操作Eclipse上,帶來莫大的助益?

-------------------------------------------------------------------------------------------------------------

Compare - 比較
Copy All from Left to Right (由左向右複製全部)
Copy All from Right to Left (由右向左複製全部)
Copy from Left to Right (由左向右複製)
Copy from Right to Left (由右向左複製)
Select Next Change (選取下一個變?
Select Previous Change (選取上一個變?

CVS - Concurrent Versions System (版本控制pȝ)
Checkout from CVS (由CVS檢查)

Edit - R輯
Add Bookmark (新增書籤)
Add Task (新增作業)
Collapse (E式折? Q?Ctrl+늛x數字區?-' <Editing Text>
Content Assist (內容輔助 - Code Templetes啟動)Q?Alt+/ ?Ctrl+Space <In Dialogs and Windows>
Context Information (內容資訊) Q?Alt+Q??ALT+Shift+Q或 Ctrl+Shift+Space <In Windows>
Copy (複製選取文字到OS剪貼? Q?Ctrl+C <In Dialogs and Windows>
Custom Encoding (自訂R碼)
Cut (剪下選取文字並加至OS剪貼? Q?Ctrl+X <In Dialogs and Windows>
Default Encoding (使用預設R碼)
Delete (刪除選取的文? Q?Delete <In Windows>
Expand (E式展? Q?Ctrl+늛x數字區?+' <Editing Text>
Expand All (E式全部展? Q?Ctrl+늛x數字區?*' <Editing Text>
Find and Replace (找並取代文? Q?Ctrl+F <In Windows>
Find Next (找下一個項? Q?Ctrl+K <Editing Text>
Find Previous (找上一個項? Q?Ctrl+Shift+K <Editing Text>
Incremental Find (演R式找) Q?Ctrl+J <Editing Text>
Incremental Find Reverse (逆向演R式找) Q?Ctrl+Shift+J <Editing Text>
ISO-8859-1 Encoding (編D更為 ISO-8859-1)
Paste (從OS剪貼貼上文? Q?Ctrl+V <In Dialogs and Windows>
Quick Diff Toggle (QuickDiff 開啟/關閉) Q?Ctrl+Shift+Q <Editing Text>
Quick Fix (快速套件修? Q?Ctrl+1 <Editing Java Source>
Redo (重做上一ơ作? Q?Ctrl+Y <In Windows>
Restore Last Selection (恢復最後選? Q?Alt+Shift+方向?? <Editing Java Source>
Revert to Saved (回復臛_儲存)
Select All (選擇全部文字) Q?Ctrl+A <In Dialogs and Windows>
Select Enclosing Element Q?(選取含括的元? Alt+Shift+方向?? <Editing Java Source>
Select Next Element (選取下一個元? Q?Alt+Shift+方向?? <Editing Java Source>
Select Previous Element (選取上一個元? Q?Alt+Shift+方向?? <Editing Java Source>
Shift Left (該行文字往左移動一個縮?
Shift Right (該行文字往右移動一個縮?
Show Tooltip Description (在游標位|顯C元素的工具提示說明) Q?F2 <Editing Java Source>
System Encoding (編D更為pȝR碼)
Toggle Folding (E式折疊、展開功?開啟/關閉) Q?Ctrl+늛x數字區?/' <Editing Text>
Toggle Insert Model (Smart Insert模式 開啟/關閉) Q?Ctrl+Shift+Insert <Editing Text>
Undo (復原前次作業) Q?Ctrl+Z <In Windows>
US ASCII Encoding (編D更為 ASCII)
UTF-16BE Encoding (編D更為 UTF-16BE)
UTF-16 Encoding (編D更為 UTF-16)
UTF-16LE Encoding (編D更為 UTF-16LE)
UTF-8 Encoding (編D更為 UTF-8)

File - 檔案
Close (關閉檔案) Q?Ctrl+W ?Ctrl+F4 <In Windows>
Close All (關閉全部檔案) Q?Ctrl+Shift+W ?Ctrl+Shift+F4 <In Windows>
Exit (關閉螢幕最上層視窗) Q?Alt+F4 <In Dialogs and Windows>   0
(a:3.0RC2並沒預設這組熱鍵Q但仍然可以使用?

Export (開啟匯出功能?
Import (開啟匯入功能?
Move (Ud檔案)
New (開啟檔案建立_NWizard) Q?Ctrl+N <In Windows>
New menu (示File->New選單) Q?ALT+Shift+N <In Windows>
Open External File (開啟外部檔案)
Open Workspace (開啟Workspacea定視窗)
Print (列印檔案) Q?Ctrl+P <In Windows>
Properties (org.eclipse.ui.file.properties) (示檔案內容) Q?Alt+Enter <In Windows>
Refresh (重新整理) Q?F5 <In Windows>
Rename (重新命名) Q?F2 <In Windows>
Revert (回復臛_儲存)
Save (儲存檔案) Q?Ctrl+S <In Windows>
Save All (儲存全部檔案) Q?Ctrl+Shift+S <In Windows>
Save As (另存新檔)

Help - 說明
About (開啟關於話?
Help Contents (開啟Eclipse說明文g)
Tips and Tricks (開啟要訣和技巧說明頁?
Weclome (開啟歡迎使用頁面)

Navigate - 覽
Back (向後覽)
Backward History (在編輯器覽L中向後移? Q?Alt+方向?? <In Windows>
Forward (向前覽)
Forward History (在編輯器覽L中向前移? Q?Alt+方向?? <In Windows>
Go Into (進入選取的目錄內)
Go to Line (U至某一行文? Q?Ctrl+L <Editing Text>
Go to Matching Bracket (游標移臛_EqҎ(gu)? Q?Ctrl+Shift+P <Editing Java Source>
Go to Next Member (U至下一個Member) Q?Ctrl+Shift+方向?? <Editing Java Source>
Go to Package (U至套gQ用於Package Explorer)
Go to Previous Member (U至上一個Member) Q?Ctrl+Shift+方向?? <Editing Java Source>
Go to Resource (U至資源)
Go to Type (U至別Q用於Package Explorer)
Last Edit Loaction (U至前次R輯位置) Q?Ctrl+Q <In Windows>
Next (U至下一個標C元? Q?Ctrl+. <In Windows>
(a:元素型可由Toolbar的Next Annotation倒三角圖C定?

Open Call Hierarchy (開啟Call Hierarchy視窗) Q?Ctrl+Alt+H <In Windows>
Open Declaration (瀏覽所選取的Java元素) Q?F3 <In Windows> (a:效果{於Ctrl+滑鼠左鍵點選?
Open External Javadoc (開啟外部Javadoc) Q?Shift+F2 <In Windows>
Open Resource (開啟資源選取話方塊) Q?Ctrl+Shift+R <In Windows>
Open Structure (示所選元素的i構) Q?Ctrl+F3 <Editing Java Source>
Open Super Implementation (開啟super型中的實作)
Open Type (開啟別) Q?Ctrl+Shift+T <In Windows>
Open Type Hierarchy (開啟別階層示視窗) Q?F4 <In Windows>
Open Type in Hierarchy (在類別階層的視圖中開啟類? Q?Ctrl+Shift+H <In Windows>
Previous (U至上一個標C元? Q?Ctrl+, <In Windows>
(a:元素型可由Toolbar的Previous Annotation倒三角圖C定?

Quick Hierarchy (以Q動方式將別階層視窗示在編輯器? Q?Ctrl+T <Editing Java Source>
Quick Outline (以Q動方式將概要視窗示在編輯器? Q?Ctrl+O <Editing Java Source>
Show In menu (示當前Show In功能表可用的達R) Q?Alt+Shift+W <In Windows>
Show in Package Explorer (在套件瀏覽器中示所選元?
Up (覽上一?

Project - 案
Build All (建置所有專? Q?Ctrl+B <In Windows>
Build Clean (清除案)
Build Project (建置案)
Close Project (關閉案)
Generate Javadoc (產生Javadoc)
Open Project (開啟案)
Properties (org.eclipse.ui.project.properties) (開啟案屬性設定視H?
Rebuild All (重新建置所有專?
Rebuild Project (重新建置案)
Repeat Working Set Build (重複建置所a定的專? (a:Build Automatically 關閉時才可用?

Refactor - Java (重構 - Java)
Change Method Signature (變更Ҏ(gu)章) Q?Alt+Shift+C <In Windows>
Convert Anonymous Class to Nested (匿名類別轉換成巢狀別)
Convert Local Variable to Field (區域變數轉換成Ƅ位) Q?Alt+Shift+F <Editing Java Source>
Encapsulate Field (裝Ƅ位Q為Ƅ位建立getting和settingҎ(gu)Q並只用這些Ҏ(gu)來存取欄?
Extract Constant (擷取成常數:數字擷取至新的StaticƄ位Q並使用新的StaticƄ位)

a:<-START->

如下D늨式碼E由Extract Constant重構數字10?..
12345
 public class Test {
    public static void main(String[] args) {
        int x = 10;
    }
}

 
會變成下列程式碼Q?常數Ƅ位名稱Q在重構時可以自p定?123456
 public class Test {
    public static final int TEN = 10;
    public static void main(String[] args) {
        int x = TEN;
    }
}

 
a:<-END->

Extract Interface (擷取成介面:原別內的Ҏ(gu)擷取x介面中,原類別將實作該介?
(a:C面會存成一個新?.java檔。若是在interface中執行此功能Q舊介面則會J承C面?
Extract Local Variable (擷取成區域變數:數字擷取為新的區域變? Q?Alt+Shift+L <In Windows>
Extract Method (擷取成方法:選取的表示式擷取成一個新Ҏ(gu)) Q?Alt+Shift+M <In Windows>
Generalize Type (reference的類別型態更改可以取代的Superclass)
Inline (列入常數、區域變數或Ҏ(gu)) Q?Alt+Shift+I <In Windows>
Introduce Factory (採用代理Q利用方法來取得建構?

a:<-START->

如下D늨式碼E由Introduce Factory重構Test建構子後...
123456789
 public class Test {
    private int number;
    Test(int x) {
        number = x;
    }
    public static void main(String[] args) {
        System.out.println(new Test(5).number);
    }
}

 
會變成下列程式碼Q?23456789101112
 public class Test {
    private int number;
    public Test(int x) {
        number = x;
    }
    public static void main(String[] args) {
        System.out.println(createTest(5).number);
    }
    public static Test createTest(int x) {
        return new Test(x);
    }
}

 
a:<-END->

Introduce Parameter (採用參數Q將區域變數改成參數方式傳?

a:<-START->

如下D늨式碼E由Introduce Parameter重構數字5?..
12345
 public class Test {
    public static void main(String[] args) {
        int x = 5;
    }
}

 
會變成下列程式碼Q?2345
 public class Test {
    public static void main(String[] args, int five) {
        int x = five;
    }
}

 
a:<-END->

Move Member Type to New File (類別成員移至一個新?
Move - Refactoring (Ud - 重構Q將所選取的元素移x位置) Q?Alt+Shift+V <In Windows>
Pull Up (類別成?lt;Ƅ位與方?gt;上推到類別的爉別中)
Push Down (類別成?Ƅ位與方?下推到類別的子類別中)
Redo - Refactoring (重做 - 重構Q重做前ơ的重構) Q?Alt+Shift+Y <In Windows>
Refactor Quick Menu (在編輯區示重構的快速功能表) Q?Alt+Shift+T <In Windows>
Rename - Refactoring (更名 - 重構Q將所選取的元素重新命名,別名稱、區域變數名Eq...) Q?
Alt+Shift+R <In Windows>
Undo - Refactoring (復原 - 重構Q復原前ơ的重構) Q?Alt+Shift+Z <In Windows>
Use Supertype Where Possible (啟動「適當時使用爉別」重構對話框?

◎補充命名規則:(重構時不照此規則命名時,Eclipse會警示Q?
雖然可以不管警示Q但這是個好風格?

1.介面(interface)名稱Q開頭大寫?
2.區域變?Local Variable)名稱Q開頭小??
3.常數Ƅ位(public static final int...)名稱Q全部大寫?

Run/Debug - 埯/除錯
Add Class Load Breakpoint (新增一個類別載入中斷點))
Add Java Exception Breakpoint (新增一個Java異常狀況中斷點)
Debug... (開啟除錯啟動配置話?
Debug Last Launched (開啟最q一ơ啟動作業的除錯模式) Q?F11 <In Windows>
Display (org.eclipse.jdt.debug.ui.commands.Display) (示) Q?Ctrl+Shift+D <In Windows>
(a:當執行緒暫停時,此指令會使用「顯C」檢視畫面,示在該埯R之堆疊框或變數的環境定下
Q評估所選表C式的結果?

Execute (埯Q開啟執行啟動配|對話框) Q?Ctrl+U <In Windows>
Inspect (觀?Q?Ctrl+Shift+I <In Windows>
(a:當執行緒暫停時,此指令會使用「表C式」檢視畫面,示在該埯R之堆疊框或變數的環境定?
下,視察所選表C式或變數的i果?

Profile Last Launched (最q一ơ作業的概況)
Resume (J續埯R的埯) Q?F8 <Debugging>
Run Last Launched (在執行模式下q速執行最q一ơ的啟動作業)Q?Ctrl+F11 <In Windows>
Run Last Launched External Tool (埯前一ơ啟動的外部工具)
Run to Line (埯x定行Q可在沒有設定中斷點之處暫停埯) Q?Ctrl+R <Debugging>
Skip All Breakpoints (在不清除中斷點的情況下,埯時蟩過所有的中斷?
Step Into (進入副程? Q?F5 <Debugging>
Step Into Selection (進入目前所選的陌式進行副程序除? Q?Ctrl+F5 <Debugging>
Step Over (跳過副程? Q?F6 <Debugging>
Step Return (跛_副程?Q?F7 <Debugging>
Suspend (暫停埯R?
Terminate (i止埯R?
Toggle Breakpoint (新增/U除Q中斷點) Q?Ctrl+Shift+B <In Windows>
Toggle Method Breakpoint (新增/U除Q方法中斷點)
Toggle Step Filters (以過Ⱦ條仉步除錯) Q?Shift+F5 <In Windows>
Toggle Watchpoint (新增/U除Q欄位的監視?

Search - 搜烦
Declaration in Hierarchy (在它的階層中搜尋所選元素的宣告)
Declaration in Project (在專案中搜尋所選元素的宣告)
Declaration in Working Set (在工作集中搜所選元素的宣告)
Declaration in Workspace (在工作區中搜所選元素的宣告) Q?Ctrl+G <In Windows>
Exception Occurrences (搜烦例外事g)
File Search (開啟搜尋話框的檔案搜尋頁面)
Implementors in Project (在專案中搜尋所总面的實作?
Implementors in Working Set (在工作集中搜所总面的實作?
Implementors in Workspace (在工作區中搜所总面的實作?
Occurrences in File (在它的宣告檔案中搜尋所選元素的所有出現處) Q?Ctrl+Shift+U <In Windows>
Open Search Dialog (開啟搜尋話? Q?Ctrl+H <In Windows>
Read Access in Hierarchy (在它的階層中搜尋所選元素的讀取參?
Read Access in Project (在專案中搜尋所選元素的讀取參?
Read Access in Working Set (在工作集中搜所選元素的讀取參?
Read Access in Workspace (在工作區中搜所選元素的讀取參?
References in Hierarchy (在它的階層中搜尋所選元素的參?
References in Project (在專案中搜尋所選元素的參?
References in Working Set (在工作集中搜所選元素的參?
References in Workspace (在工作區中搜所選元素的參? Q?Ctrl+Shift+G <In Windows>
Referring Tests (查詢測試)
Write Access in Hierarchy (在它的階層中搜尋所選元素的寫入參?
Write Access in Project (在專案中搜尋所選元素的寫入參?
Write Access in Working Set (在工作集中搜所選元素的寫入參?
Write Access in Workspace (在工作區中搜所選元素的寫入參?

Source - E式?
Add Block Comment (選取的字行以多行註?**/包v? Q?Ctrl+Shift+/ <Editing Java Source>
Add Constructors from Superclass (從父別增加一個徏構子)
Add Import (為目前所選的別參考徏立一項匯入宣? Q?Ctrl+Shift+M <Editing Java Source>
Add Javadoc Comment (新增Javadoca解) Q?Alt+Shift+J <In Windows>
Comment (a解)
Externalize Strings (開啟「外部化字串」精?
Find Strings to Externalize (找要外部化的字?
Format (E式D動排? Q?Ctrl+Shift+F <Editing Java Source>
Format Element (格式化元?
Generate Constructor using Fields (使用Ƅ位來產生徏構子)

a:<-START->

如下D늨式碼Q選取欄位名Emoney並經由Generate Constructor using Fields指o?..
12345
 public class Test {
    int money;
    public static void main(String[] args) {
    }
}

 
會變成下列程式碼Q?2345678
 public class Test {
    int money;
    public Test(int money) {
        this.money = money;
    }
    public static void main(String[] args) {
    }
}

 
a:<-END->

Generate Delegate Methods (開啟「產生委z方法」對話框Q可新增型Ƅ位的委z方?
Generate Getters and Setters (開啟「產生Getter與Setter」對話框Q可以為Ƅ位自動
建立Getter和SetterҎ(gu))
Indent Line (單行^排Q其會遵照Formattera定的格? Q?Ctrl+I <Editing Java Source>
Mark Occurrences (標註事g)Q?Alt+Shift+O <Editing Java Source>
Organize Imports (i織匯入) Q?Ctrl+Shift+O <In Windows>
(a:這是個很方便的功能,易說明一下用時:假設我們在E式中打QJFrame src;而並?
importMswing別Q此時Eclipse便會出現錯誤警示Q用紅底R將JFrame標v來,此時只要?
下Ctrl+Shift+OQEclipse便會自動:import javax.swing.JFrame;加到E式g了?

Override/Implement Methods (開啟「覆?實作Ҏ(gu)」對話框Q可覆寫或實作現行類別中的方?
Remove Block Comment (U除多行a解/**/) Q?Ctrl+Shift+\ <Editing Java Source>
Remove Occurrence Annotations (U除事g書籤)Q?Alt+Shift+U <Editing Java Source>
Sort Members (排序成員)
Source Quick Menu (在編輯區示Source的快速功能表) Q?Alt+Shift+S <In Windows>
Surround with try/catch Block (以try/catch區塊包覆所選文?
Toggle Comment (加上單行a解/取消單行a解) Q?Ctrl+/ ?Ctrl+7 ?Ctrl+Shift+C
<Editing Java Source>
Uncomment (取消a解)

◎補充,Source p熱鍵Q?
1.Shift Right (向右UMQ增加目前所選字行的內縮層次) Q?Tab <Editing Java Source>
2.Shift Left (向左UMQ減目前所選字行的內縮層次) Q?Shift+Tab <Editing Java Source>

Team - 團隊
Synchronize (同步?

Text Editing - 文字R輯
Claer Mark (清除標記)
Copy Lines (選取的文字Q複製成新行) Q?Ctrl+Alt+方向?? <Editing Text>
Cut Line (剪下單行文字)
Cut to Beginning of Line (剪下文字Q範圍為選取處至單行開頭)
Cut to End of Line (剪下文字Q範圍為選取處至單行)
Delete Line (刪除單行文字) Q?Ctrl+D <Editing Text>
Delete Next (刪除下一?
Delete Next Word (刪除下一個字i? Q?Ctrl+Delete <Editing Text>
Delete Previous (刪除前一?
Delete Previous Word (刪除前一個字i? Q?Ctrl+Backspace <Editing Text>
Delete to Beginning of Line (刪除文字Q範圍為選取處至單行開頭)
Delete to End of Line (刪除文字Q範圍為選取處至單行)
Duplicate Lines (選取的文字Q複製成新行) Q?Ctrl+Alt+方向?? <Editing Text>
Insert Line Above Current Line (在游標處的該行上Ҏ(gu)入新? Q?Ctrl+Shift+Enter <Editing Text>
Insert Line Below Current Line (在游標處的該行下Ҏ(gu)入新? Q?Shift+Enter <Editing Text>
Line Down (游標往下移一?
Line End (游標U至該行)
Line Start (游標U至該行開頭)
Line Up (游標往上移一?
Move Lines Down (該行文字往下移? Q?Alt+方向?? <Editing Text>
Move Lines Up (該行文字往上移? Q?Alt+方向?? <Editing Text>
Next Column (游標U至下一?
Next Word (游標U至下一個字i? Q?Ctrl+方向?? <Editing Text>
Page Down (U至下一?
Page Up (U至上一?
Previous Column (游標U至上一?
Previous Word (游標U至上一個字i? Q?Ctrl+方向?? <Editing Text>
Scroll Line Down (向下捲動) Q?Ctrl+方向?? <Editing Text>
Scroll Line Up (向上捲動) Q?Ctrl+方向?? <Editing Text>
Select Line Down (選取下一?
Select Line End (選取x字尾?
Select Line Start (選取x字開?
Select Line Up (選取上一?
Select Next Column (選取下一?
Select Next Word (選取下一個字i?Q?Ctrl+Shift+方向?? <Editing Text>
Select Page Down (選取下一?
Select Page Up (選取上一?
Select Previous Column (選取上一?
Select Previous Word (選取前一個字i? Q?Ctrl+Shift+方向?? <Editing Text>
Select Text End (選取x字編輯器)
Select Text Start (選取x字編輯器開頭)
Select Window End (選取臌H尾?
Select Window Start (選取臌H開?
Set Mark (a定標記)
Swap Mark (交換標記)
Text End (游標U至文字R輯器最底端)
Text Start (游標U至文字R輯器最頂端)
Toggle Overwrite (覆寫/插入 模式選擇) Q?Insert <Editing Text>
To Lower Case (選取的英文字轉為小? Q?Ctrl+Shift+Y <Editing Text>
To Upper Case (選取的英文字轉為大? Q?Ctrl+Shift+X <Editing Text>
Window End (游標移臌H尾?
Window Start (游標移臌H開?

Views - 檢視
Ant (開啟Ant檢視視窗)
Bookmarks (開啟書籤檢視視窗)
Breakpoints (開啟中斷點檢視視H?
Classic Search (開啟傳箔的搜索檢視視H?
Console (開啟L台檢視視H?
CVS Annotate (開啟CVS Annotate檢視視窗)
CVS Editors (開啟CVS Editor檢視視窗)
CVS Repositories (開啟CVS Repositories檢視視窗)
CVS Resource History (開啟CVS Resource History檢視視窗)
Debug (開啟除錯檢視視窗)
Display (org.eclipse.jdt.debug.ui.DisplayView) (開啟除錯-示檢視視窗)
Error Log (開啟錯誤a錄檢視視窗)
Expressions (開啟除錯-表示式檢視視H?
Java Call Hierarchy (開啟Call Hierarchy檢視視窗)
Java Declaration (開啟宣告檢視視窗)
Javadoc (開啟Javadoc檢視視窗)
Java Members (開啟別成員檢視視窗)
Java Package Explorer (開啟套g瀏覽? Q?Alt+Shift+Q,P <In Windows>
Java Packages (開啟Java套g檢視視窗)
Java Projects (開啟Java案檢視視窗)
Java Type Hierarchy (開啟別階層檢視視窗) Q?Alt+Shift+Q,T <In Windows>
Java Types (開啟Java別檢視視窗)
JUnit (開啟JUnit檢視視窗)
Memory (開啟除錯-a憶體檢視視H?
Navigator (開啟覽?
Outline (開啟概要檢視視窗) Q?Alt+Shift+Q,O <In Windows>
Plug-in Dependencies (開啟Plug-in Dependencies檢視視窗)
Plug-in Registry (開啟Plug-in Registry檢視視窗)
Plug-ins (開啟Plug-ins檢視視窗)
Problems (開啟問題檢視視窗) Q?Alt+Shift+Q,X <In Windows>
Progress (開啟埯進度檢視視窗)
Properties (org.eclipse.ui.views.Property/Sheet) (開啟屬性檢視視H?
Registers (開啟除錯-暫存器檢視視H?
Search (開啟搜烦檢視視窗) Q?Alt+Shift+Q,S <In Windows>
Synchronize (開啟同步化檢視視H? Q?Alt+Shift+Q,Y <In Windows>
Tasks (開啟作業檢視視窗)
Threads and Monitors (開啟除錯-埯R檢視視H?
Variables (開啟除錯-變數檢視視窗)

◎補充:Views 檢視視窗的開啟處Q?
Window->Show View->Other?

Window - 視窗
Activate Editor (啟動R輯? Q?F12 <In Windows>
Close All Perspectives (關閉全部視景)
Close Perspective (關閉視景)
Customize Perspective (自訂視景)
Hide Editors (pR輯?
Lock the Toolbars (鎖定工具?
Maximize Active View or Editor (R輯區最大化) Q?Ctrl+M <In Windows>
Next Editor (切換至下一個編輯器) Q?Ctrl+F6 <In Windows>
Next Perspective (切換至下一個視? Q?Ctrl+F8 <In Windows>
Next View (切換至下一個視? Q?Ctrl+F7 <In Windows>
Open Editor Drop Down (以Q動的方式在編輯區Q顯C快速切換編輯器功能? Q?Ctrl+E <In Windows>
Pin Editor (固定R輯?
Preferences (開啟偏愛a定)
Previous Editor (切換至上一個編輯器) Q?Ctrl+Shift+F6 <In Windows>
Previous Perspective (切換至上一個視? Q?Ctrl+Shift+F8 <In Windows>
Previous View (切換至上一個視? Q?Ctrl+Shift+F7 <In Windows>
Reset Perspective (重新a定視景)
Save Perspective As (儲存為新視景)
Show Ruler Context Menu (示的內容功能表) Q?Ctrl+F10 <Editing Text>
Show Selected Element Only (僅顯C所選元素的E式?
Show System Menu (示pȝ功能? Q?Alt+- <In Windows>
Show View Menu (示視圖功能? Q?Ctrl+F10 <In Windows>
Switch to Editor (切換至編輯器) Q?Ctrl+Shift+E <In Windows>



ericli 2006-09-13 20:20 发表评论
]]>
J2EE开发之常用开源项目介l-Q{载(学习Q?/title><link>http://m.tkk7.com/ericli1982/archive/2006/09/13/69446.html</link><dc:creator>ericli</dc:creator><author>ericli</author><pubDate>Wed, 13 Sep 2006 12:19:00 GMT</pubDate><guid>http://m.tkk7.com/ericli1982/archive/2006/09/13/69446.html</guid><wfw:comment>http://m.tkk7.com/ericli1982/comments/69446.html</wfw:comment><comments>http://m.tkk7.com/ericli1982/archive/2006/09/13/69446.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://m.tkk7.com/ericli1982/comments/commentRss/69446.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/ericli1982/services/trackbacks/69446.html</trackback:ping><description><![CDATA[主要q是以Spring为核?也ȝ了一些以前web开发常用的开源工具和开源类?br /> <br />1持久?        <br />1)Hibernate<br />q个不用介绍?用的很频J?用的比较多的是映?包括l承映射和父子表映射<br />对于DAO在这里介l个在它基础上开发的包bba96,目前最新版本是bba96 2.0它对Hibernateq行了封? 查询功能包括执行hsql或者sql查询/更新的方法,如果你要多层ơ逻辑的条件查询可以自q装QueryObject.可以参考它做HibernateDAO.也可以直接利用它<br />2) iBATIS<br />另一个ORM工具,没有Hibernate那么集成,自由度比较大,所以用时普遍性能上比Hibernate要快一?<br />2:SpringMVC<br />       原理说明和快速入?<br />       配置文g?<br />Spring的配|文仉认ؓWEB-INF/xxxx-servelet.xm其中xxx为web.xml中org.springframework.web.servlet.DispatcherServlet的servlet-name?br />       Action分发:<br />Spring按照配|文件定义的URLQMapping到具体Controllerc,再根据URL里的action= xxx或其他参敎ͼ利用反射调用Controller里对应的ActionҎ(gu)?br />输入数据l定:<br />Spring提供Binder 通过名字的一一对应反射l定PojoQ也可以直接从request.getParameter()取数据?br />输入数据验证<br />Sping 提供了Validator接口当然q可以用开源的Commons-Validaor支持最?br />Interceptor(拦截?<br />Spring的拦截器提供接口需要自q?在这点不如WebWork做的?全面 <br />       (q里提一下WebWork和Struts的区别最主要的区别在于WebWork在徏立一个Action时是新New一个对象而Struts是SingleMoule所有的都承它的一个Action,所以根据项目需要合适的选择.)<br />3:View?br />1) 标签?JSP2.0/JSTL<br />׃Webwork或Spring的标{实很有限,一般view层用JSTL标签,而且据说JSTL设计很好速度是所有标{中最快的使用h也很?br /> <br />2) 富客L:DOJO Widgets, YUI(YahooUI),FCKEditor, Coolest日历控g<br />Dojo主要提供Tree, Tab{富客户端控?可以用其q行辅助客户端开?br />YahooUI和DOJO一样它有自q一套javascript调试控制?主要支持ajax开发也有很多Tree,Table,Menu{富客户端控?br />FCKEditor 最行的文本编辑器<br />Coolest日历控g 目前很多日历控g可用,集成在项目中也比较简?q个只是其中的一?界面不错的说..<br /> <br />3) JavaScript:Prototype.js<br />Prototype.js作ؓjavascript的成功的开源框Ӟ装了很多好用的功能,通过它很Ҏ(gu)~写AJAX应用,现在AJAX技术逐渐成熟,框架资源比较丰富,比如YUI,DWR{等,也是因ؓJavaScript没有合适的调试工具,所以没有必要从零开始编写AJAX应用,个h认ؓ多用一些成熟的Ajax框架实现无刷新更新页面是不错的选择.<br /> <br />4)表格控g:Display Tag ,Extreme Table<br />q两个的功能差不?都是View层表格的生成,界面也比较相?可以导出Excel,Pdf,对Spring支持很容?<br />相比较而言比较推荐ExtremeTable,它的设计很好功能上比DisplayTag多一?支持Ajax,装了一些拦截器,而且最斚w的是在主wiki中有详细的中文用文?<br /> <br />5):OSCache<br />OSCache是OpenSymphonyl织提供的一个J2EE架构中Web应用层的~存技术实现组?Cache是一U用于提高系l响应速度、改善系l运行性能的技术。尤其是在Web应用中,通过~存面的输出结果,可以很显著的改善pȝ的稳定性和q行性能?br />它主要用在处理短旉或一定时间内一些数据或面不会发生变化,或将一些不变的l计报表,~冲在内?可以充分的减L务器的压?防治负蝲q,快速重启服务器(通过盘~存).<br /> <br />6)SiteMesh<br />sitemesh应用Decorator模式主要用于提高面的可l护性和复用性,其原理是用Filter截取request和response,把页面组件head,content,bannerl合Z个完整的视图。通常我们都是用include标签在每个jsp面中来不断的包含各Uheader, stylesheet, scripts and footerQ现在,在sitemesh的帮助下Q我们删掉他们轻松达到复合视图模?<br />Sitemesh也是 OpenSymphony的一个项目现在最q的版本?.2,目前OpenSymphony自从04q就没有更新的版本了..感觉它还是比较有创新的一U页面组装方? OpenSymphony开源组l的代码一般写的比较漂?可以改其源代码对自己的项目进行适配.<br />试发现Sitemeshq存在一些问?比如中文问题,它的默认~码是iso-8859-1在用时候需要做一些改?<br /> <br />7)CSS,XHTML<br />q个不用说了,遵@W3C标准的web面开?<br /> <br />8)分页标签: pager-tagliblg<br />Pager-taglib 是一套分|{ֺQ可以灵zd实现多种不同风格的分导航页面,q且可以很好的与服务器分逻辑分离.使用h也比较简?<br /> <br />9)Form: Jodd Form taglib<br />Jodd Form taglib使用比较?只要?lt;form>的头以<jodd:form bean= "mybean">包住<br />׃自动l定mybean, 自动l定mybean的所有同名属性到普通html标记input, selectbox, checkbox,radiobox.....在这些input框里不用再写M代码?br />       <br />10)Ajax:DWR<br />       J2EE应用最常用的ajax框架<br />       <br />       11)报表 图表<br />Eclipse BIRT功能比较强大,也很庞大..好几十M,一般没有特别需求或别的图表设计软g可以解决的不用它<br />JasperReports+ iReport是一个基于Java的开源报表工P它可以在Java环境下像其它IDE报表工具一h制作报表。JasperReports支持PDF、HTML、XLS、CSV和XML文g输出格式。JasperReports是当前Java开发者最常用的报表工兗?br />JFreeChart主要是用来制作各U各L图表Q这些图表包括:饼图、柱状图(普通柱状图以及堆栈q?、线图、区域图、分布图、؜合图、甘特图以及一些A表盘{等?br />       <br /> <br />4:权限控制: Acegi<br />Acegi是Spring Framework 下最成熟的安全系l,它提供了强大灉|的企业安全服务Q如完善的认证和授权机制QHttp资源讉K控制QMethod 调用讉K控制{等,支持CAS<br />(耉大学的单点登陆技?q个单点登陆Ҏ(gu)比较出名.我也q行q配|?可以Ҏ(gu)目需?如果用户分布在不同的地方不同的系l通用一套登陆口令可以用它进行解?一般注册机登陆机就是这栯决的)<br />       Acegi只是于Springl合最好的安全框架,功能比较强大,当然q有一些其他的安全框架,q里列D一些比较流行的是我从网上找到的,使用Ҏ(gu)看其官方文档把?br />JAAS, Seraph, jSai - Servlet Security, Gabriel, JOSSO, Kasai, jPAM, OpenSAML都是些安全控制的框架..真够多的呵呵<br /> <br />5:全文?br />       1) Lucene<br />       Lucene是一套全文烦引接?可以通过它将数据q行倒排文g处理加入索引文g,它的索引速度和查询速度是相当快?查询百万U数据毫U出结?现在最火的Apache开源项?版本更新速度很快现在已经C2.0,每个版本更新的都比较?目前用的最多的版本应该?.4.3,但它有个不太斚w的地方单个烦引文件有2G文g限制,现在2.0版本没有q个限制,我研I的比较?它的扩展性比较好,可以很方面的扩充其分词接口和查询接口.<br />       Z它的开发的pȝ很多,比如最常用的Eclipse的搜索功?q有一些开源的软g比如Compass,Nutch,Lius,q有我最q做的InSearch(企业UFTP文g|页搜烦)<br />6:公共Utilc?br />       主要是Jakarta-Commonscd,其中最常用得是以下几个cd<br />1) Jakarta-Commons-Language<br />       最常用得类是StringUtilsc?提供了用的字符串处理的常用Ҏ(gu)效率比较?br />2) Jakarta-Commons-Beantuils<br />       主要用Beantuils能够获得反射函数装及对嵌套属性,map,array型属性的d?br />3) Jakarta-Commons-Collections<br />       里面有很多UtilsҎ(gu)<br /> <br />7 日志理<br />       Log4J<br />       d是日志记?分ؓInfo,Warn,error几个层次可以更好的调试程?br /> <br />8 开源的J2EE框架<br />       1) Appfuse<br />              Appfuse是Matt Raible 开发的一个指导性的入门UJ2EE框架, 它对如何集成行的Spring、Hibernate、iBatis、Struts、Xdcolet、JUnit{基框架l出了示? 在持久层QAppFuse采用了Hibernate O/R映射工具Q在容器斚wQ它采用了Spring,用户可以自由选择Struts、Spring/MVCQWebworkQJSFq几个Web框架?br />       <br />       2) SpringSide<br />       .SpringSide较完整的演示了企业应用的各个斚w,是一个电(sh)子商务网站的应用 SpringSide也大量参考了Appfuse中的优秀l验。最重要的是它是国内的一个开源项?可以了解到国内现在的一些实际技术动态和方向很有指导意义?br /> <br />9:模版 Template <br />主要有Veloctiy和Freemarker<br />模板用Servlet提供的数据动态地生成 HTML。编译器速度快,输出接近静态HTML             面的速度?br /> <br />10:工作?br />       我所知道比较出名的主要有JBpm Shark Osworkflow,׃对它没有q多的研I所以还不是很清楚之间有什么区?<br /> <br />目理软g<br />dotProject:是一个基于LAMP的开源项目管理Y件。最出名的项目管理Y?br />JIRA: 目计划QQ务安排,错误理<br />Bugzilla:提交和管理bug,和eclipse集成,可以通过安装MyEclipse配置一下即可?br />BugFree借鉴微Y公司软g研发理念、免费开放源代码、基于Web的精版Bug理<br />CVS:q个׃介绍了都在用.<br />SVN: SubVersion已逐渐越CVSQ更适应于JavaEE的项目。Apache用了它很久后QSourceforge刚刚推出SVN的支持?br />试用例:主要JUnit单元试,~写TestCase,Spring也对Junit做了很好的支?br /> <br />后记:<br />       以SpringZ的应用开发可选用的组件中间g真是D~ؕ,所以针对不同的目需求可以利用不同的开源品解?比如用Spring+Hibernate/ iBATIS或Spring+WebWork+Hibernate/ iBATIS或Spring+Struts+Hibernate/ iBATIS,合理的框架设计和代码复用设计寚w目开发效率和E序性能有很大的提高,也有利于后期的维?<img src ="http://m.tkk7.com/ericli1982/aggbug/69446.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/ericli1982/" target="_blank">ericli</a> 2006-09-13 20:19 <a href="http://m.tkk7.com/ericli1982/archive/2006/09/13/69446.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://m.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> վ֩ģ壺 <a href="http://wowo123.com" target="_blank">ƷþþþþС˵</a>| <a href="http://24aabb.com" target="_blank">˳Ƶվ</a>| <a href="http://c2277.com" target="_blank">޸Ƶ</a>| <a href="http://477077.com" target="_blank">һ</a>| <a href="http://xabcjzx.com" target="_blank">þþƷ޾Ʒ</a>| <a href="http://ljdst.com" target="_blank">պѹۿ</a>| <a href="http://13813855.com" target="_blank">91ɫŮԴվ </a>| <a href="http://qsqse1.com" target="_blank">Ƶ߹ۿѿƬ</a>| <a href="http://pgyadv.com" target="_blank">վ߹ۿ</a>| <a href="http://baicaijia666.com" target="_blank">ŮܳƵ</a>| <a href="http://my77789.com" target="_blank">һ߲Ʒ߲Ʒ</a>| <a href="http://djqq520.com" target="_blank">þþþþAv뾫Ʒר</a>| <a href="http://saohuo7.com" target="_blank">ĻƷһ</a>| <a href="http://vvihh.com" target="_blank">һëƬһëƬaa</a>| <a href="http://wlzp88.com" target="_blank">Ļַ</a>| <a href="http://117949b.com" target="_blank">99Ʒ</a>| <a href="http://400209.com" target="_blank">96ѾƷƵ߹ۿ</a>| <a href="http://imqun.com" target="_blank">þֻƷ99</a>| <a href="http://tzkanglong.com" target="_blank">߳׽ˮAƬ </a>| <a href="http://tttui.com" target="_blank">˾Ʒ</a>| <a href="http://b7277.com" target="_blank">óۺ</a>| <a href="http://kk600700.com" target="_blank">mm1313޹ƷԿ</a>| <a href="http://140699.com" target="_blank">avպav߹ۿ</a>| <a href="http://mangshigas.com" target="_blank">ۺϾƷһҳ</a>| <a href="http://805ios.com" target="_blank">޾Ʒ456˳</a>| <a href="http://513net.com" target="_blank">˳վ߲</a>| <a href="http://lanoss.com" target="_blank">޹Ʒþ˰</a>| <a href="http://gnebs.com" target="_blank">޾ƷҳĻ</a>| <a href="http://bobostrong31.com" target="_blank">þ޹Ʒ</a>| <a href="http://acccx.com" target="_blank">޾ɫ߲</a>| <a href="http://adcbgy.com" target="_blank">Ʒһ</a>| <a href="http://doubaye.com" target="_blank">avƬ߹ۿ</a>| <a href="http://szzrjk.com" target="_blank">Ʒһ</a>| <a href="http://codecampo.com" target="_blank">޳av</a>| <a href="http://16lds.com" target="_blank">þþ뾫Ʒպý </a>| <a href="http://79909d.com" target="_blank">aaƵ</a>| <a href="http://acccx.com" target="_blank">VAۺVAVA</a>| <a href="http://qimiaodh.com" target="_blank"></a>| <a href="http://www-282555.com" target="_blank">þþƷA㽶</a>| <a href="http://zjjtejia.com" target="_blank">ۺɫɫ</a>| <a href="http://tbw77.com" target="_blank">ɫ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>