﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Jcat-随笔分类-Java</title><link>http://www.blogjava.net/Jcat/category/11843.html</link><description>宠辱不惊，闲看庭前花开花落～～</description><language>zh-cn</language><lastBuildDate>Mon, 07 Jan 2013 04:39:20 GMT</lastBuildDate><pubDate>Mon, 07 Jan 2013 04:39:20 GMT</pubDate><ttl>60</ttl><item><title>Groovy 修饰符</title><link>http://www.blogjava.net/Jcat/archive/2008/11/10/239638.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Mon, 10 Nov 2008 04:30:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2008/11/10/239638.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/239638.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2008/11/10/239638.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/239638.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/239638.html</trackback:ping><description><![CDATA[Groovy<font color="#0000ff">把最常用的东西都设置成default</font>了，经常可以省这省那的（比如括号、分号、public等）；又加上闭包，初学的时候，有些代码，一眼望去，都分不清是方法、是类、还是闭包。<br />这里先简单总结一下常用的修饰符。<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000"> jcat.bit.g<br /><br /></span><span style="COLOR: #008000">/*</span><span style="COLOR: #008000"><br />修饰符有三类：<br />1. static<br />2. 作用域：public(默认), private, protected.<br />3. 类型：def（默认，动态）, void（无类型，静态）, 其它常规静态类型<br /></span><span style="COLOR: #008000">*/</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> Test {<br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> def a_static_def </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">a_static_def</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> a_static </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">a_static</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"><br />    def a_def </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">a_def</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"><br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(strs) {<br />        println a_static_def<br />        println a_static<br /><br />        println t_static_def()<br />        println t_static()<br /><br /><br />        </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Test().with {<br />            println a_def<br /><br />            println t_public_def()<br />            println t_public()<br />            println t_def()<br />        }<br />    }<br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> def t_static_def() { </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> def = 可以返回任何类型，包括void</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_static_def</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> t_static() { </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 有其它修饰符可以省略def（<font color="#ff0000">默认public + def</font>）</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_static</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> def t_public_def() {<br />        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_public_def</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> t_public() { </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 默认def</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_public</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    def t_def() { </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 至少要有一个修饰符，所以这个def不能省略; 且默认public</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_def</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> t_static_void() {<br />        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">return "t_static_void"    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> cannot return an object from a method that returns "void"</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">    }<br />}</span></div><img src ="http://www.blogjava.net/Jcat/aggbug/239638.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2008-11-10 12:30 <a href="http://www.blogjava.net/Jcat/archive/2008/11/10/239638.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Groovy JDBC</title><link>http://www.blogjava.net/Jcat/archive/2008/11/07/239258.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Fri, 07 Nov 2008 07:02:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2008/11/07/239258.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/239258.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2008/11/07/239258.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/239258.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/239258.html</trackback:ping><description><![CDATA[
		<p>用JDBC操作数据库，对比一下Java和Groovy。<br /><br />环境：SQL Server 2000 （记得打补丁SP4，不然JDBC访问会报错）<br />JDBC Driver：msbase.jar，mssqlserver.jar，msutil.jar<br /><br />Java版<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #0000ff">package</span>
				<span style="COLOR: #000000"> jcat.bit.java;<br /><br /></span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> java.sql.</span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">;<br /><br /></span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> JDBC {<br />    </span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">static</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> main(String[] args) </span>
				<span style="COLOR: #0000ff">throws</span>
				<span style="COLOR: #000000"> <font style="BACKGROUND-COLOR: #ffc0cb">ClassNotFoundException, SQLException</font> {<br />        Class.forName(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">com.microsoft.jdbc.sqlserver.SQLServerDriver</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">);<br />        Connection conn </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> DriverManager.getConnection(<br />                </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">,<br />                </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">sa</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">"***</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">);<br /><br />        Statement stmt </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> conn.createStatement();<br />        ResultSet rs </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> stmt.executeQuery(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">select top 10 * from authors</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">);<br /><br />       <font style="BACKGROUND-COLOR: #ffff00"> </font></span>
				<span style="COLOR: #0000ff">
						<font style="BACKGROUND-COLOR: #ffff00">while</font>
				</span>
				<font style="BACKGROUND-COLOR: #ffff00">
						<span style="COLOR: #000000"> (rs.next()) {<br />            System.out.println(rs.getString(</span>
						<span style="COLOR: #000000">
								<strong>2</strong>
						</span>
						<span style="COLOR: #000000">)</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">"</span>
						<span style="COLOR: #000000">+</span>
						<span style="COLOR: #000000">rs.getString(</span>
						<span style="COLOR: #000000">
								<strong>3</strong>
						</span>
				</font>
				<span style="COLOR: #000000">
						<font style="BACKGROUND-COLOR: #ffff00">));  <font style="BACKGROUND-COLOR: #9acd32">// 数id</font><br />        }</font>
						<br />
						<br />        <font style="BACKGROUND-COLOR: #ffc0cb">rs.close();<br />        stmt.close();<br />        conn.close();</font><br />    }<br />}<br /><br /></span>
		</div>
		<br />
		<br />Groovy版<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000"> jcat.bit.groovy<br /><br /></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> groovy.sql.Sql<br /><br /></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> JDBC {<br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(args) {<br />        Sql sql </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Sql.newInstance(<br />                </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,<br />                </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">sa</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">"***</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,<br />                </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">com.microsoft.jdbc.sqlserver.SQLServerDriver</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br />       <font style="BACKGROUND-COLOR: #ffff00" color="#000000"> sql.eachRow(</font></span><font color="#000000"><font style="BACKGROUND-COLOR: #ffff00"><span style="COLOR: #000000">"</span><span style="COLOR: #000000">select top 10 * from authors</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">) {row </span><span style="COLOR: #000000">-&gt;</span></font></font><span style="COLOR: #000000"><br /><font style="BACKGROUND-COLOR: #ffff00" color="#000000">            println row.<strong>au_fname</strong> </font></span><font color="#000000"><font style="BACKGROUND-COLOR: #ffff00"><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">+</span></font></font><span style="COLOR: #000000"><font style="BACKGROUND-COLOR: #ffff00" color="#000000"> row.<strong>au_lname</strong>    <font style="BACKGROUND-COLOR: #9acd32">//直接用数据库的字段名就可以操作结果集了，不用去数id<br /></font>        }</font><br />    }<br />}</span></div><br /><br />总结<br />1. 建立查询，差别不大，都是JDBC那一套；Groovy不用处理异常<br />2. 处理查询结果，Groovy因为有闭包，<font color="#ff0000">处理这些迭代问题很方便</font><br />3. Groovy不用关闭<img src ="http://www.blogjava.net/Jcat/aggbug/239258.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2008-11-07 15:02 <a href="http://www.blogjava.net/Jcat/archive/2008/11/07/239258.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Groovy Closure “操作”也成了参数</title><link>http://www.blogjava.net/Jcat/archive/2008/11/07/239142.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Thu, 06 Nov 2008 18:04:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2008/11/07/239142.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/239142.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2008/11/07/239142.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/239142.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/239142.html</trackback:ping><description><![CDATA[
		<p>
		</p>
		<p>1. 闭包代表（定义）了一段代码（操作）：光看这一句，其实方法也能实现相同的功能呀。<br /><font color="#ff0000">2. 闭包可以作为方法的参数：这才是闭包的特殊之处和真正意义。<br /><br /></font><font color="#808080"><br />下面演示一个只有闭包能做，方法做不到的例子。<br /></font><br />方法的作用是提炼共性，再代之以不同的参数。即对不同的“数据”进行相同的“操作”。从3个loop可以看出：<br />    Comm1：相同的数据<br />    Comm2：相同的for循环<br />    Diff1：循环体内执行的操作不同</p>
		<p>Comm1很好搞定，参数aa就是提炼出的共性<br />Comm2看似是共性，却很难提炼，因为for循环和循环体内的操作实际是一个整体；Comm2被Diff1纠缠，3个loop是完全不同的3组操作，无法提炼。<br /><br /><font color="#ee82ee">比如，如果现在想要按照奇数循环，只能依次改动三个循环。</font>  </p>
		<table>
				<tbody>
						<tr>
								<td width="400">
										<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
												<span style="COLOR: #0000ff">int</span>
												<span style="COLOR: #000000">[] aa </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> [</span>
												<span style="COLOR: #000000">1</span>
												<span style="COLOR: #000000">, </span>
												<span style="COLOR: #000000">2</span>
												<span style="COLOR: #000000">, </span>
												<span style="COLOR: #000000">3</span>
												<span style="COLOR: #000000">, </span>
												<span style="COLOR: #000000">4</span>
												<span style="COLOR: #000000">, </span>
												<span style="COLOR: #000000">5</span>
												<span style="COLOR: #000000">, </span>
												<span style="COLOR: #000000">6</span>
												<span style="COLOR: #000000">]<br /><br /></span>
												<span style="COLOR: #008000">//</span>
												<span style="COLOR: #008000"> loop1</span>
												<span style="COLOR: #008000">
														<br />
												</span>
												<span style="COLOR: #0000ff">for</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #0000ff">int</span>
												<span style="COLOR: #000000"> i </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">0</span>
												<span style="COLOR: #000000">; i </span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> aa.length; i</span>
												<span style="COLOR: #000000">++</span>
												<span style="COLOR: #000000">) {<br />    println aa[i]<br />}<br /><br /></span>
												<span style="COLOR: #008000">//</span>
												<span style="COLOR: #008000"> loop2</span>
												<span style="COLOR: #008000">
														<br />
												</span>
												<span style="COLOR: #0000ff">for</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #0000ff">int</span>
												<span style="COLOR: #000000"> i </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">0</span>
												<span style="COLOR: #000000">; i </span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> aa.length; i</span>
												<span style="COLOR: #000000">++</span>
												<span style="COLOR: #000000">) {<br />    print aa[i]<br />}<br /><br /></span>
												<span style="COLOR: #008000">//</span>
												<span style="COLOR: #008000"> loop3</span>
												<span style="COLOR: #008000">
														<br />
												</span>
												<span style="COLOR: #0000ff">for</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #0000ff">int</span>
												<span style="COLOR: #000000"> i </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">0</span>
												<span style="COLOR: #000000">; i </span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> aa.length; i</span>
												<span style="COLOR: #000000">++</span>
												<span style="COLOR: #000000">) {<br />    print aa[i] </span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">'</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">'</span>
												<span style="COLOR: #000000">
														<br />}<br /></span>
										</div>
								</td>
								<td width="400">
										<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
												<span style="COLOR: #000000">        <br /><br /></span>
												<span style="COLOR: #008000">//</span>
												<span style="COLOR: #008000"> loop1</span>
												<span style="COLOR: #008000">
														<br />
												</span>
												<span style="COLOR: #0000ff">for</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #0000ff">int</span>
												<span style="COLOR: #000000"> i </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">0</span>
												<span style="COLOR: #000000">; i </span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> aa.length; <font style="BACKGROUND-COLOR: #ffff00" color="#000000">i </font></span>
												<font color="#000000">
														<font style="BACKGROUND-COLOR: #ffff00">
																<span style="COLOR: #000000">+=</span>
																<span style="COLOR: #000000"> </span>
																<span style="COLOR: #000000">2</span>
														</font>
												</font>
												<span style="COLOR: #000000">) {<br />    println aa[i]<br />}<br /><br /></span>
												<span style="COLOR: #008000">//</span>
												<span style="COLOR: #008000"> loop2</span>
												<span style="COLOR: #008000">
														<br />
												</span>
												<span style="COLOR: #0000ff">for</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #0000ff">int</span>
												<span style="COLOR: #000000"> i </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">0</span>
												<span style="COLOR: #000000">; i </span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> aa.length; <font style="BACKGROUND-COLOR: #ffff00">i </font></span>
												<font style="BACKGROUND-COLOR: #ffff00">
														<span style="COLOR: #000000">+=</span>
														<span style="COLOR: #000000"> </span>
														<span style="COLOR: #000000">2</span>
												</font>
												<span style="COLOR: #000000">) {<br />    print aa[i]<br />}<br /><br /></span>
												<span style="COLOR: #008000">//</span>
												<span style="COLOR: #008000"> loop3</span>
												<span style="COLOR: #008000">
														<br />
												</span>
												<span style="COLOR: #0000ff">for</span>
												<span style="COLOR: #000000"> (</span>
												<span style="COLOR: #0000ff">int</span>
												<span style="COLOR: #000000"> i </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">0</span>
												<span style="COLOR: #000000">; i </span>
												<span style="COLOR: #000000">&lt;</span>
												<span style="COLOR: #000000"> aa.length; <font style="BACKGROUND-COLOR: #ffff00">i </font></span>
												<font style="BACKGROUND-COLOR: #ffff00">
														<span style="COLOR: #000000">+=</span>
														<span style="COLOR: #000000"> </span>
														<span style="COLOR: #000000">2</span>
												</font>
												<span style="COLOR: #000000">) {<br />    print aa[i] </span>
												<span style="COLOR: #000000">+</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">'</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #000000">'</span>
												<span style="COLOR: #000000">
														<br />}<br /></span>
										</div>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<br />下面我们看看闭包的强大之处，Comm1和Comm2都被很好的封装在了loop方法里；<font color="#ff0000">Diff1则作为参数（闭包）传入loop方法。<br /></font><br /><table><tbody><tr><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(String[] a) {<br />    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[] aa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> [</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">]<br /><br />    loop(aa) { println it }<br />    loop(aa) { print it }   <br />    loop(aa) { print it </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"> }<br />}</span></div></tr><tr>如果我们想要改变循环的方式，只需要改一处 
<td width="400"><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> loop(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[] aa, Closure c) {<br />    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> aa.length; i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">) {<br />        c.call(aa[i])<br />    }<br />    println </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"><br />}</span></div></td><td width="400"><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> loop(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[] aa, Closure c) {<br />    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> (</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">; i </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> aa.length; <font style="BACKGROUND-COLOR: #ff1493">i </font></span><font style="BACKGROUND-COLOR: #ff1493"><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">2</span></font><span style="COLOR: #000000">) {<br />        c.call(aa[i])<br />    }<br />    println </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"><br />}</span></div></td></tr></tbody></table><br /><font style="BACKGROUND-COLOR: #9acd32">总结，闭包本身并没什么难点，关键是怎样合理的设计一个接受Closure类型参数的方法。从GDK的方法也可以看出，大多数接受闭包的方法都是和数组迭代有关（也即循环）。</font><img src ="http://www.blogjava.net/Jcat/aggbug/239142.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2008-11-07 02:04 <a href="http://www.blogjava.net/Jcat/archive/2008/11/07/239142.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Groovy Closure</title><link>http://www.blogjava.net/Jcat/archive/2008/11/06/239095.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Thu, 06 Nov 2008 10:50:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2008/11/06/239095.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/239095.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2008/11/06/239095.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/239095.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/239095.html</trackback:ping><description><![CDATA[
		<p>Definition</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #008000">/*</span>
				<span style="COLOR: #008000">
						<br />        1. 变量是用来装“数据”的，闭包就是用来装“操作”的<br />        2. 和定义一个方法一样，闭包也可以有入参<br />       </span>
				<span style="COLOR: #008000">*/</span>
				<span style="COLOR: #000000">
						<br />        Closure p </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> {x </span>
				<span style="COLOR: #000000">-&gt;</span>
				<span style="COLOR: #000000">
						<br />            print x </span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">
						<br />        }<br />        [</span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">3</span>
				<span style="COLOR: #000000">].each(p)<br /><br />        [</span>
				<span style="COLOR: #000000">4</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">5</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">6</span>
				<span style="COLOR: #000000">].each({x </span>
				<span style="COLOR: #000000">-&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> 闭包是可以匿名的</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">            print x </span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">
						<br />        })<br /><br />        [</span>
				<span style="COLOR: #000000">7</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">8</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">9</span>
				<span style="COLOR: #000000">].each {x </span>
				<span style="COLOR: #000000">-&gt;</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> 括号是可以省略的</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">            print x </span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">
						<br />        }<br /><br />        [</span>
				<span style="COLOR: #000000">10</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">11</span>
				<span style="COLOR: #000000">, </span>
				<span style="COLOR: #000000">12</span>
				<span style="COLOR: #000000">].each { </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> it是默认的参数名字，所以这里连入参的定义都省了</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">            print it </span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">'</span>
				<span style="COLOR: #000000">
						<br />        }</span>
		</div>
		<br />
		<br />Using<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000"> jcat.bit<br /><br /></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> Test {<br />    </span><span style="COLOR: #008000">/*</span><span style="COLOR: #008000"><br />    1. 闭包是对象，是Closure类的实例，所以：<br />        1）可以在类里定义Closure类型的属性<br />        2）可以在方法里定义Closure类型的变量<br />        3）可以定义一个方法，接收Closure类型的参数<br />    2. 闭包又有方法特质，毕竟它装的是“操作”，甚至可以像调用方法一样调用闭包<br />     </span><span style="COLOR: #008000">*/</span><span style="COLOR: #000000"><br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">final</span><span style="COLOR: #000000"> Closure PRINT_STR </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> {  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 属性（类变量）</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">        println it<br />    }<br /><br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(String[] a) {<br />        </span><span style="COLOR: #008000">/*</span><span style="COLOR: #008000"><br />        闭包类似Java的内部类，区别是闭包只有单一的方法可以调用，但可以有任意的参数，<br />        闭包用“{}”括起，“-&gt;”前面是参数，后面是处理语句，可以直接调用，也可以使<br />        用call调用。不管那种调用，最后groovy编译器都会把编译成对doCall方法的调用，<br />        这是groovy对闭包的一个隐藏方法。<br />         </span><span style="COLOR: #008000">*/</span><span style="COLOR: #000000"><br />        PRINT_STR(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">像方法一样调用</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br />        PRINT_STR.call(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">作为Closure的实例，再调用相应的方法</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br /><br /><br />        Closure printLength </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> {String s </span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 局部变量</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">            println s.length()<br />        }<br />        printLength(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">AAA</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br /><br />        </span><span style="COLOR: #008000">/*</span><span style="COLOR: #008000"><br />        通常，操作是死的，我们能动态代入的是“数据”。<br />        闭包使得我们可以动态的代入一段“操作”。<br />        “闭包是可以用作方法参数的代码块。”<br />         </span><span style="COLOR: #008000">*/</span><span style="COLOR: #000000"><br />        closureAsParameter(</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">, printLength)<br />        closureAsParameter(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">BBB</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, PRINT_STR)<br />    }<br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> closureAsParameter(String s, Closure c) {<br />        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (s </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">) {<br />            c.call(s)<br />        }<br />    }<br />}</span></div><br /><br /><br />-----------------------------------------------------------------<br />附上一个Java的匿名内部类的例子，用来和闭包对比一下。<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000"> jcat.bit;<br /><br /></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> AnonymousInnerClass {<br />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(String[] args) {<br />        AbsClass a </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> AbsClass() {<br />            </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> foo(String s) {<br />                System.out.println(s);<br />            }<br />        };<br /><br />        a.foo(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ABC</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><br />        AbsClass b </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> AbsClass() {<br />            </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> foo(String s) {<br />                System.out.println(s.length());<br />            }<br />        };<br />        b.foo(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">ABC</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />    }<br />}<br /><br /></span><span style="COLOR: #0000ff">abstract</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> AbsClass {<br />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">abstract</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> foo(String s);<br />}<br /></span></div><img src ="http://www.blogjava.net/Jcat/aggbug/239095.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2008-11-06 18:50 <a href="http://www.blogjava.net/Jcat/archive/2008/11/06/239095.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hello Grails</title><link>http://www.blogjava.net/Jcat/archive/2008/11/04/238710.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Tue, 04 Nov 2008 14:04:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2008/11/04/238710.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/238710.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2008/11/04/238710.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/238710.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/238710.html</trackback:ping><description><![CDATA[最近BI的项目不忙，抽空怀念了一下编程技术：<br /><br />1. &lt;Flex 3&gt; 同事给了我份Flex的教程，把前三章看了一下，有了初步的了解；FlexBuilder也用了一把，不错，效果很绚丽。<br /><br />2. &lt;IDEA 8&gt; 恰逢IDEA 8 EAP (Early Access Preview)发布，搞了一个装上试试。主要试了试对Flex的支持，感觉还有待提升。另外IDEA对内存的消耗似乎越来越多了，没做深入体验。<br /><br />3. &lt;Grails 1.0.3&gt; 拿出了小二去年送我的生日礼物《Grails权威指南》，翻了翻，Hello World一会就做好了。打算再进一步体验一下。<br /><img src ="http://www.blogjava.net/Jcat/aggbug/238710.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2008-11-04 22:04 <a href="http://www.blogjava.net/Jcat/archive/2008/11/04/238710.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java foundation</title><link>http://www.blogjava.net/Jcat/archive/2007/05/23/119499.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Wed, 23 May 2007 14:35:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2007/05/23/119499.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/119499.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2007/05/23/119499.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/119499.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/119499.html</trackback:ping><description><![CDATA[---String---<br /><br /><b>equals in String</b><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">boolean</span><span style="color: rgb(0, 0, 0);"> equals(Object anObject) {<br />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> anObject) {<br />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (anObject </span><span style="color: rgb(0, 0, 255);">instanceof</span><span style="color: rgb(0, 0, 0);"> String) {<br />        String anotherString </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (String)anObject;<br />        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> n </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> count;<br />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (n </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> anotherString.count) {<br />        </span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);"> v1[] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> value;<br />        </span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);"> v2[] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> anotherString.value;<br />        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> offset;<br />        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> j </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> anotherString.offset;<br />        </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);"> (n</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) {<br />            </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (v1[i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> v2[j</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">])<br />            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">;<br />        }<br />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br />        }<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">;<br />    }</span></div><br /><b>equals in Object</b><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">   </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">boolean</span><span style="color: rgb(0, 0, 0);"> equals(Object obj) {<br />    </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> obj);<br />    }</span></div><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">    System.out.println(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">aa</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">).equals(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">aa</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">))); </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">true</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">    System.out.println(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">aa</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">aa</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));      </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">false</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">    System.out.println(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">aa</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">.equals(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">aa</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));                         </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">true</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">    System.out.println(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">aa</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">aa</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);                              </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">true</span></div><br /><img src ="http://www.blogjava.net/Jcat/aggbug/119499.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2007-05-23 22:35 <a href="http://www.blogjava.net/Jcat/archive/2007/05/23/119499.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>environment variable for java, groovy, ant and etc.</title><link>http://www.blogjava.net/Jcat/archive/2007/05/23/119491.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Wed, 23 May 2007 13:39:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2007/05/23/119491.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/119491.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2007/05/23/119491.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/119491.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/119491.html</trackback:ping><description><![CDATA[
		<font color="#ff0000">JAVA_HOME</font>
		<br />
		<font color="#000080">
		</font>
		<br />
		<font color="#008000">ANT_HOME</font>
		<br />
		<br />
		<font color="#ffa500">CATALINA_HOME</font>
		<br />
		<br />
		<font color="#0000ff">GROOVY_HOME</font>
		<br />
		<br />
		<font color="#000080">GRAILS_HOME</font>
		<br />
		<br />classpath=<font color="#0000ff"><font color="#000000">.<font color="#ff0000"><br /><font color="#808080">(%JAVA_HOME%\jre\lib is not required)</font></font></font></font><br /><br />Path=<font color="#ff0000">%JAVA_HOME%\bin</font>;<font color="#008000">%ANT_HOME%\bin<font color="#000000">;</font><font color="#ffa500">%CATALINA_HOME%\bin<font color="#000000">;</font></font></font><font color="#0000ff">%GROOVY_HOME%\bin</font>;<font color="#000080">%GRAILS_HOME%\bin</font><br /><font color="#008000"><font color="#ffa500"><br /><br /></font></font><font color="#0000ff"><font color="#000000">Note: if you add</font> %GROOVY_HOME%\embeddable\groovy-all-1.0.jar <font color="#000000">to classpath Grails can't work correctly.</font></font><img src ="http://www.blogjava.net/Jcat/aggbug/119491.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2007-05-23 21:39 <a href="http://www.blogjava.net/Jcat/archive/2007/05/23/119491.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts</title><link>http://www.blogjava.net/Jcat/archive/2007/04/08/109284.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Sun, 08 Apr 2007 15:47:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2007/04/08/109284.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/109284.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2007/04/08/109284.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/109284.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/109284.html</trackback:ping><description><![CDATA[<span style="color: #a0b8ff;">struts用了也一年了，基本的东西都会用，不过因为是在工作中边学边用，难免很多知识点都不系统，惭愧呀。这几天找本书梳理一下。</span><br><br>---MVC---<br>V：多种视图共享一个后台模型<br>M：实现与界面独立，良好的封装<br>C：更好的维护程序流程<br><br>model1：JSP（V、C）+JavaBean（M）<br>只适用于小型程序，JSP的双重角色使HTML和Java混合，很难维护。<br><br>model2：JSP(V)+Servlet(C)+JavaBean(M)<br>Struts也是model2（用ActionServlet代替Servlet）。Struts的所有功能都是建立在已有的Java Web组件上，如Servlet，JSP，JavaBean，它只是利用一种方式将这些元素组织了起来，使它们协同工作。<br><br>---点滴---<br>在Struts应用程序中，所有的用户请求都由ActionServlet接收，然后根据struts-config.xml查找相应的子控制器。Web容器加载Struts应用程序后，struts-config.xml被首先读入内存成为一个ActionMapping对象。<br><br>基本流程：HttpRequest--&gt;XxxForm--&gt;validate()=true--&gt;XxxAction--&gt;execute()--&gt;(return) ActionForward--&gt;JSP<br><span style="color: #b0b5ff;">这其中的配置信息都存在于struts-config中<br><br><span style="color: #000000;">国际化：&lt;bean:message key=""/&gt; + ApplicationResources.properties<br><br>---web.xml---<br>&lt;display-name&gt;&nbsp;&nbsp;&nbsp; ApplicationContext name<br>&lt;listener&gt;&nbsp;&nbsp; 配置事件监听器<br>&lt;session-config&gt; --&gt;&nbsp; &lt;session-timeout&gt;  &nbsp;&nbsp;  Session过期时间<br>&lt;welcome-file-list&gt;&nbsp;&nbsp;  根URL的默认页面：先找index文件，找不到再查找该list<br>&lt;error-page&gt;&nbsp;&nbsp;  &nbsp; 制定在返回特定HTTP状态码，或者特定类型的异常被抛出时显示的页面。<br>&lt;taglib&gt; &nbsp;&nbsp;  对标记库描述符文件（Tag Library Descriptor File）指定别名<br><br>---struts-config.xml---<br>&lt;data-source&gt;&nbsp;&nbsp;  定义数据源<br>&lt;global-exceptions&gt;&nbsp;&nbsp;  定义全局异常<br>&lt;global-forwards&gt;&nbsp;&nbsp;  &nbsp;&nbsp; 定义全局转发（名字相同时，局部转发优先）<br>&lt;controller&gt;&nbsp;&nbsp;  &nbsp;&nbsp; 定义控制配置类，如TilesRequestProcessor<br>&lt;message-resources&gt;&nbsp;&nbsp;  指定消息资源文件，配合&lt;bean:message key="" bundle=""&gt;使用<br>&lt;plug-in&gt;&nbsp;&nbsp;  &nbsp;&nbsp;  插件<br><br>---Action们---<br>Action：线程安全的，所以都是singlon的。不应该在Action类中使用域变量保存用户特定信息，如状态信息（可以将一些与特定请求无关的变量定义为域变量，如Log变量）<br>ActionForward：可以是静态的从config文件中读，如mapping.findForward("success")；也可以是动态的指定，如new ActionForward("success","/aaa/bbb.jsp",true)<br><br>预定义的Action<br>&nbsp;<span style="font-weight: bold;">ForwardAction</span>：类似&lt;jsp:forward&gt;<br>&nbsp;<span style="font-weight: bold;">IncludeAction</span>：类似&lt;jsp:include&gt;<br>&nbsp; 以上两个Action，使Struts遵循MVC，避免直接调用JSP，可以充分利用控制器的预处理功能。&nbsp;<br>&nbsp;<span style="font-weight: bold;">DispatchAction</span>：以资源为中心，减少Action的数量。<br>&nbsp; 通常可设置parameter="method"，则调用的url为http://xxx/yyy?method=add<br>&nbsp; 也可以设置parameter="add, update"，则调用的url为http://xxx/yyy?add=true<br>&nbsp;<span style="font-weight: bold;">LookupDispatchAction</span>：DispatchAction的子类，通过反查资源绑定，找到类中对应的方法。<br>&nbsp;<span style="font-weight: bold;">SwitchAction</span>：Struts支持多应用程序模块（即multi-module），SwitchAction用来执行在不同应用程序模块间的切换操作。<br></span></span>       <img src ="http://www.blogjava.net/Jcat/aggbug/109284.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2007-04-08 23:47 <a href="http://www.blogjava.net/Jcat/archive/2007/04/08/109284.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Apache vs Tomcat</title><link>http://www.blogjava.net/Jcat/archive/2007/03/06/102262.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Tue, 06 Mar 2007 13:00:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2007/03/06/102262.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/102262.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2007/03/06/102262.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/102262.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/102262.html</trackback:ping><description><![CDATA[
		<b>本质区别</b>：<br />1）<br />apache支持静态页面；<br />tomcat支持动态页面，比如servlet等。<br />2）<br />apache是web（http）服务器，它是专门用于提供HTTP服务，以及相关配置的（例如虚拟主机、URL转发等等）<br />tomcat是应用（java）服务器，它只是一个servlet（jsp）容器，可以认为是apache的扩展，但是可以独立于apache运行。<br />3）<br />apache是一辆卡车，上面可以装一些东西如html等。但是不能装水，要装水必须要有容器（桶），而这个桶也可以不放在卡车上。<br /><br /><b>使用区别</b>：<br />tomcat 作为 jsp，servlet 容器，虽然有静态解析功能，但性能上与 apache 相比相差很远。<br />apache 可以运行一年不重启，稳定性非常好，而 tomcat 则不见得。<br /><br /><b>整合</b>：<br />一般使用apache+tomcat的话，apache只是作为一个转发，对jsp的处理是由tomcat来处理的。<br /><br /><b>整合的好处是</b>：<br />如果客户端请求的是静态页面，则只需要Apache服务器响应请求，apache 解析 html 等静态网页非常快，是经过无数测试证明的。<br />如果客户端请求动态页面，则是Tomcat服务器响应请求。<br />因为jsp是服务器端解释代码的，这样整合就可以减少Tomcat的服务开销。 <br /><br /><b>其它</b>：<br />Tomcat是Apache组织在符合J2EE的JSP、Servlet标准下开发的一个JSP服务器<br /><br /><br /><font color="#808080">some official definitions:</font><br />What is the <font color="#ff0000">Apache HTTP Server</font>?<br />    * is a powerful, flexible, HTTP/1.1 compliant web server<br />    * implements the latest protocols, including HTTP/1.1 (RFC2616)<br />    * is highly configurable and extensible with third-party modules<br />    * can be customised by writing 'modules' using the Apache module API<br />    * provides full source code and comes with an unrestrictive license<br />    * runs on Windows 2003/XP/2000/NT/9x, Netware 5.x and above, OS/2, and most versions of Unix, as well as several other operating systems<br /><br />What is the <font color="#0000ff">Apache Tomcat</font>?<br />    Apache Tomcat is the servlet container that is used in the official Reference Implementation for the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed by Sun under the Java Community Process.<br />    Apache Tomcat is developed in an open and participatory environment and released under the Apache Software License. <br /><img src ="http://www.blogjava.net/Jcat/aggbug/102262.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2007-03-06 21:00 <a href="http://www.blogjava.net/Jcat/archive/2007/03/06/102262.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>input data from cmd</title><link>http://www.blogjava.net/Jcat/archive/2007/02/04/97871.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Sun, 04 Feb 2007 11:24:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2007/02/04/97871.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/97871.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2007/02/04/97871.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/97871.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/97871.html</trackback:ping><description><![CDATA[
		<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;">
				<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
				<span style="color: rgb(0, 0, 255);">import</span>
				<span style="color: rgb(0, 0, 0);"> java.io.InputStreamReader;<br /></span>
				<span style="color: rgb(0, 0, 255);">import</span>
				<span style="color: rgb(0, 0, 0);"> java.io.BufferedReader;<br /></span>
				<span style="color: rgb(0, 0, 255);">import</span>
				<span style="color: rgb(0, 0, 0);"> java.io.IOException;<br /><br /></span>
				<span style="color: rgb(0, 128, 0);">/**</span>
				<span style="color: rgb(0, 128, 0);">
						<br /> * User: Jcat<br /> * Date: 2006-11-19<br /> </span>
				<span style="color: rgb(0, 128, 0);">*/</span>
				<span style="color: rgb(0, 0, 0);">
						<br />
				</span>
				<span style="color: rgb(0, 0, 255);">public</span>
				<span style="color: rgb(0, 0, 0);"> </span>
				<span style="color: rgb(0, 0, 255);">class</span>
				<span style="color: rgb(0, 0, 0);"> Lab {<br />    </span>
				<span style="color: rgb(0, 0, 255);">public</span>
				<span style="color: rgb(0, 0, 0);"> </span>
				<span style="color: rgb(0, 0, 255);">static</span>
				<span style="color: rgb(0, 0, 0);"> </span>
				<span style="color: rgb(0, 0, 255);">void</span>
				<span style="color: rgb(0, 0, 0);"> main(String[] args) </span>
				<span style="color: rgb(0, 0, 255);">throws</span>
				<span style="color: rgb(0, 0, 0);"> IOException {<br />        InputStreamReader ir;<br />        BufferedReader in;<br />        String s;<br /><br />        ir </span>
				<span style="color: rgb(0, 0, 0);">=</span>
				<span style="color: rgb(0, 0, 0);"> </span>
				<span style="color: rgb(0, 0, 255);">new</span>
				<span style="color: rgb(0, 0, 0);"> InputStreamReader(System.in);<br />        in </span>
				<span style="color: rgb(0, 0, 0);">=</span>
				<span style="color: rgb(0, 0, 0);"> </span>
				<span style="color: rgb(0, 0, 255);">new</span>
				<span style="color: rgb(0, 0, 0);"> BufferedReader(ir);<br />        s </span>
				<span style="color: rgb(0, 0, 0);">=</span>
				<span style="color: rgb(0, 0, 0);"> in.readLine();<br />        System.out.println(s);<br />    }<br />}</span>
		</div>
		<br />
<img src ="http://www.blogjava.net/Jcat/aggbug/97871.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2007-02-04 19:24 <a href="http://www.blogjava.net/Jcat/archive/2007/02/04/97871.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>The ultimate webdesign usability checklist</title><link>http://www.blogjava.net/Jcat/archive/2007/01/25/95893.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Thu, 25 Jan 2007 04:39:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2007/01/25/95893.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/95893.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2007/01/25/95893.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/95893.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/95893.html</trackback:ping><description><![CDATA[
		<div class="itemtext">
				<p>I noticed that I, and fellow
webdesigners, keep making the same usability mistakes over and over.
This checklist with 88 questions is a must read for every webdesigner
who cares about usability.</p>
				<p>
This website, <a href="http://www.notusable.com/">NotUsable.com</a>, is not designed by me. Giving me the perfect excuse why this website doesn’t pass my own usability checklist. <img src="http://stud.cmd.hro.nl/0773253/notusable/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" />  But I would love to hear your comments and don’t forget to let me know when you can answer the whole checklist with ‘yes’!</p>
				<p>Note that my design company is called <a href="http://www.achtentachtig.com/">Achtentachtig</a>, which means Eighty Eight in Dutch, that’s why there are 88 questions in this checklist. Just to let you know. </p>
				<p>
						<strong>Enough talking, let’s start!</strong>
				</p>
				<ol>
						<p>
								<strong>Technical</strong>
						</p>
						<li>Did you validate your (X)HTML using <a href="http://validator.w3.org/">W3C Markup Validation Service</a>?</li>
						<li>Did you validate your CSS using <a href="http://jigsaw.w3.org/css-validator/">W3C CSS Validation Service</a>?</li>
						<li>Did you check your website in at least IE, FF, Opera and <a href="http://www.browsrcamp.com/">Safari</a>?</li>
						<p>
								<strong>Images</strong>
						</p>
						<li>Did you add the ALT and TITLE attributes to all your important images?</li>
						<li>Did you add the LONGDESC attributes to all your image that need a description?</li>
						<li>Did you write <a href="http://www.webcredible.co.uk/user-friendly-resources/web-accessibility/image-alt-text.shtml">effective ALT text</a>?
</li>
						<li>Did you make the <a href="http://webxact.watchfire.com/">size of your pages</a> less then 50KB?</li>
						<li>Did you choose the <a href="http://www.sitepoint.com/article/gif-jpg-png-whats-difference">appropriate filetype</a> for your images?</li>
						<li>Did you add a description to images that support your content?</li>
						<li>Did you use plain text instead of images for important content?</li>
						<p>
								<strong>Content</strong>
						</p>
						<li>Did you use a sans-serif typeface with a decent font size for your body text?</li>
						<li>Did you adjusted the leading and tracking, if necessary, to increase readability?</li>
						<li>Did you align your body text to the left? (depends on language)</li>
						<li>Did you use EM or percentages instead of PX?</li>
						<li>Did you make sure that there are no whole sentences in uppercase?</li>
						<li>Did you use less then 78 characters, including spaces, per line?</li>
						<li>Did you make brief and precise paragraphs with explanatory titles?</li>
						<li>Did you use lists to sum things up?</li>
						<li>Did you write your conclusion first and then your explanation?</li>
						<li>Did you <a href="http://www.markboulton.co.uk/journal/comments/five_simple_steps_to_designing_with_colour/">create enough contrast</a> between the text and the background?</li>
						<li>Did you make your website also accessible for <a href="http://www.delorie.com/web/lynxview.html">text-only browsers</a>?</li>
						<li>Did you make sure that there are no ‘under construction’ pages?</li>
						<li>Did you include a print function on pages with a large amount of text?</li>
						<li>Did you include a <a href="http://alistapart.com/articles/goingtoprint/">print stylesheet</a>?</li>
						<li>Did you replace all special characters with the ISO Latin-1 codes?</li>
						<li>Did you spell check your content and did you proofread for grammar errors??</li>
						<p>
								<strong>Navigation</strong>
						</p>
						<li>Did you make sure that all your links work? <a href="http://validator.w3.org/checklink">W3C Link checker</a> does the job.</li>
						<li>Did you include a link to all your main pages on your homepage?</li>
						<li>Did you include your main navigation on every page?</li>
						<li>Did you use no more then 8 items in your main navigation?</li>
						<li>Did you distinguish the active and nonactive page in the menu?</li>
						<li>Did you use self explanatory link text instead of ‘click here’?</li>
						<li>Did you use self explanatory link text instead of business terms?</li>
						<li>Did you make a distinction between visited and non-visited links?</li>
						<li>Did you make a distinction between links and plain text?</li>
						<li>Did you add the <a href="http://www.w3.org/TR/html401/struct/global.html#adef-title">TITLE attribute</a> to all your links?</li>
						<li>Did you use breadcrumbs if you have a large amount of pages?</li>
						<li>Did you include a search option if you have a large amount of pages?</li>
						<li>Did you make your logo link to your homepage?</li>
						<li>Did you make a skip to content link at the top of your pages?</li>
						<li>Did you make a skip to menu link at the top of your pages?</li>
						<li>Did you make it possible to browse your website using SHIFT-TAB and RETURN?</li>
						<li>Did you make sure you didn’t use any javascript links?</li>
						<p>
								<strong>Structure</strong>
						</p>
						<li>Did you make a consistent page structure?</li>
						<li>Did you place your logo at the top left?</li>
						<li>Did you place an explanatory tag line next to your logo?</li>
						<li>Did you place your search box at the top right?</li>
						<li>Did you place important content <a href="http://en.wikipedia.org/wiki/Above_the_fold">above the fold/scroll</a>?</li>
						<li>Did you make your <a href="http://www.markboulton.co.uk/journal/comments/five_simple_steps_to_designing_grid_systems_part_1/">design on a grid system</a>?</li>
						<li>Did you make your design fluid using percentages?</li>
						<li>Did you make your website also viewable on low resolutions?</li>
						<li>Did you make custom titles (as in TITLE tag) for all your pages?</li>
						<p>
								<strong>Forms</strong>
						</p>
						<li>Did you make sure that users don’t return to an altered form after an error?</li>
						<li>Did you make a friendly and informative error page?</li>
						<li>Did you make a friendly ‘thank you’ page with a confirmation email?</li>
						<li>Did you add only a ’submit’ button and no ‘reset’ button?</li>
						<li>Did you tell the user what to expect after clicking the submit button?</li>
						<li>Did you split long forms up into multiply pages?</li>
						<li>Did you gave the user room to type?
</li>
						<li>Did you place an asterisk when a field is compulsatory?</li>
						<li>Did you keep the standard look of input fields that is generated by the browser?</li>
						<li>Did you create a logical order of asking information?</li>
						<li>Did you use double input fields for passwords only?</li>
						<li>Did you let the computer, not the user, handle information formatting?</li>
						<li>Did you make sure that users can fill in the entire form using the TAB key?</li>
						<li>Did you explain to the user why you ask certain information?</li>
						<li>Did you explain to the user what you are going to do with that information?</li>
						<li>Did you use <a href="http://particletree.com/features/degradable-ajax-form-validation/">realtime validation using AJAX</a>?</li>
						<li>Did you use the LABEL tag?</li>
						<li>Did you place the LABEL above the input field, instead of next to it?</li>
						<li>Did you choose the correct input type for different data?</li>
						<li>Did you make the top input field automatically active using <a href="http://www.java2s.com/Code/JavaScript/Form-Control/Focusaninputfield.htm">setfocus</a>?</li>
						<li>Did you destinguish the active field from non-active fields using <a href="http://www.htmldog.com/articles/suckerfish/focus/">input:focus?</a></li>
						<li>Did you use the <a href="http://www.w3.org/TR/html4/interact/forms.html#h-17.10">FIELDSET and LEGEND</a> entities when appropriate?</li>
						<li>Did you check if your forms also work with Javascript turned off?</li>
						<p>
								<strong>Multimedia</strong>
						</p>
						<li>Did you make sure that essential information/navigation is not made in Flash?</li>
						<li>Did you make sure that music and videoclips don’t start playing automatically?</li>
						<li>Did you make sure that music and videoclips can be turned off at any time?</li>
						<li>Did you inform the user about the size and length of your music and videoclips?</li>
						<p>
								<strong>Extra features</strong>
						</p>
						<li>Did you <a href="http://alistapart.com/articles/perfect404/">make a custom 404 page</a>?</li>
						<li>Did you make a site map?</li>
						<li>Did you <a href="http://www.petefreitag.com/item/465.cfm">make a rss feed</a>? (if you add content regularly)</li>
						<li>Did you make a high contrast version of your website?</li>
						<li>Did you make <a href="http://alistapart.com/articles/succeed">good looking URL’s</a> (like this one)?</li>
						<li>Did you make sure that there are no frames on your website?</li>
						<li>Did you make sure that there are no pop ups on your website?</li>
						<li>Did you make a contact form instead of just an email link?</li>
						<p>
								<strong>Any suggestions?</strong>
						</p>
						<li>Add number 88 by giving a comment on this post!</li>
				</ol>
				<a target="_blank" title="原文地址" href="http://stud.cmd.hro.nl/0773253/notusable/blog/the-ultimate-webdesign-usability-checklist">原文地址</a>
				<br />
				<br />
		</div>
<img src ="http://www.blogjava.net/Jcat/aggbug/95893.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2007-01-25 12:39 <a href="http://www.blogjava.net/Jcat/archive/2007/01/25/95893.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>online status indicator</title><link>http://www.blogjava.net/Jcat/archive/2006/12/20/88968.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Wed, 20 Dec 2006 01:34:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/12/20/88968.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/88968.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/12/20/88968.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/88968.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/88968.html</trackback:ping><description><![CDATA[
		<a href="http://imis.qq.com/webpresence/">QQ</a>                    
<img alt="jcat" src="http://wpa.qq.com/pa?p=1:100200529:5" border="0" />    <img alt="jcat" src="http://wpa.qq.com/pa?p=1:100200529:12" border="0" /><br /><br /><!--=================--><a href="http://cn.pingme.messenger.yahoo.com/">yahoo.cn</a>            
<a href="http://cn.pingme.messenger.yahoo.com/webchat/ajax_webchat.php?yid=run_li_82&amp;sig=8de07068e498cc27dbfbf5a0c0a0295b9ab801b2" target="_blank"><img alt="yahoo" src="http://opi.yahoo.com/online?u=run_li_82&amp;t=1&amp;l=cn" border="0" /></a><br /><br /><!--=================-->yahoo                 
<a href="ymsgr:sendIM?run_li_82"><img src="http://opi.yahoo.com/online?u=run_li_82&amp;m=g&amp;t=1&amp;l=us" border="0" /></a><br /><br /><!--=================--><a href="http://www.onlinestatus.org/">onlinestatus.msn</a>   <!-- Begin Online Status Indicator code --><!-- http://www.onlinestatus.org/ --><a href="http://osi.hshh.org:8088/message/msn/liranbit@hotmail.com"><img alt="MSN Online Status Indicator" onerror="this.onerror=null;this.src='http://osi.hshh.org/msnunknown.gif';" src="http://osi.hshh.org:8088/msn/liranbit@hotmail.com" align="absmiddle" border="0" /></a><!-- End Online Status Indicator code --><!-- Begin Online Status Indicator code --><!-- http://www.onlinestatus.org/ -->  
<a href="http://imstatus.msitgroup.co.uk:81/message/msn/liranbit@hotmail.com"><img alt="MSN Online Status Indicator" onerror="this.onerror=null;this.src='http://imstatus.msitgroup.co.uk:81/image/msnunknown.gif';" src="http://imstatus.msitgroup.co.uk:81/msn/liranbit@hotmail.com" align="absmiddle" border="0" /></a>  <!-- End Online Status Indicator code --><!-- Begin Online Status Indicator code --><!-- http://www.onlinestatus.org/ --><a href="http://osi.lishmirror.com:81/message/msn/liranbit@hotmail.com"><img alt="MSN Online Status Indicator" onerror="this.onerror=null;this.src='http://osi.lishmirror.com:81/image/msnunknown.gif';" src="http://osi.lishmirror.com:81/msn/liranbit@hotmail.com" align="absmiddle" border="0" /></a><br /><br /><br />关于msn，似乎还没有找到官方的服务（垃圾微软），第三方提供的服务总是不太稳定<br /><!-- End Online Status Indicator code --><img src ="http://www.blogjava.net/Jcat/aggbug/88968.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-12-20 09:34 <a href="http://www.blogjava.net/Jcat/archive/2006/12/20/88968.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一些页面自动跳转的实现</title><link>http://www.blogjava.net/Jcat/archive/2006/11/22/82831.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Wed, 22 Nov 2006 09:20:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/11/22/82831.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/82831.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/11/22/82831.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/82831.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/82831.html</trackback:ping><description><![CDATA[
		<div>功能：5秒后，自动跳转到同目录下的02view.html文件</div>
		<div> </div>
		<div>1）html的实现<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">meta </span><span style="color: rgb(255, 0, 0);">http-equiv</span><span style="color: rgb(0, 0, 255);">="refresh"</span><span style="color: rgb(255, 0, 0);"> content</span><span style="color: rgb(0, 0, 255);">="5;url=02view.html"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />优点：简单<br />缺点：Struts Tiles中无法使用</div>
		<div> </div>
		<div>2）javascript的实现<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">language</span><span style="color: rgb(0, 0, 255);">="javascript"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span id="Codehighlighter1_53_114_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br />   setTimeout(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">javascript:location.href='02view.html'</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">, </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">5000</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">); <br /></span></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />优点：灵活，可以结合更多的其他功能<br />缺点：受到不同浏览器的影响</div>
		<div> </div>
		<div>3）结合了倒数的javascript实现（IE）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">span </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="totalSecond"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">span</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">language</span><span style="color: rgb(0, 0, 255);">="javascript"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br /></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">var</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> second </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> totalSecond.innerText;<br />setInterval(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">redirect()</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">, </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1000</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">);<br /></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">function</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> redirect(){ <br />totalSecond.innerText</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=--</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">second; <br /></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">if</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(second</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">&lt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">) location.href</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">'02view.html';<br />}<br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />优点：更人性化<br />缺点：firefox不支持（firefox不支持span、div等的innerText属性）</div>
		<div> </div>
		<div>3'）结合了倒数的javascript实现（firefox）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">language</span><span style="color: rgb(0, 0, 255);">="javascript"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br />    </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">var</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> second </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> document.getElementById('totalSecond').textContent;<br />    setInterval(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">redirect()</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">, </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1000</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">);<br />    </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">function</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> redirect()<br />    {<br />        document.getElementById('totalSecond').textContent </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">--</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">second;<br />        </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">if</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> (second </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">&lt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">) location.href </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> '02view.html';<br />    }<br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br /></div>
		<div>4）解决Firefox不支持innerText的问题<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">span </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="totalSecond"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">span</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">language</span><span style="color: rgb(0, 0, 255);">="javascript"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br /></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">if</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(navigator.appName.indexOf(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">Explorer</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">) </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">&gt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">-</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">){<br />    document.getElementById('totalSecond').innerText </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">my text innerText</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br />} </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">else</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br />    document.getElementById('totalSecond').textContent </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">my text textContent</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br />}<br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br /></div>
		<div>5）整合3）和3'）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">span </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="totalSecond"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">span</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">language</span><span style="color: rgb(0, 0, 255);">="javascript"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br />    </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">var</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> second </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> document.getElementById('totalSecond').textContent;<br /><br />    </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">if</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> (navigator.appName.indexOf(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">Explorer</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">) </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">&gt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">-</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">)<br />    {<br />        second </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> document.getElementById('totalSecond').innerText;<br />    } </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">else</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br />    {<br />        second </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> document.getElementById('totalSecond').textContent;<br />    }<br /><br /><br />    setInterval(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">redirect()</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">, </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1000</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">);<br />    </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">function</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> redirect()<br />    {<br />        </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">if</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> (second </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">&lt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">)<br />        {<br />            location.href </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> '02view.html';<br />        } </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">else</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br />        {<br />            </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">if</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> (navigator.appName.indexOf(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">Explorer</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">) </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">&gt;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">-</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">)<br />            {<br />                document.getElementById('totalSecond').innerText </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> second</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">--</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br />            } </span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">else</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br />            {<br />                document.getElementById('totalSecond').textContent </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> second</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">--</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br />            }<br />        }<br />    }<br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span></div></div>
<img src ="http://www.blogjava.net/Jcat/aggbug/82831.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-11-22 17:20 <a href="http://www.blogjava.net/Jcat/archive/2006/11/22/82831.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>TAKE ALL'S FISH</title><link>http://www.blogjava.net/Jcat/archive/2006/08/12/63218.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Sat, 12 Aug 2006 07:28:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/08/12/63218.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/63218.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/08/12/63218.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/63218.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/63218.html</trackback:ping><description><![CDATA[
		<font color="#ff0000">吉祥三宝<a href="http://struts.apache.org/"><br /><br />http://struts.apache.org/</a><a href="http://www.springframework.org/"><br /><br />http://www.springframework.org/</a><br /><br /><a href="http://www.hibernate.org/">http://www.hibernate.org/</a><br /><br />Apache<br /><font color="#000000"><br /></font><a href="http://ant.apache.org/">http://ant.apache.org/</a><br /><font color="#000000">Apache <strong>Ant</strong> is a Java-based build tool. In theory, it is kind of like Make, but without Make's wrinkles.</font><br /></font>
		<a href="http://lucene.apache.org/">
				<br />http://lucene.apache.org/</a>
		<br />Apache <strong>Lucene</strong> is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform. <br /><br /><a href="http://jakarta.apache.org/commons/index.html">http://jakarta.apache.org/commons/index.html</a><br />The <strong>Commons</strong> is a Jakarta subproject focused on all aspects of reusable Java components. <br /><br /><a href="http://jakarta.apache.org/velocity/index.html">http://jakarta.apache.org/velocity/index.html</a><br /><strong>Velocity</strong> is a Java-based template engine. It permits anyone to use a simple yet powerful template language to reference objects defined in Java code.<br /><br /><font color="#ff0000">Sourceforge</font><br /><br /><a href="http://junit.sourceforge.net/">http://junit.sourceforge.net/</a><br /><strong>JUnit</strong> is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks. <br /><br /><a href="http://httpunit.sourceforge.net/">http://httpunit.sourceforge.net/</a><br /><strong>HttpUnit</strong> makes you easy  to be able to bypass the browser and access your site from a program. When combined with a framework such as JUnit, it is fairly easy to write tests that very quickly verify the functioning of a web site.<br /><br /><u><font color="#800080">http://dozer.sourceforge.net/<br /></font></u><strong>Dozer</strong> is a powerful, yet simple Java Bean to Java Bean mapper that recursively copies data from one object to another. Typically, these Java Beans will be of different complex types.<br /><br /><a href="http://xdoclet.sourceforge.net/xdoclet/index.html">http://xdoclet.sourceforge.net/xdoclet/index.html</a><br /><strong>XDoclet</strong> is an open source code generation engine. It enables Attribute-Oriented Programming for java. In short, this means that you can add more significance to your code by adding meta data (attributes) to your java sources. This is done in special JavaDoc tags. <br /><br /><a href="http://displaytag.sourceforge.net">http://displaytag.sourceforge.net</a><br />The <strong>display tag</strong> library is an open source suite of custom tags that provide high-level web presentation patterns which will work in an MVC model. Actually the display tag library can just... display tables! Give it a list of objects and it will handle column display, sorting, paging, cropping, grouping, exporting, smart linking and decoration of a table in a customizable XHTML style.<br /><br /><a href="http://cglib.sourceforge.net/">http://cglib.sourceforge.net/</a><br /><strong>cglib</strong> is a powerful, high performance and quality Code Generation Library, It is used to extend JAVA classes and implements interfaces at runtime.<br /><br /><font color="#ff0000">Others</font><br /><br /><a href="http://www.opensymphony.com/compass/">http://www.opensymphony.com/compass/</a><br /><strong>Compass</strong> is a first class open source Java Search Engine Framework, enabling the power of Search Engine semantics to your application stack decoratively. Built on top of the amazing Lucene Search Engine, Compass integrates seamlessly to popular development frameworks like Hibernate and Spring.<br /><br /><a href="http://www.opensymphony.com/quartz/">http://www.opensymphony.com/quartz/</a><br /><strong>Quartz</strong> is a full-featured, open source job scheduling system that can be integrated with, or used along side virtually any J2EE or J2SE application - from the smallest stand-alone application to the largest e-commerce system.<br /><br /><a href="http://groovy.codehaus.org/">http://groovy.codehaus.org/</a><br /><strong>Groovy</strong> is an agile dynamic language for the Java Platform with many features that are inspired by languages like Python, Ruby and Smalltalk, making them available to Java developers using a Java-like syntax.<br /><br /><a href="http://www.singularsys.com/jep/">http://www.singularsys.com/jep/</a><strong><br />JEP</strong> is a Java library for parsing and evaluating mathematical expressions. With this package you can allow your users to enter an arbitrary formula as a string, and instantly evaluate it. JEP supports user defined variables, constants, and functions. A number of common mathematical functions and constants are included.<br /><br /><a href="http://www.dom4j.org/dom4j">http://www.dom4j.org/<i><br /></i></a><strong>dom4j</strong> is an easy to use, open source library for working with XML, XPath and XSLT on the Java platform using the Java Collections Framework and with full support for DOM, SAX and JAXP. <br /><br /><a href="http://www.castor.org/">http://www.castor.org/</a><br /><strong>Castor</strong> is an Open Source data binding framework for Java. It's the shortest path between Java objects, XML documents and relational tables. Castor provides Java-to-XML binding, Java-to-SQL persistence, and more. <br /><img src ="http://www.blogjava.net/Jcat/aggbug/63218.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-08-12 15:28 <a href="http://www.blogjava.net/Jcat/archive/2006/08/12/63218.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hello Velocity</title><link>http://www.blogjava.net/Jcat/archive/2006/08/08/62271.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Tue, 08 Aug 2006 00:21:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/08/08/62271.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/62271.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/08/08/62271.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/62271.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/62271.html</trackback:ping><description><![CDATA[
		<div>单行注释： ##your note<br />多行注释： #*your note*#<br /><br />不能直接访问对象的域，只能通过方法来访问。关于方法的调用，有两种变体（Velocity会帮你调用相应的方法）：<br />1）对于context中的Hashtable对象，可以直接用$hashtable.key来得到value，相当于$hashtable.get(key)<br />2）对于context中的JavaBean对象，可以直接用$javaBean.property来访问，相当于$javaBean.getProperty()<br /><br /><font color="#000000">安静引用符（Quiet Reference Notation）<font color="#ff0000">$!<br /></font>作用：当引用的变量为null时，将输出空字符串。（如果用$xxx，当null时，会输出字符串"$xxx"）<br /><br />双引号中的$xxx将仍然被解析；单引号中的$xxx将不被解析，输出字符串"$xxx"<br /><br />关于路径：<br />1. 为VelocityEngine指定velocityLoaderPath，该路径为存放vm文件的根目录（其下可以建子文件夹，无需另外指定）<br />2. 对vm的引用都是以velocityLoaderPath开始的绝对路径。比如：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000"> |-velocityLoaderPath<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />   |-a.vm<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />   |-B<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />     |-b.vm</span></div></font></div>在b.vm中引用a.vm：#parse("a.vm") 正确；  #parse("../a.vm") 错误<img src ="http://www.blogjava.net/Jcat/aggbug/62271.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-08-08 08:21 <a href="http://www.blogjava.net/Jcat/archive/2006/08/08/62271.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Doohickey</title><link>http://www.blogjava.net/Jcat/archive/2006/08/06/62009.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Sat, 05 Aug 2006 16:27:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/08/06/62009.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/62009.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/08/06/62009.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/62009.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/62009.html</trackback:ping><description><![CDATA[
		<p>
				<img height="19" src="http://www.blogjava.net/Emoticons/75_75.gif" width="19" border="0" />最后的逗号<br />String[] strs = {"1", "2", "3"<font color="#ff0000"><strong>, </strong></font>};<br />System.out.println(strs.length); //3<br /><br />这竟然是符合语法的！<br /><br />ArrayInitializer:       <br />{ [VariableInitializer {, VariableInitializer} [,]] }<br />VariableInitializer: ArrayInitializer Expression<br /><a class="ilink" href="http://java.sun.com/docs/books/jls/third_edition/html/syntax.html#18.1" target="_blank">http://java.sun.com/docs/books/jls/third_edition/html/syntax.html#18.1</a><br /><br /><span class="javascript" id="text179315">"This is good for quick testing. I always use this. In my case, I have a table, sometimes I care some columns, other times I care some other columns, so I am lazy to remove the last comma when I change columns. It's convenient."</span><br /><br /><br /><br /><img height="19" src="http://www.blogjava.net/Emoticons/75_75.gif" width="19" border="0" />运行没有main的java类<br /><span class="javascript" id="text163021">      通常我们需要在java类中添加main函数才能在命令行运行这个类，但是有一种（可以让你晕死的）方法可以让你在没有main的情况下也可以运行java class（当然不是用applet），代码如下：</span></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> NoMainMethod<br /><img id="Codehighlighter1_26_134_Open_Image" onclick="this.style.display='none'; Codehighlighter1_26_134_Open_Text.style.display='none'; Codehighlighter1_26_134_Closed_Image.style.display='inline'; Codehighlighter1_26_134_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_26_134_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_26_134_Closed_Text.style.display='none'; Codehighlighter1_26_134_Open_Image.style.display='inline'; Codehighlighter1_26_134_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_26_134_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">static</span>
						<span style="COLOR: #000000">
								<br />
								<img id="Codehighlighter1_43_132_Open_Image" onclick="this.style.display='none'; Codehighlighter1_43_132_Open_Text.style.display='none'; Codehighlighter1_43_132_Closed_Image.style.display='inline'; Codehighlighter1_43_132_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_43_132_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_43_132_Closed_Text.style.display='none'; Codehighlighter1_43_132_Open_Image.style.display='inline'; Codehighlighter1_43_132_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />
						</span>
						<span id="Codehighlighter1_43_132_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        System.out.println(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">Hello word, no main method!</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <font color="#ff0000">System.exit(</font></span>
								<span style="COLOR: #000000">
										<font color="#ff0000">0</font>
								</span>
								<span style="COLOR: #000000">
										<font color="#ff0000">);<br /></font>
										<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
		<p>      static语句块会在加载类的时候加载，它在main函数之前运行。 当static语句块运行完毕后，会寻找main函数，如果没有找到，就会抛出异常。但是在以上的代码中，static语句块执行后，我们终止程序的运行，所以异常就不会被抛出啦。<br /><br /><br /><img height="19" src="http://www.blogjava.net/Emoticons/75_75.gif" width="19" border="0" />跳出JavaBean的命名规范<br />      通常，JavaBean的命名规范为：属性名的第二个字母也不能大写。即不可以出现类似 aAndB 这样的属性名。如，Hibernate的PO如果出现这样的名字，将抛出net.sf.hibernate.PropertyNotFoundException异常。但是有一个办法可以解决该问题：<br /></p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">java file:     <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">private</span>
				<span style="COLOR: #000000"> String aAndB;   <br /><img id="Codehighlighter1_66_93_Open_Image" onclick="this.style.display='none'; Codehighlighter1_66_93_Open_Text.style.display='none'; Codehighlighter1_66_93_Closed_Image.style.display='inline'; Codehighlighter1_66_93_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_66_93_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_66_93_Closed_Text.style.display='none'; Codehighlighter1_66_93_Open_Image.style.display='inline'; Codehighlighter1_66_93_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> String get<font style="BACKGROUND-COLOR: #ffa500">A</font>AndB() </span>
				<span id="Codehighlighter1_66_93_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_66_93_Open_Text">
						<span style="COLOR: #000000">{        <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />         </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> aAndB;   <br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">   <br /><img id="Codehighlighter1_133_164_Open_Image" onclick="this.style.display='none'; Codehighlighter1_133_164_Open_Text.style.display='none'; Codehighlighter1_133_164_Closed_Image.style.display='inline'; Codehighlighter1_133_164_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_133_164_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_133_164_Closed_Text.style.display='none'; Codehighlighter1_133_164_Open_Image.style.display='inline'; Codehighlighter1_133_164_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">void</span>
				<span style="COLOR: #000000"> set<font style="BACKGROUND-COLOR: #ffa500">A</font>AndB(String aAndB) </span>
				<span id="Codehighlighter1_133_164_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_133_164_Open_Text">
						<span style="COLOR: #000000">{       <br /></span>
						<span style="COLOR: #0000ff">
								<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />         this</span>
						<span style="COLOR: #000000">.aAndB </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> aAndB;   <br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
		</div>
		<br />
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">mapping.xml</span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">property </span>
				<span style="COLOR: #ff0000">name</span>
				<span style="COLOR: #0000ff">="<font style="BACKGROUND-COLOR: #ffa500">A</font>AndB"</span>
				<span style="COLOR: #ff0000"> column</span>
				<span style="COLOR: #0000ff">="a_and_b"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
		</div>      结研究发现，上述办法可以成功的将aAndB这样的属性与数据库mapping起来。<br />      显然hibernate是通过setter和getter来访问对象的属性的，所以我们可以说：mapping.xml并不是在类的属性和数据库的字段名之间做映射，而是在setter/getter和数据库的字段之间做映射。<font color="red"><font color="#000000"><br /></font><font color="red">      诚然，即使可以也别这么干，实际工作中，还是规避这种问题的好。</font><font color="#000000"> </font><br /></font><br /><img src ="http://www.blogjava.net/Jcat/aggbug/62009.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-08-06 00:27 <a href="http://www.blogjava.net/Jcat/archive/2006/08/06/62009.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Read source code is a good way to learn anything!</title><link>http://www.blogjava.net/Jcat/archive/2006/08/03/61560.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Thu, 03 Aug 2006 10:43:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/08/03/61560.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/61560.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/08/03/61560.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/61560.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/61560.html</trackback:ping><description><![CDATA[
		<div>
				<img src="http://www.blogjava.net/Emoticons/emwink.gif" border="0" height="19" width="19" />Experience<br />To know how dose List.remove(Object) work, I do many test sample. But I still feel not very realizing. Finally, I took a look at souce code, and then I knew everything!<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img id="Codehighlighter1_32_364_Open_Image" onclick="this.style.display='none'; Codehighlighter1_32_364_Open_Text.style.display='none'; Codehighlighter1_32_364_Closed_Image.style.display='inline'; Codehighlighter1_32_364_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_32_364_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_32_364_Closed_Text.style.display='none'; Codehighlighter1_32_364_Open_Image.style.display='inline'; Codehighlighter1_32_364_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">boolean</span><span style="color: rgb(0, 0, 0);"> remove(Object o) </span><span id="Codehighlighter1_32_364_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img id="Codehighlighter1_50_192_Open_Image" onclick="this.style.display='none'; Codehighlighter1_50_192_Open_Text.style.display='none'; Codehighlighter1_50_192_Closed_Image.style.display='inline'; Codehighlighter1_50_192_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_50_192_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_50_192_Closed_Text.style.display='none'; Codehighlighter1_50_192_Open_Image.style.display='inline'; Codehighlighter1_50_192_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (o </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">) </span><span id="Codehighlighter1_50_192_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; index </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> size; index</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">)<br /><img id="Codehighlighter1_141_189_Open_Image" onclick="this.style.display='none'; Codehighlighter1_141_189_Open_Text.style.display='none'; Codehighlighter1_141_189_Closed_Image.style.display='inline'; Codehighlighter1_141_189_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_141_189_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_141_189_Closed_Text.style.display='none'; Codehighlighter1_141_189_Open_Image.style.display='inline'; Codehighlighter1_141_189_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (elementData[index] </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">) </span><span id="Codehighlighter1_141_189_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            fastRemove(index);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="color: rgb(0, 0, 0);"><br /><img id="Codehighlighter1_199_343_Open_Image" onclick="this.style.display='none'; Codehighlighter1_199_343_Open_Text.style.display='none'; Codehighlighter1_199_343_Closed_Image.style.display='inline'; Codehighlighter1_199_343_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_199_343_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_199_343_Closed_Text.style.display='none'; Codehighlighter1_199_343_Open_Image.style.display='inline'; Codehighlighter1_199_343_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    }</span></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> </span><span id="Codehighlighter1_199_343_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; index </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> size; index</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">)<br /><img id="Codehighlighter1_285_333_Open_Image" onclick="this.style.display='none'; Codehighlighter1_285_333_Open_Text.style.display='none'; Codehighlighter1_285_333_Closed_Image.style.display='inline'; Codehighlighter1_285_333_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_285_333_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_285_333_Closed_Text.style.display='none'; Codehighlighter1_285_333_Open_Image.style.display='inline'; Codehighlighter1_285_333_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (o.equals(elementData[index])) </span><span id="Codehighlighter1_285_333_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            fastRemove(index);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />    }</span></span></div>1. List store very object's reference but object's own.<br />2. remove(Object) will remove the first reference in List which refer to the object<br />3. If you want to change an object to a new index: <strong>back up it--&gt; remove it--&gt; re-add it<br /></strong><br /><img src="http://www.blogjava.net/Emoticons/emwink.gif" border="0" height="19" width="19" />Experience<br />I create a class to handle something annotated by Annotations. But it doesn't work. I found out it is returned false by <font color="#a52a2a">Class.getMethod().isAnnotationPresent(Todo.class)</font>. Finally, I got the reason by reading source code.<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">enum</span><span style="color: rgb(0, 0, 0);"> RetentionPolicy {<br />    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * Annotations are to be discarded by the compiler.<br />     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    SOURCE,<br /><br />    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * Annotations are to be recorded in the class file by the compiler<br />     * but need not be retained by the VM at run time.  <font color="#ff0000">This is the default</font><br />     * <font color="#ff0000">behavior</font>.<br />     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    CLASS,<br /><br />    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * Annotations are to be recorded in the class file by the compiler and<br />     * retained by the VM at run time, <font color="#ff0000">so they may be read reflectively</font>.<br />     *<br />     * </span><span style="color: rgb(128, 128, 128);">@see</span><span style="color: rgb(0, 128, 0);"> java.lang.reflect.AnnotatedElement<br />     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    RUNTIME<br />}</span></div><br /></div>
<img src ="http://www.blogjava.net/Jcat/aggbug/61560.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-08-03 18:43 <a href="http://www.blogjava.net/Jcat/archive/2006/08/03/61560.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>小错不断，大错不犯</title><link>http://www.blogjava.net/Jcat/archive/2006/07/25/59975.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Tue, 25 Jul 2006 05:11:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/07/25/59975.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/59975.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/07/25/59975.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/59975.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/59975.html</trackback:ping><description><![CDATA[症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：刚配置好struts，可是DispatchAction怎么都不工作（Action可以工作），也不报错<br />原因：只引入了struts自身的jar，看一看release中lib下，还有不少非struts的jar，可以猜想这些都是DispatchAction所需要的，而Action不需要（以前以为这些没用）。不报错让我很郁闷。<br /><br /><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：刚配置好struts，action可以工作了，就是不能正确的forward到jsp页面，execute中加断点，也不进入。<br />原因：execute有两个！！！<span style="font-weight: bold;">Http</span>ServletRequest vs ServletRequest，前者才是struts所使用的execute。<br /><br /><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：在web.xml里面设置好了<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">error-page</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">error-code</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">404</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">error-code</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">location</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">/404.jsp</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">location</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">error-page</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />但当出现<strong>404</strong>错误时，并没有显示404.jsp这一页，而是显示browser提供的error report page<br /><br />原因：在客户端浏览器如IE的internet选项高级属性中默认使用“友好的http错误信息”，这样会造成你的服务器是输出你所定义的错误页面，但到客户端被IE这混蛋给覆盖掉了。解决方案是你定义的错误页面的大小必须大于<strong><font color="#ff0000">512bytes</font></strong>，就不会被客户端设置所影响了。 <br /><br /><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：用hibernate访问数据库，可以insert，可以select，可以drop，就是不能<strong>update</strong>，而且没有任何错误消息<br /><br />原因：<br />&lt;class name="com.verican.base.model.CatalogPO" table="sys_catalog" mutable="<strong>false</strong>"&gt;设置成<strong><font color="#ff0000">true</font></strong>即可。<br />（当mutable＝false，却又执行update操作时，hibernate至少应该提供警告消息告知一下才对,可惜没有，所以很难发现）<br /><br /><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：<br />      Javascript弹出窗口时，如果用的是相对路径，形如javascript:void(window.open('<strong><font color="#0000ff">../../</font></strong>test.html'))，不同的浏览器的处理不同（因为js是浏览器处理的东西）。<br />      比如，不是部署在根目录下时（根目录下又建了一个目录）：在Firefox下，是以服务器为视角，则<font color="#0000ff"><strong>../../</strong></font>即可；而在IE下，则是以浏览器为视角，则需要多加一级，如<strong><font color="#0000ff">../../../</font></strong>。<br />            <br />解决：用绝对路径 javascript:void(window.open('http://www.verican.com/test.html'))；或者，用 &lt;a <strong><font color="#ff0000">target="_blank"</font></strong> href="../../test.html"&gt; （因为这是服务器处理的东西，所以不管部署在哪里，相对路径都是唯一确定的）<br /><br /><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：<br />刷新的时候 1）抛出ServletException<br />                     2）The page cannot be refreshed without resending the information, Click Retry to send the information again.<br /><br />原因：Struts中redirect设置问题（具体原理以后再研究）<br /><br />解决：一般的，forward到一个具体的page，redirect＝false；forward到另一个action，redirect＝true<br />           
<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">forward </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="add_item"</span><span style="color: rgb(255, 0, 0);"> path</span><span style="color: rgb(0, 0, 255);">="newsletter.add_item.page"</span><span style="color: rgb(255, 0, 0);"> redirect</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">forward </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="success"</span><span style="color: rgb(255, 0, 0);"> path</span><span style="color: rgb(0, 0, 255);">="/newsletter.do"</span><span style="color: rgb(255, 0, 0);"> redirect</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">/&gt;</span></div><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：<br /><p class="MsoNormal" style="margin: 0in 0in 0pt;">save a form <span style="font-family: Wingdings;"><span>--&gt;</span></span> forward to list page <span style="font-family: Wingdings;"><span>--&gt;</span></span> refresh <span style="font-family: Wingdings;"><span>--&gt;</span></span> retry <span style="font-family: Wingdings;"><span>--&gt; </span></span><span style="color: red;">save the form again (error)</span></p><br />原因：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">forward </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="list"</span><span style="color: rgb(255, 0, 0);"> path</span><span style="color: rgb(0, 0, 255);">="ticket.list.page"</span><span style="color: rgb(255, 0, 0);"> redirect</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">/&gt;</span></div><br />解决：一般的，从save一个表单后，应该forward到另一个action，且redirect＝true（而不是另一个page，即便当前action里有这个page）。这样可以保证不会通过刷新重复save数据。<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">forward </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="list"</span><span style="color: rgb(255, 0, 0);"> path</span><span style="color: rgb(0, 0, 255);">="ticket.do"</span><span style="color: rgb(255, 0, 0);"> redirect</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">/&gt;</span></div><br /><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：<br />      用Spring + Velocity发email，开始都好好的，也能现实图片，但当加入某一幅图片以后，无法正常显示（得到一个页面为空白的Email，虽然也有大小）。把图片从bmp换到jpg，再换到gif，未果。减小图片的尺寸、大小，未果。几乎都要绝望了～～～<br /><br />原因：<font color="#ff0000">NOTE: Invoke addInline after setText; else, mail readers might not be able to resolve inline references correctly.</font><font color="#000000">（这是Spring API里的原话，NND）<br /><br />感受：<br />      1.以前没写过发Email的程序，工作中用到了，照猫画虎拿过来就用，也没有仔细阅读文档，导致这次惨痛的教训。<br />      2.Spring中这部分设计的也有问题，它在两个表面上没什么关系的方法之间，建立了<font color="#ff1493">顺序上的依赖关系</font>。这使得出现这种情况时，没有任何线索。<br /><br /><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：<br />遍历List时，一调用remove就出错，（错误的）代码如下<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (Object o : list)<br /><img id="Codehighlighter1_30_68_Open_Image" onclick="this.style.display='none'; codehighlighter1_30_68_open_text.style.display=" none="" ;="" codehighlighter1_30_68_closed_image.style.display="'inline';" codehighlighter1_30_68_closed_text.style.display="'inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_30_68_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_30_68_closed_text.style.display=" none="" ;="" codehighlighter1_30_68_open_image.style.display="'inline';" codehighlighter1_30_68_open_text.style.display="'inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span><span id="Codehighlighter1_30_68_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            list.remove(o);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        }</span></span></div></font><br />原因：ConcurrentModificationException，有remove操作时，不能用foreach循环<br /><br />解决：用传统循环（看了传统还是很有用的）<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> list.size(); i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">)<br /><img id="Codehighlighter1_46_86_Open_Image" onclick="this.style.display='none'; codehighlighter1_46_86_open_text.style.display=" none="" ;="" codehighlighter1_46_86_closed_image.style.display="'inline';" codehighlighter1_46_86_closed_text.style.display="'inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_46_86_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_46_86_closed_text.style.display=" none="" ;="" codehighlighter1_46_86_open_image.style.display="'inline';" codehighlighter1_46_86_open_text.style.display="'inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span><span id="Codehighlighter1_46_86_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            list.remove(i</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        }</span></span></div>
注意remove过<strong><font color="#ff0000">后</font></strong>需要 <font color="#ff0000"><strong>i--  </strong></font><font color="#000000"><strong>(--i is wrong)<br /><br /><br /><br /></strong>症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">boolean</span><span style="color: rgb(0, 0, 0);"> b </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Integer(</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Integer(</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">false</span></div><div><br />原因：其实是很简单的问题，但是IDEA只会对String的 = = 做智能提示，注意即可。<br /><br /><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：<br />org.hibernate.MappingException: Could not read mappings from resource: jcat/learn/mapping.xml</div><div> </div><div>开始以为路径没写对，试验了N中路径的写发后，还是不行。后来才发现是因为mapping.xml是空的。</div><div> </div><div>解决：给mapping.xml加上一个空壳就可以了（好歹空壳不等于空）</div><div> </div><div><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;?</span><span style="color: rgb(255, 0, 255);">xml version="1.0" encoding="gb2312"</span><span style="color: rgb(0, 0, 255);">?&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;!</span><span style="color: rgb(255, 0, 255);">DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" </span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">hibernate-mapping </span><span style="color: rgb(255, 0, 0);">default-lazy</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">hibernate-mapping</span><span style="color: rgb(0, 0, 255);">&gt;</span></div></div><div> </div><div>NOTE：几种路径的写法<br />1. <strong>classpath:packagename/filename<br /></strong>例子：在applicationContext.xml中注册hibernate.cfg.xml<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">bean </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="GlobalHibernateSessionFactory"</span><span style="color: rgb(255, 0, 0);"> class</span><span style="color: rgb(0, 0, 255);">="org.springframework.orm.hibernate3.LocalSessionFactoryBean"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="dataSource"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">ref </span><span style="color: rgb(255, 0, 0);">local</span><span style="color: rgb(0, 0, 255);">="GlobalDataSource"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="configLocation"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">classpath:hibernate.cfg.xml</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">bean</span><span style="color: rgb(0, 0, 255);">&gt;</span></div></div><div><br />2. <strong>packagename/filename</strong><br />例子：在hibernate.cfg.xml中注册mapping.xml<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">mapping </span><span style="color: rgb(255, 0, 0);">resource</span><span style="color: rgb(0, 0, 255);">="jcat/learn/hibernate_in_spring/orm.xml"</span><span style="color: rgb(0, 0, 255);">/&gt;</span></div></div></font><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：提交表单程序，加入了上传文件的功能后，出现异常<br />java.lang.IllegalArgumentException: Cannot invoke com.verican.newsadmin.form.TicketForm.setUploadFile - <font color="#ff0000">argument type mismatch<br /><br /><font color="#000000">解决：将表单声明为<font color="#ffa500">mulptipart</font>类型</font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html:form </span><span style="color: rgb(255, 0, 0);">action</span><span style="color: rgb(0, 0, 255);">="/ticket"</span><span style="color: rgb(255, 0, 0);"> <strong><font color="#ffa500">enctype</font></strong></span><span style="color: rgb(0, 0, 255);"><strong><font color="#ffa500">="multipart/form-data"</font></strong></span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />         </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html:file </span><span style="color: rgb(255, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">="uploadFile"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">html:form</span><span style="color: rgb(0, 0, 255);">&gt;</span></div></font><br /><br /><br />症<img src="http://www.blogjava.net/Emoticons/QQ/god.gif" border="0" height="20" width="20" />状：IE cannot open the Internet site file: ....<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">span </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="TypeDes2"</span><span style="color: rgb(0, 0, 255);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img id="Codehighlighter1_110_155_Open_Image" onclick="this.style.display='none'; codehighlighter1_110_155_open_text.style.display=" none="" ;="" codehighlighter1_110_155_closed_image.style.display="'inline';" codehighlighter1_110_155_closed_text.style.display="'inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_110_155_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_110_155_closed_text.style.display=" none="" ;="" codehighlighter1_110_155_open_image.style.display="'inline';" codehighlighter1_110_155_open_text.style.display="'inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span id="Codehighlighter1_110_155_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_110_155_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />       TypeDes2.innerHTML </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">Test Span</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />    </span></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />解决：对于单标签，浏览器找不到innerHTML属性。改为双标签即可。<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">span </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="TypeDes2"</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">span</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><img src ="http://www.blogjava.net/Jcat/aggbug/59975.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-07-25 13:11 <a href="http://www.blogjava.net/Jcat/archive/2006/07/25/59975.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hello Hibernate</title><link>http://www.blogjava.net/Jcat/archive/2006/07/03/56338.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Mon, 03 Jul 2006 06:24:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/07/03/56338.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/56338.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/07/03/56338.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/56338.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/56338.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: center" align="center">
				<b style="mso-bidi-font-weight: normal">POJO principle<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:p></o:p></b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt">
				<o:p> </o:p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt">1. The class can not be <b style="mso-bidi-font-weight: normal">final<o:p></o:p></b></p>
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt">
				<o:p> </o:p>
		</p>
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt">2. Must implement <b style="mso-bidi-font-weight: normal">Serializable<o:p></o:p></b></p>
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt">
				<b style="mso-bidi-font-weight: normal">
						<o:p> </o:p>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt">3. Must contain a <b style="mso-bidi-font-weight: normal">non-argument constructor<o:p></o:p></b></p>
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt">
				<b style="mso-bidi-font-weight: normal">
						<o:p> </o:p>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt">4. The getter and setter must be <b style="mso-bidi-font-weight: normal">public</b></p>
		<p class="MsoNormal" style="MARGIN: 0in 0in 0pt">
				<o:p> </o:p>
		</p>
<img src ="http://www.blogjava.net/Jcat/aggbug/56338.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-07-03 14:24 <a href="http://www.blogjava.net/Jcat/archive/2006/07/03/56338.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Keymap in IntelliJ</title><link>http://www.blogjava.net/Jcat/archive/2006/06/26/55223.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Mon, 26 Jun 2006 13:26:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/06/26/55223.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/55223.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/06/26/55223.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/55223.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/55223.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Editing																																																																										Ctrl + Space																										Basic code completion (the name of any class, method or v...&nbsp;&nbsp;<a href='http://www.blogjava.net/Jcat/archive/2006/06/26/55223.html'>阅读全文</a><img src ="http://www.blogjava.net/Jcat/aggbug/55223.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-06-26 21:26 <a href="http://www.blogjava.net/Jcat/archive/2006/06/26/55223.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Some useful IntelliJ Plugin</title><link>http://www.blogjava.net/Jcat/archive/2006/06/24/54850.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Sat, 24 Jun 2006 05:01:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/06/24/54850.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/54850.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/06/24/54850.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/54850.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/54850.html</trackback:ping><description><![CDATA[
		<p>==must be installed==<br /><br /><strong>RegexPlugin<br /></strong><a href="http://www.intellij.org/twiki/bin/view/Main/RegexPlugin">http://www.intellij.org/twiki/bin/view/Main/RegexPlugin</a><br /><br /><strong>unitTest</strong>: better (and also bigger) than JunitGenerator<br /><br /><strong>CVS bar:</strong> VCS bar is too old<br /><br /><strong>SpellCheckPlugin<br /></strong><a href="http://www.intellij.org/twiki/bin/view/Main/SpellCheck">http://www.intellij.org/twiki/bin/view/Main/SpellCheck</a><br /><br /><strong>DBHelper: </strong>more powerful than  SQL Query Plugin. Maybe the latter will be removed after I am familiar with DBHelper.<br /><a href="http://ca.geocities.com/davidhuo2003/dbhelper.html">http://ca.geocities.com/davidhuo2003/dbhelper.html</a><br /><br /><strong>Rearranger: </strong>use it in canonical class, such as bean  <br /><a href="http://www.intellij.org/twiki/bin/view/Main/RearrangerPlugin">http://www.intellij.org/twiki/bin/view/Main/RearrangerPlugin</a><br /><br /><strong>simpleUML  <br /></strong><a href="http://www.intellij.org/twiki/bin/view/Main/SimpleUML">http://www.intellij.org/twiki/bin/view/Main/SimpleUML</a><br /><br /><strong>Key promoter: </strong>Shows to user how easy he can make same action using only keyboard <br /><br /><br />==good for using==<br /><br /><strong>IdeaMouseGestures:</strong> IdeaMouseGestures plugin provides easy way to assign Idea's menu items to mouse gestures. <br /><a href="http://www.smardec.com/products/idea.html">http://www.smardec.com/products/idea.html</a><br /><br /><strong>KonaWorks PowerPack</strong>: A new code action to easily insert an expression inside a string literal<br /><a href="http://www.konaworks.org/">http://www.konaworks.org/</a><br /><br /><strong>DragNDrop</strong>: This plugin will allow a user to drag and drop files into the main pane of IntelliJ <br /><br /><strong>Workspaces<br /></strong><a href="http://www.intellij.org/twiki/bin/view/Main/WorkspacesPlugin">http://www.intellij.org/twiki/bin/view/Main/WorkspacesPlugin</a><br /><br /><strong>RemoteTail</strong>: The plugin allows the user to view the content of a file which could be on a different computer. <br /><br /><strong>Jump to Usage</strong>: Simple plugin to make navigation to element usages easier than using Alt+F7.<br /><a href="http://sourceforge.net/projects/jumptousage">http://sourceforge.net/projects/jumptousage</a><br /><br /><strong>Library Finder: </strong>helps to find library files (.jar/.zip) for a "<font color="#ff0000">fully qualified</font>" class/resource name. <br /><a href="http://code.google.com/p/libraryfinder/">http://code.google.com/p/libraryfinder/</a><br /><br /><strong>IntelliLang</strong>: IntelliLang is a combination of three basic kinds of functionality that are meant to support the developer in dealing with certain tasks that relate to (custom) languages in IntelliJ IDEA.<br /><a href="http://www.jetbrains.net/confluence/display/CONTEST/IntelliLang">http://www.jetbrains.net/confluence/display/CONTEST/IntelliLang</a><br /><br /><strong>XPathView + XSLT-Support: </strong>required by IntelliLang<br /><a href="http://www.intellij.org/twiki/bin/view/Main/XPathViewPlugin">http://www.intellij.org/twiki/bin/view/Main/XPathViewPlugin</a><br /><br /><strong>Tabifier</strong>: The tabifier plugin retabs Java code so that syntactic elements are aligned vertically. <br /><a href="http://www.intellij.org/twiki/bin/view/Main/TabifierPlugin">http://www.intellij.org/twiki/bin/view/Main/TabifierPlugin</a><br /><br /><strong>Struts Assistant</strong>: it will conflict with Struts Plugin, so Struts Assistant is enough.<br /><a href="http://www.intellij.org/twiki/bin/view/Main/StrutsAssistant">http://www.intellij.org/twiki/bin/view/Main/StrutsAssistant</a><br /><br /><strong>IdeaSpring</strong>: Helpful to edit applicationContext.xml. But it is even a commercial one! So it has to be re-download every 15 days.<br /><br /><strong>XFile:</strong> defaul Changes is good enough, so maybe it will be removed later.<br /><a href="http://www.echologic.com/plugins/xfiles.html">http://www.echologic.com/plugins/xfiles.html</a><br /><br /><strong>UpperLowerCapitalize</strong>: just use the capticalize, since there is default upper/lower in IDEA<br /><a href="http://www.intellij.org/twiki/bin/view/Main/UpperLowerCapitalize">http://www.intellij.org/twiki/bin/view/Main/UpperLowerCapitalize</a><br /><br /><strong>IdeaJad</strong>: a popular decompiler <br /><a href="http://www.tagtraum.com/ideajad.html">http://www.tagtraum.com/ideajad.html</a><br /><br /><strong>SyncEdit:</strong> Remove the default shortcut "Tab" (for "Next SyncEditable Word"), since I need "Tab" work normally.<br /><br /><strong>World of Java<br /></strong><a href="http://www.worldofjava.org/">http://www.worldofjava.org/</a><br /><br /><strong>Scratch Pad: </strong>Additional editor tool window to hold pieces of code temporarily. No syntax colouring, intentions or error highlighting.<br /><a href="http://www.intellij.org/twiki/bin/view/Main/ScratchPadPlugin">http://www.intellij.org/twiki/bin/view/Main/ScratchPadPlugin</a><br /><br /><strong>HTML Preview</strong>: Provides preview for html files using Mozilla browser<br /><br /><br />==learning==<br /><br /><strong>TabSwitch</strong>: Open files/tabs switcher<br /><br /><strong>CVS Report for IntelliJ IDEA</strong>: CVS Report for IntelliJ IDEA is a free open source plugin for IntelliJ IDEA to generate statistical reports from your CVS repository. <br /><a href="http://vcsreport.sourceforge.net/">http://vcsreport.sourceforge.net/</a><br /><br /><strong>RssPlugin</strong>: RSS Plugin for viewing RSS feeds within IntelliJ. <br /><a href="http://www.intellij.org/twiki/bin/view/Main/RssPlugin">http://www.intellij.org/twiki/bin/view/Main/RssPlugin</a><br /><br /><strong>Hibernate Tools</strong>: better than hibero which is even a commercial one!<br /><br /><strong>Smart Introduce:</strong> how to use it?<br /><a href="http://www.intellij.org/twiki/bin/view/Main/SmartIntroducePlugin">http://www.intellij.org/twiki/bin/view/Main/SmartIntroducePlugin</a><br /><br /><strong>GroovyJ:</strong> hoping it can become more powerful<br /><a href="http://groovy.codehaus.org/IntelliJ+IDEA+Plugin">http://groovy.codehaus.org/IntelliJ+IDEA+Plugin</a><br /><br /><br />==not very useful, so can be ignore==<br /><br /><strong>Code Outline</strong>: Have not found anything useful  (dosen't work in IDEA 6.0)<br /><br /><strong>OpenContainingForder: </strong>Plugin for Viewing folders with Windows Explorer, but cannot open a folder. So "Alt+Shift+E" is better <br /><br /><strong>LineMover</strong>: default "Ctrl+Shift+Up/Down" is enough.<br /><br /><strong>SQL Query Plugin</strong>: DBHelper is good enough<br /><br /><strong>SQL script editor: </strong>DBHelper is good enough</p>
		<p>
				<b>JavaDoc Browser: </b>the window can't be big enough, so acutal browser (such as fire fox) is better.<br /></p>
		<p>
				<br />
				<br />BTW: if you have any good recommendation, welcome to share with us. </p>
<img src ="http://www.blogjava.net/Jcat/aggbug/54850.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-06-24 13:01 <a href="http://www.blogjava.net/Jcat/archive/2006/06/24/54850.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hello Tomcat</title><link>http://www.blogjava.net/Jcat/archive/2006/06/23/54606.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Fri, 23 Jun 2006 01:11:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/06/23/54606.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/54606.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/06/23/54606.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/54606.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/54606.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">1. Tomcat config file, where you can change Tomcat's port number: <span style="COLOR: blue">&lt;CATALINA_HOME&gt;/conf/server.xml</span></span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt"> <br /><br /></span>
		</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<font face="Tahoma">
						<span style="COLOR: #0000ff">&lt;</span>
						<span style="COLOR: #800000"> Host ...</span>
						<span style="COLOR: #ff0000"> </span>
						<span style="COLOR: #0000ff">&gt;</span>
				</font>
				<font face="Tahoma">
						<span style="COLOR: #000000"> <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />       ...<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />       </span>
						<span style="COLOR: #0000ff">&lt;</span>
						<span style="COLOR: #800000"> Context  </span>
						<span style="COLOR: #ff0000">path </span>
						<span style="COLOR: #0000ff">="/app1"</span>
						<span style="COLOR: #ff0000">  docBase </span>
						<span style="COLOR: #0000ff">="app1"</span>
						<span style="COLOR: #ff0000">  debug </span>
						<span style="COLOR: #0000ff">="0"</span>
						<span style="COLOR: #ff0000">  reloadable </span>
						<span style="COLOR: #0000ff">="true"</span>
						<span style="COLOR: #ff0000"> </span>
						<span style="COLOR: #0000ff">/&gt;</span>
				</font>
				<font face="Tahoma">
						<span style="COLOR: #000000"> <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />       </span>
						<span style="COLOR: #0000ff">&lt;</span>
						<span style="COLOR: #800000"> Context  </span>
						<span style="COLOR: #ff0000">path </span>
						<span style="COLOR: #0000ff">="/app2"</span>
						<span style="COLOR: #ff0000">  docBase </span>
						<span style="COLOR: #0000ff">="app2"</span>
						<span style="COLOR: #ff0000">  debug </span>
						<span style="COLOR: #0000ff">="0"</span>
						<span style="COLOR: #ff0000">  reloadable </span>
						<span style="COLOR: #0000ff">="true"</span>
						<span style="COLOR: #ff0000"> </span>
						<span style="COLOR: #0000ff">/&gt;</span>
				</font>
				<font face="Tahoma">
						<span style="COLOR: #000000"> <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />       </span>
						<span style="COLOR: #0000ff">&lt;</span>
						<span style="COLOR: #800000"> Context  </span>
						<span style="COLOR: #ff0000">path </span>
						<span style="COLOR: #0000ff">="<font color="#008000">root url</font>"</span>
						<span style="COLOR: #ff0000">  docBase </span>
						<span style="COLOR: #0000ff">="<font color="#008000">root dir (or the path of .war)</font>"</span>
						<span style="COLOR: #ff0000">  debug </span>
						<span style="COLOR: #0000ff">="0"</span>
						<span style="COLOR: #ff0000">  reloadable </span>
						<span style="COLOR: #0000ff">="<font color="#008000">note1</font>"</span>
						<span style="COLOR: #ff0000"> </span>
						<span style="COLOR: #0000ff">&gt;</span>
				</font>
				<font face="Tahoma">
						<span style="COLOR: #000000"> <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #0000ff">&lt; /</span>
						<span style="COLOR: #800000">Host </span>
						<span style="COLOR: #0000ff">&gt;</span>
				</font>
				<font face="Georgia"> <span style="COLOR: #000000"> </span></font>
				<font face="Courier New">
				</font>
		</div>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
				<br />
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">note1: whether auto-reload the web application, when .class file is changed<br />              1) during developing, set reloadable=true<br />              2) after deployment, set reloadable=false<br style="mso-special-character: line-break" /></span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
						<br />
						<br />
				</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">2. Some libs</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
				</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
						<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>
						<o:p>
						</o:p>
				</span>
		</p>
		<table class="MsoNormalTable" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; MARGIN: auto auto auto 1cm; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 191; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext" cellspacing="0" cellpadding="0" border="1">
				<tbody>
						<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
								<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 160.8pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt" valign="top" width="214">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">/server/lib </span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
												</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<o:p>
														</o:p>
												</span>
										</p>
								</td>
								<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ffffff; WIDTH: 180.6pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top" width="241">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">just for Tomcat</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
												</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<o:p>
														</o:p>
												</span>
										</p>
								</td>
						</tr>
						<tr style="mso-yfti-irow: 1">
								<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ffffff; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 160.8pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="214">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">/shared/lib</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
												</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<o:p>
														</o:p>
												</span>
										</p>
								</td>
								<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ffffff; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ffffff; WIDTH: 180.6pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="241">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">for all web apps</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
												</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<o:p>
														</o:p>
												</span>
										</p>
								</td>
						</tr>
						<tr style="mso-yfti-irow: 2">
								<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ffffff; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 160.8pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="214">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">/common/lib</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
												</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<o:p>
														</o:p>
												</span>
										</p>
								</td>
								<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ffffff; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ffffff; WIDTH: 180.6pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="241">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">both Tomcat and all web apps</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
												</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<o:p>
														</o:p>
												</span>
										</p>
								</td>
						</tr>
						<tr style="mso-yfti-irow: 3; mso-yfti-lastrow: yes">
								<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ffffff; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 160.8pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="214">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">/webapps/jcat/WEB-INF/lib</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
												</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<o:p>
														</o:p>
												</span>
										</p>
								</td>
								<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #ffffff; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #ffffff; WIDTH: 180.6pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="241">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
												<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">just present web app</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
												</span>
												<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
														<o:p>
														</o:p>
												</span>
										</p>
								</td>
						</tr>
				</tbody>
		</table>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">3. Immobile Directory Structure (the names are also immobile, include uppercase/lowercase)</span> <br /><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   /jcat<br /></span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   /jcat/WEB-INF<br /></span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   /jcat/WEB-INF/web.xml<br /></span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   /jcat/WEB-INF/classes<br /></span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   /jcat/WEB-INF/lib</span><span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt"></span><span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></span></p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
						<span style="mso-tab-count: 1">      </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 24pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Note:<span style="COLOR: #3366ff"> WEB-INF/classes</span></span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">is loaded by tomcat before </span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: #3366ff; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">WEB-INF/lib</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
				</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">, so classes has priority than lib</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Gulim; mso-bidi-font-family: 'Courier New'; mso-font-kerning: 0pt">
				</span>
				<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: #3366ff; FONT-FAMILY: Gulim; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Gulim">
						<o:p> </o:p>
						<br />4. Scopes<br /><font face="Times New Roman" size="2">      <strong>Application</strong>：在整个web应用程序内有效。对应于servelet中的ServletContext对象，Action中的获取：getServlet().getServletContext()<br /></font><font size="2"><font face="Times New Roman">      <strong>Session</strong>：在一个用户与服务器建立连接的整个过程中有效。Action中的获取：httpServletRequest.getSession()<br />      <strong>Request</strong>：在一个请求周期内有效。就是从你点击页面上的一个按钮开始到服务器返回响应页面为止（包括响应页面）。<br />      <strong>Page</strong>：仅在一个jsp页面内有效。<br /></font></font></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="3">
						<span lang="EN-US" style="COLOR: green; mso-fareast-font-family: Gulim">
								<font size="2">
										<br />*1*</font>
						</span> </font>
				<span lang="EN-US" style="COLOR: green; mso-fareast-font-family: Gulim">
						<font size="2">Request in Struts: PageFrom (request.<strong>set</strong>Attribute by using Form)--&gt;Action(request.<strong>get</strong>Attribute&amp;<strong>set</strong>Attribute)--&gt;PageTo (request.<strong>get</strong>Attribute by using EL) </font>
				</span>
				<span lang="EN-US">
						<span style="COLOR: green">
								<br />
								<font size="2">
										<br />*2* :</font>
						</span>
				</span>
				<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="2">
						</font>
				</span>
				<font size="2">
						<span lang="EN-US" style="COLOR: green">
								<strong>Parameter</strong> vs <strong>Attribute</strong> in request<br /></span>
						<span lang="EN-US">
								<span style="COLOR: green">   Parameter</span>
						</span>
						<font face="Times New Roman">
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</span>
								<span lang="EN-US" style="COLOR: green">URL</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">带过来的参数，只能是个</span>
								<span lang="EN-US" style="COLOR: green">String</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，如</span>
						</font>
				</font>
				<font size="2">
						<span style="COLOR: green">
								<span lang="EN-US">www.verican.com/test?para1=1&amp;para2=ttt<br /></span>
						</span>
						<font face="Times New Roman">
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">   在</span>
								<span lang="EN-US" style="COLOR: green">Action</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的调用：</span>
						</font>
				</font>
				<font size="2">
						<span lang="EN-US" style="COLOR: green">request.getParameter("para1"); <br /></span>
						<font face="Times New Roman">
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">   在响应页面中的调用：</span>
								<span lang="EN-US" style="COLOR: green">${param.para1}</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（</span>
								<span lang="EN-US" style="COLOR: green">param</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</span>
								<span lang="EN-US" style="COLOR: green">EL</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的隐藏对象）</span> </font>
				</font>
				<span lang="EN-US" style="COLOR: green">
						<br />
						<font size="2">
								<br />   Attribute</font>
				</span>
				<font size="2">
						<font face="Times New Roman">
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一般是</span>
								<span lang="EN-US" style="COLOR: green">Form</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">带过来的属性，可以是任何对象<br />   </span>
						</font>
				</font>
				<font face="Times New Roman">
						<font size="2">
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span>
								<span lang="EN-US" style="COLOR: green">Action</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的调用：一般已经存在于</span>
								<span lang="EN-US" style="COLOR: green">Form</span>
						</font>
				</font>
				<font size="2">
						<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
								<font face="Times New Roman">对象中;<br /></font>
						</span>
						<font face="Times New Roman">
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">   在响应页面中的调用： </span>
						</font>
						<span lang="EN-US" style="COLOR: green">${attributeName.xxx} </span>
				</font>
				<font face="Times New Roman">
						<font size="2">
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（</span>
								<span lang="EN-US" style="COLOR: green">EL</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">会自动调用</span>
								<span lang="EN-US" style="COLOR: green">getXxx</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法，所以该</span>
								<span lang="EN-US" style="COLOR: green">attribute</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">必须实现</span>
								<span lang="EN-US" style="COLOR: green">getXxx</span>
								<span style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法）</span>
								<br />
								<br />
						</font>
				</font>
				<font face="Tahoma">
						<font size="2">5. Web server跟踪客户状态的四种方法（HTTP是无状态的协议）<br />    1）建立含有跟踪数据的隐藏表格字段<br />    2）重写包含额外参数的URL<br />    3）使用持续的Cookie<br />    4）使用Servlet API中的Session机制<br /><br />6. JavaBean的标准<br />   1) should be a public class<br />   2) should have a non-argument constructor<br />   3) fields should be privated, and using get &amp; set to access them<br />   4) also can have some other functions as a common class</font>
				</font>
		</p>
<img src ="http://www.blogjava.net/Jcat/aggbug/54606.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-06-23 09:11 <a href="http://www.blogjava.net/Jcat/archive/2006/06/23/54606.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How to use jar to implement double-click-run like .exe file</title><link>http://www.blogjava.net/Jcat/archive/2006/06/19/53857.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Mon, 19 Jun 2006 14:45:00 GMT</pubDate><guid>http://www.blogjava.net/Jcat/archive/2006/06/19/53857.html</guid><wfw:comment>http://www.blogjava.net/Jcat/comments/53857.html</wfw:comment><comments>http://www.blogjava.net/Jcat/archive/2006/06/19/53857.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/Jcat/comments/commentRss/53857.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Jcat/services/trackbacks/53857.html</trackback:ping><description><![CDATA[
		<p>1. workdir=learnJar<br /><br /><font color="#000000"><font color="#808080">目录结构<br /></font>+ learnJar<br /> | mf.mf<br /> |+ test<br />   | Test.java<br /></font> <br />2. workdir&gt;javac test\Test.java</p>
		<p>+ learnJar<br /> | mf.mf <br /> |+ test<br />   | Test.java<br />   <font color="#ff0000">| Test</font><font color="#ff0000">.class</font></p>
		<p>3. workdir&gt;jar cvfm a.jar mf.mf test\Test.class</p>
		<p>+ learnJar<br /> | mf.mf<br /> |+ test<br />   | Test.java<br />   | Test.class<br /> <font color="#ff0000">|+ a.jar<br />   |+ META-INF<br />     | MANIFEST.MF<br />   |+ test<br />     | Test.class<br /></font><br /> 4. workdir&gt;java -jar a.jar<br />hello world</p>
		<p>
				<br />NOTE<br />1. manifest.mf可以放在任何位置，也可以是其它的文件名(反正最后jar中的文件名会被自动变为MANIFEST.MF)<br />2. "Manifest-Version: 1.0"--该行(以及其它行)冒号后面<font color="#ff0000">必须是个空格</font>，否则jar时出错"invalid header field"<br />3. "Main-Class: test.Test&lt;回车&gt;"--该行<font color="#ff0000">必须以一个回车符结束</font>，否则无效。<br />4. 如果是<font color="#0000ff">有UI的程序</font>，<font color="#0000ff">双击jar文件</font>即可运行。(如果安装了winrar等压缩软件，jar文件会被关联，因此，双击时并不会执行jar程序，而是调用压缩软件来打开jar文件，这时，将jar的关联去掉即可)<br /><br />Appendix<br />Test.java</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #0000ff">package</span>
				<span style="COLOR: #000000"> test;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> javax.swing.</span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_70_250_Open_Image" onclick="this.style.display='none'; Codehighlighter1_70_250_Open_Text.style.display='none'; Codehighlighter1_70_250_Closed_Image.style.display='inline'; Codehighlighter1_70_250_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_70_250_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_70_250_Closed_Text.style.display='none'; Codehighlighter1_70_250_Open_Image.style.display='inline'; Codehighlighter1_70_250_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span style="COLOR: #0000ff">public</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">class</span>
				<span style="COLOR: #000000"> Test </span>
				<span style="COLOR: #0000ff">extends</span>
				<span style="COLOR: #000000"> JFrame</span>
				<span id="Codehighlighter1_70_250_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_70_250_Open_Text">
						<span style="COLOR: #000000">{<br /><img id="Codehighlighter1_111_248_Open_Image" onclick="this.style.display='none'; Codehighlighter1_111_248_Open_Text.style.display='none'; Codehighlighter1_111_248_Closed_Image.style.display='inline'; Codehighlighter1_111_248_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_111_248_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_111_248_Closed_Text.style.display='none'; Codehighlighter1_111_248_Open_Image.style.display='inline'; Codehighlighter1_111_248_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">public</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">static</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">void</span>
						<span style="COLOR: #000000"> main(String[] args)</span>
						<span id="Codehighlighter1_111_248_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.blogjava.net/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_111_248_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        Test impl</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> Test();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        JLabel label </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">new</span>
								<span style="COLOR: #000000"> JLabel(</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">hello world</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        impl.add(label);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            impl.pack();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        impl.setVisible(</span>
								<span style="COLOR: #0000ff">true</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
		</div>
		<br />mf.mf<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">Manifest</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">Version: </span><span style="COLOR: #000000">1.0</span><span style="COLOR: #000000"><br />Main</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">Class: test.Test<br />&lt;回车&gt;</span></div><img src ="http://www.blogjava.net/Jcat/aggbug/53857.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Jcat/" target="_blank">Jcat</a> 2006-06-19 22:45 <a href="http://www.blogjava.net/Jcat/archive/2006/06/19/53857.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>