|
一.引言 ??? ORACLE數(shù)據(jù)庫字符集,即Oracle全球化支持(Globalization Support),或即國家語言支持(NLS)其作用是用本國語言和格式來存儲、處理和檢索數(shù)據(jù)。利用全球化支持,ORACLE為用戶提供自己熟悉的數(shù)據(jù)庫母語環(huán)境,諸如日期格式、數(shù)字格式和存儲序列等。Oracle可以支持多種語言及字符集,其中oracle8i支持48種語言、76個國家地域、229種字符集,而oracle9i則支持57種語言、88個國家地域、235種字符集。由于oracle字符集種類多,且在存儲、檢索、遷移oracle數(shù)據(jù)時多個環(huán)節(jié)與字符集的設(shè)置密切相關(guān),因此在實際的應(yīng)用中,數(shù)據(jù)庫開發(fā)和管理人員經(jīng)常會遇到有關(guān)oracle字符集方面的問題。本文通過以下幾個方面闡述,對oracle字符集做簡要分析 二.字符集基本知識
2.1字符集
2.2字符編碼方案
2.3 字符集超級
2.4 數(shù)據(jù)庫字符集(oracle服務(wù)器端字符集)
2.5 客戶端字符集(NLS_LANG參數(shù))
三.導(dǎo)入/導(dǎo)出與字符集轉(zhuǎn)換
3.1 EXP/IMP
EXP
IMP?
??? 四個字符集是
3.2導(dǎo)出的轉(zhuǎn)換過程
3.3導(dǎo)入的轉(zhuǎn)換過程
四.亂碼問題 ??? oracle在數(shù)據(jù)存儲、遷移過程中經(jīng)常發(fā)生字符亂碼問題,歸根到底是由于字符集使用不當(dāng)引起。下面以使用客戶端sqlplus向數(shù)據(jù)庫插入數(shù)據(jù)和導(dǎo)入/導(dǎo)出(EXP/IMP)過程為例,說明亂碼產(chǎn)生的原因。
4.1使用客戶端sqlplus向數(shù)據(jù)庫存儲數(shù)據(jù)
4.2發(fā)生亂碼原因
?
4.3導(dǎo)入/導(dǎo)出過程出現(xiàn)亂碼原因
五.單字節(jié)編碼存儲中文問題
???
由于歷史的原因,早期的oracle沒有中文字符集(如oracle6、oracle7、oracle7.1),但有的用戶從那時起就使用數(shù)據(jù)庫了,并用US7ASCII字符集存儲了中文,或是有的用戶在創(chuàng)建數(shù)據(jù)庫時,不考慮清楚,隨意選擇一個默認(rèn)的字符集,如WE8ISO8859P1或US7ASCII,而這兩個字符集都沒有漢字編碼,雖然有些時候選用這種字符集好象也能正常使用,但用這種字符集存儲漢字信息從原則上說就是錯誤的,它會給數(shù)據(jù)庫的使用與維護(hù)帶來一系列的麻煩。
六.結(jié)束語 ??? 為了避免在數(shù)據(jù)庫遷移過程中由于字符集不同導(dǎo)致的數(shù)據(jù)損失,oracle提供了字符集掃描工具(character set scanner),通過這個工具我們可以測試在數(shù)據(jù)遷移過程中由于字符集轉(zhuǎn)換可能帶來的問題,然后根據(jù)測試結(jié)果,確定數(shù)據(jù)遷移過程中最佳字符集解決方案。
|
表格部分代碼如下:
<table id="testTbl" border=1>
<tr id="tr1">
<td width=6%><input type=checkbox id="box1"></td>
<td id="b">第一行</td>
</tr>
<tr id="tr2">
<td width=6%><input type=checkbox id="box2"></td>
<td id="b">第二行</td>
</tr>
<tr>
<td width=6%><input type=checkbox id="box3"></td>
<td>第三行</td>
</tr>
</table>
動態(tài)添加表行的javascript函數(shù)如下:
<script language="javascript">
function addRow(){
//添加一行
var newTr = testTbl.insertRow();
//設(shè)置行背景
newTr.bgColor = '#008040';
//添加兩列
var newTd0 = newTr.insertCell();
var newTd1 = newTr.insertCell();
//設(shè)置列內(nèi)容和屬性
newTd0.innerHTML = '<input type=checkbox id="box4">';
newTd1.innerText= '新增加的行';
}
</script>
<BR>
<a href="#" onclick="addRow();">增加一行</a>
就這么簡單,做點(diǎn)詳細(xì)的說明:
1、inserRow()和insertCell()函數(shù)
insertRow()函數(shù)可以帶參數(shù),形式如下:
insertRow(index)
這個函數(shù)將新行添加到index的那一行前,比如insertRow(0),是將新行添加到第一行之前。默認(rèn)的insertRow()函數(shù)相當(dāng)于insertRow(-1),將新行添加到表的最后。
insertCell()和insertRow的用法相同。
2、動態(tài)設(shè)置屬性和事件
上面行數(shù)中的innerHTML和innerText都是列的屬性。
這個inner,就是“inner”到<tb></tb>之間,innerText是添加到<tb></tb>之間的文本,innerHTML是添加到<tb></tb>之間的HTML代碼(這個so簡單,這個解釋挺多余的)
設(shè)置其他屬性也是用同樣的方式,比如,設(shè)置行背景色
newTr.bgColor = 'red';
?
設(shè)置事件也一樣,需要簡單說明一點(diǎn)。
比如,我要讓點(diǎn)擊新加行的時候執(zhí)行一個自己定義的函數(shù) newClick,newClick行數(shù)如下:
function newClick(){
alert("這是新添加的行");
}
對onclick事件設(shè)置這個函數(shù)的代碼如下:
newTr.onclick = newClick;
這里需要主義的是,=后面的部分必須是函數(shù)名,而且不能帶引號,
newTr.onclick = newClick();
newTr.onclick = 'newClick';
newTr.onclick = "newClick";
上面的寫法都是錯誤的。
為什么,其實知道為什么沒有什么意思,知道怎么用就OK了,如果不想知道,可以跳過下面這一段。
?
實際上這個=后面的newClick是指向自己定義的newClick函數(shù)的指針,javascript里面函數(shù)名就是指向函數(shù)的指針,加了引號括號什么的瀏覽器就找不到那個函數(shù)了。
下面的寫法,也是正確的
newTr.onclick = function newClick(){
alert("這是新添加的行");
}
這個使用函數(shù)名實際上是一樣的
設(shè)置其他的事件用法相同。
J2EE程序中使用oracle數(shù)據(jù)庫LOB字段的總結(jié)(elathen) | ||||
???http://www.souzz.net 2005-10-23 文章出處:博客園 | ||||
? |
|
J2EE程序中使用oracle數(shù)據(jù)庫LOB字段的總結(jié)(elathen) | ||||
???http://www.souzz.net 2005-10-23 文章出處:博客園 | ||||
? |
|
方法二:
//處理頁面緩存正則表達(dá)式經(jīng)典 (轉(zhuǎn))
"^\d+$" //非負(fù)整數(shù)(正整數(shù) + 0)
"^[0-9]*[1-9][0-9]*$" //正整數(shù)
"^((-\d+)|(0+))$" //非正整數(shù)(負(fù)整數(shù) + 0)
"^-[0-9]*[1-9][0-9]*$" //負(fù)整數(shù)
"^-?\d+$" //整數(shù)
"^\d+(\.\d+)?$" //非負(fù)浮點(diǎn)數(shù)(正浮點(diǎn)數(shù) + 0)
"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$" //正浮點(diǎn)數(shù)
"^((-\d+(\.\d+)?)|(0+(\.0+)?))$" //非正浮點(diǎn)數(shù)(負(fù)浮點(diǎn)數(shù) + 0)
"^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$" //負(fù)浮點(diǎn)數(shù)
"^(-?\d+)(\.\d+)?$" //浮點(diǎn)數(shù)
"^[A-Za-z]+$" //由26個英文字母組成的字符串
"^[A-Z]+$" //由26個英文字母的大寫組成的字符串
"^[a-z]+$" //由26個英文字母的小寫組成的字符串
"^[A-Za-z0-9]+$" //由數(shù)字和26個英文字母組成的字符串
"^\w+$" //由數(shù)字、26個英文字母或者下劃線組成的字符串
"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$" //email地址
"^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$"
----------------------------------------------------------------------------------------------------------------------
字符描述: \:將下一個字符標(biāo)記為特殊字符或字面值。例如"n"與字符"n"匹配。"\n"與換行符匹配。序列"\\"與"\"匹配,"\("與"("匹配。
^ :匹配輸入的開始位置。
$ :匹配輸入的結(jié)尾。
* :匹配前一個字符零次或幾次。例如,"zo*"可以匹配"z"、"zoo"。
+ :匹配前一個字符一次或多次。例如,"zo+"可以匹配"zoo",但不匹配"z"。
? :匹配前一個字符零次或一次。例如,"a?ve?"可以匹配"never"中的"ve"。
.:匹配換行符以外的任何字符。
(pattern) 與模式匹配并記住匹配。匹配的子字符串可以從作為結(jié)果的 Matches 集合中使用 Item [0]...[n]取得。如果要匹配括號字符(和 ),可使用"\(" 或 "\)"。
x|y:匹配 x 或 y。例如 "z|food" 可匹配 "z" 或 "food"。"(z|f)ood" 匹配 "zoo" 或 "food"。
{n}:n 為非負(fù)的整數(shù)。匹配恰好n次。例如,"o{2}" 不能與 "Bob 中的 "o" 匹配,但是可以與"foooood"中的前兩個o匹配。
{n,} :n 為非負(fù)的整數(shù)。匹配至少n次。例如,"o{2,}"不匹配"Bob"中的"o",但是匹配"foooood"中所有的o。"o{1,}"等價于"o+"。"o{0,}"等價于"o*"。
{n,m} :m 和 n 為非負(fù)的整數(shù)。匹配至少 n 次,至多 m 次。例如,"o{1,3}" 匹配 "fooooood"中前三個o。"o{0,1}"等價于"o?"。
[xyz] :一個字符集。與括號中字符的其中之一匹配。例如,"[abc]" 匹配"plain"中的"a"。
[^xyz] :一個否定的字符集。匹配不在此括號中的任何字符。例如,"[^abc]" 可以匹配"plain"中的"p".
[a-z] :表示某個范圍內(nèi)的字符。與指定區(qū)間內(nèi)的任何字符匹配。例如,"[a-z]"匹配"a"與"z"之間的任何一個小寫字母字符。
[^m-z] :否定的字符區(qū)間。與不在指定區(qū)間內(nèi)的字符匹配。例如,"[m-z]"與不在"m"到"z"之間的任何字符匹配。
\b :與單詞的邊界匹配,即單詞與空格之間的位置。例如,"er\b" 與"never"中的"er"匹配,但是不匹配"verb"中的"er"。
\B :與非單詞邊界匹配。"ea*r\B"與"never early"中的"ear"匹配。
\d :與一個數(shù)字字符匹配。等價于[0-9]。
\D :與非數(shù)字的字符匹配。等價于[^0-9]。
\f :與分頁符匹配。
\n :與換行符字符匹配。
\r :與回車字符匹配。
\s :與任何白字符匹配,包括空格、制表符、分頁符等。等價于"[ \f\n\r\t\v]"。
\S :與任何非空白的字符匹配。等價于"[^ \f\n\r\t\v]"。
\t :與制表符匹配。
\v :與垂直制表符匹配。
\w :與任何單詞字符匹配,包括下劃線。等價于"[A-Za-z0-9_]"。
\W :與任何非單詞字符匹配。等價于"[^A-Za-z0-9_]"。
\num :匹配 num個,其中 num 為一個正整數(shù)。引用回到記住的匹配。例如,"(.)\1"匹配兩個連續(xù)的相同的字符。
\n:匹配 n,其中n 是一個八進(jìn)制換碼值。八進(jìn)制換碼值必須是 1, 2 或 3 個數(shù)字長。
例如,"\11" 和 "\011" 都與一個制表符匹配。"\0011"等價于"\001" 與 "1"。八進(jìn)制換碼值不得超過 256。否則,只有前兩個字符被視為表達(dá)式的一部分。允許在正則表達(dá)式中使用ASCII碼。
\xn:匹配n,其中n是一個十六進(jìn)制的換碼值。十六進(jìn)制換碼值必須恰好為兩個數(shù)字長。例如,"\x41"匹配"A"。"\x041"等價于"\x04" 和 "1"。允許在正則表達(dá)式中使用 ASCII 碼。
好了,常用的方法和屬性就是這些了,上面的語法介紹的已經(jīng)很詳細(xì)了,我們就沒有必要在羅嗦了,接下來我們來看看在具體的例子里面如何使用這些方法和屬性來校驗數(shù)據(jù)的合法性,我們還是舉個例子吧,比如,我們想要對用戶輸入的電子郵件進(jìn)行校驗,那么,什么樣的數(shù)據(jù)才算是一個合法的電子郵件呢?我可以這樣輸入:uestc95@263.net,當(dāng)然我也會這樣輸入:xxx@yyy.com.cn,但是這樣的輸入就是非法的:xxx@@com.cn或者@xxx.com.cn,等等,所以我們得出一個合法的電子郵件地址至少應(yīng)當(dāng)滿足以下幾個條件:
1. 必須包含一個并且只有一個符號“@”
2. 必須包含至少一個至多三個符號“.”
3. 第一個字符不得是“@”或者“.”
4. 不允許出現(xiàn)“@.”或者.@
5. 結(jié)尾不得是字符“@”或者“.”
所以根據(jù)以上的原則和上面表中的語法,我們很容易的就可以得到需要的模板如下:"(\w)+[@]{1}(\w)+[.]{1,3}(\w)+"
接下來我們仔細(xì)分析一下這個模板,首先“\w”表示郵件的開始字符只能是包含下劃線的單詞字符,這樣,滿足了第三個條件;“[@]{1}”表示在電子郵件中應(yīng)當(dāng)匹配并且只能匹配一次字符“@”,滿足了條件一;同樣的“[.]{1,3}”表示在電子郵件中至少匹配1個至多匹配3個字符“.” ,滿足了第二個條件;模板最后的“(\w)+”表示結(jié)尾的字符只能是包含下劃線在內(nèi)的單詞字符,滿足了條件五;模板中間的“(\w)+”滿足了條件四。
然后,我們就直接調(diào)用剛才的那個函數(shù)CheckExp("(\w)+[@]{1}(\w)+[.]{1}(\w)+",待校驗的字符串)就好了,如果返回True就表示數(shù)據(jù)是合法的,否則就是不正確的,怎么樣,簡單吧。我們還可以寫出來校驗身份證號碼的模板:"([0-9]){15}";校驗URL的模板:"^http://{1}((\w)+[.]){1,3}"等等;我們可以看到,這些模板為我們提供了很好的可重利用的模塊,利用自己或者別人提供的各種模板,我們就可以方便快捷的進(jìn)行數(shù)據(jù)的合法性校驗了,相信你一定會寫出非常通用的模板的。
這樣,我們只要定制不同的模板,就可以實現(xiàn)對不同數(shù)據(jù)的合法性校驗了。所以,正則表達(dá)式對象中最重要的屬性就是:“Pattern”屬性,只要真正掌握了這個屬性,才可以自由的運(yùn)用正則表達(dá)式對象來為我們的數(shù)據(jù)校驗進(jìn)行服務(wù)。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=560411
TCP協(xié)議
==> TCP首部
??? 源端口號、目的端口號、位序號、位確認(rèn)序號、首部長度、標(biāo)志位、窗口大小、檢驗和、緊急指針和其它選項。
???
??? 一個IP地址和一個端口號也成為一個插口(socket)。插口對可唯一確定互聯(lián)網(wǎng)中每個TCP連接的雙方。
==> TCP連接的建立與終止
??? TCP是一個面向連接的協(xié)議,無論哪方向另一方發(fā)送數(shù)據(jù)之前,都必須先在雙方之間建立一條連接。
??? TCP連接的建立——三次握手。
??? TCP連接的終止——四次握手。這是由TCP的半關(guān)閉造成的。因為TCP是全雙工的,因此每個方向必須單獨(dú)的進(jìn)行關(guān)閉。
==> 最大報文段長度MSS
??? MSS越大,允許每個報文段傳遞的數(shù)據(jù)越多,相對TCP和IP的首部有更高的利用率。
??? 有些情況下,MSS是可以在建立TCP連接時進(jìn)行協(xié)商的選項,但是有些情況下不行 。
??? * 如果是本地網(wǎng)絡(luò),TCP可以根據(jù)網(wǎng)絡(luò)外出接口處的MTU值減去固定的IP首部(20)和TCP長度(20),對于以太網(wǎng),可以達(dá)到1460。
??? * 如果IP地址為非本地的,則MSS通常定為默認(rèn)值536字節(jié)(允許20字節(jié)的IP首部和20字節(jié)的TCP首部以適合576字節(jié)的IP數(shù)據(jù)報)。
??? MSS讓主機(jī)限制另一端發(fā)送數(shù)據(jù)的長度,同時也能控制它自己發(fā)送數(shù)據(jù)報的長度,避免較小MTU發(fā)生分片。
==> TCP的半關(guān)閉
??? TCP連接的一端在結(jié)束它的發(fā)送后還能接收來自另一端數(shù)據(jù)(直到它也發(fā)送FIN)的能力,這就是所謂的半關(guān)閉。應(yīng)用程序很少用到。
==> 復(fù)位報文段
??? * 不存在的端口(目的端口沒有進(jìn)程監(jiān)聽)。目的主機(jī)將對SYN請求返回一個RST報文段。(UDP則將產(chǎn)生一個端口不可達(dá)的信息)
??? * 異常終止。
??? * 檢測半打開的連接。
==> TCP服務(wù)器的設(shè)計
??? * 大多數(shù)TCP服務(wù)器的進(jìn)程是并發(fā)的.
??? * 只有處于監(jiān)聽的進(jìn)程才能處理客戶端的連接請求.
??? * TCP服務(wù)器可以對本地IP地址進(jìn)行限制,但是一般不能對遠(yuǎn)程IP地址進(jìn)行限制.
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=561075
關(guān)于Java棧與堆的思考
1. 棧(stack)與堆(heap)都是Java用來在Ram中存放數(shù)據(jù)的地方。與C++不同,Java自動管理棧和堆,程序員不能直接地設(shè)置?;蚨选?/p>
2. 棧的優(yōu)勢是,存取速度比堆要快,僅次于直接位于CPU中的寄存器。但缺點(diǎn)是,存在棧中的數(shù)據(jù)大小與生存期必須是確定的,缺乏靈活性。另外,棧數(shù)據(jù)可以共享,詳見第3點(diǎn)。堆的優(yōu)勢是可以動態(tài)地分配內(nèi)存大小,生存期也不必事先告訴編譯器,Java的垃圾收集器會自動收走這些不再使用的數(shù)據(jù)。但缺點(diǎn)是,由于要在運(yùn)行時動態(tài)分配內(nèi)存,存取速度較慢。
3. Java中的數(shù)據(jù)類型有兩種。
? 一種是基本類型(primitive types), 共有8種,即int, short, long, byte, float, double, boolean, char(注意,并沒有string的基本類型)。這種類型的定義是通過諸如int a = 3; long b = 255L;的形式來定義的,稱為自動變量。值得注意的是,自動變量存的是字面值,不是類的實例,即不是類的引用,這里并沒有類的存在。如int a = 3; 這里的a是一個指向int類型的引用,指向3這個字面值。這些字面值的數(shù)據(jù),由于大小可知,生存期可知(這些字面值固定定義在某個程序塊里面,程序塊退出后,字段值就消失了),出于追求速度的原因,就存在于棧中。
? 另外,棧有一個很重要的特殊性,就是存在棧中的數(shù)據(jù)可以共享。假設(shè)我們同時定義
? int a = 3;
? int b = 3;
?? 編譯器先處理int a = 3;首先它會在棧中創(chuàng)建一個變量為a的引用,然后查找有沒有字面值為3的地址,沒找到,就開辟一個存放3這個字面值的地址,然后將a指向3的地址。接著處理int b = 3;在創(chuàng)建完b的引用變量后,由于在棧中已經(jīng)有3這個字面值,便將b直接指向3的地址。這樣,就出現(xiàn)了a與b同時均指向3的情況。
?? 特別注意的是,這種字面值的引用與類對象的引用不同。假定兩個類對象的引用同時指向一個對象,如果一個對象引用變量修改了這個對象的內(nèi)部狀態(tài),那么另一個對象引用變量也即刻反映出這個變化。相反,通過字面值的引用來修改其值,不會導(dǎo)致另一個指向此字面值的引用的值也跟著改變的情況。如上例,我們定義完a與 b的值后,再令a=4;那么,b不會等于4,還是等于3。在編譯器內(nèi)部,遇到a=4;時,它就會重新搜索棧中是否有4的字面值,如果沒有,重新開辟地址存放4的值;如果已經(jīng)有了,則直接將a指向這個地址。因此a值的改變不會影響到b的值。
? 另一種是包裝類數(shù)據(jù),如Integer, String, Double等將相應(yīng)的基本數(shù)據(jù)類型包裝起來的類。這些類數(shù)據(jù)全部存在于堆中,Java用new()語句來顯示地告訴編譯器,在運(yùn)行時才根據(jù)需要動態(tài)創(chuàng)建,因此比較靈活,但缺點(diǎn)是要占用更多的時間。
4. String是一個特殊的包裝類數(shù)據(jù)。即可以用String str = new String("abc");的形式來創(chuàng)建,也可以用String str = "abc";的形式來創(chuàng)建(作為對比,在JDK 5.0之前,你從未見過Integer i = 3;的表達(dá)式,因為類與字面值是不能通用的,除了String。而在JDK 5.0中,這種表達(dá)式是可以的!因為編譯器在后臺進(jìn)行Integer i = new Integer(3)的轉(zhuǎn)換)。前者是規(guī)范的類的創(chuàng)建過程,即在Java中,一切都是對象,而對象是類的實例,全部通過new()的形式來創(chuàng)建。Java 中的有些類,如DateFormat類,可以通過該類的getInstance()方法來返回一個新創(chuàng)建的類,似乎違反了此原則。其實不然。該類運(yùn)用了單例模式來返回類的實例,只不過這個實例是在該類內(nèi)部通過new()來創(chuàng)建的,而getInstance()向外部隱藏了此細(xì)節(jié)。那為什么在String str = "abc";中,并沒有通過new()來創(chuàng)建實例,是不是違反了上述原則?其實沒有。
5. 關(guān)于String str = "abc"的內(nèi)部工作。Java內(nèi)部將此語句轉(zhuǎn)化為以下幾個步驟:
? (1)先定義一個名為str的對String類的對象引用變量:String str;
?? (2)在棧中查找有沒有存放值為"abc"的地址,如果沒有,則開辟一個存放字面值為"abc"的地址,接著創(chuàng)建一個新的String類的對象o,并將o 的字符串值指向這個地址,而且在棧中這個地址旁邊記下這個引用的對象o。如果已經(jīng)有了值為"abc"的地址,則查找對象o,并返回o的地址。
? (3)將str指向?qū)ο髈的地址。
? 值得注意的是,一般String類中字符串值都是直接存值的。但像String str = "abc";這種場合下,其字符串值卻是保存了一個指向存在棧中數(shù)據(jù)的引用!
?
? 為了更好地說明這個問題,我們可以通過以下的幾個代碼進(jìn)行驗證。
? String str1 = "abc";
? String str2 = "abc";
? System.out.println(str1==str2);? //true
?
? 注意,我們這里并不用str1.equals(str2);的方式,因為這將比較兩個字符串的值是否相等。==號,根據(jù)JDK的說明,只有在兩個引用都指向了同一個對象時才返回真值。而我們在這里要看的是,str1與str2是否都指向了同一個對象。
? 結(jié)果說明,JVM創(chuàng)建了兩個引用str1和str2,但只創(chuàng)建了一個對象,而且兩個引用都指向了這個對象。
? 我們再來更進(jìn)一步,將以上代碼改成:
? String str1 = "abc";
? String str2 = "abc";
? str1 = "bcd";
? System.out.println(str1 + "," + str2);? //bcd, abc
? System.out.println(str1==str2);? //false
? 這就是說,賦值的變化導(dǎo)致了類對象引用的變化,str1指向了另外一個新對象!而str2仍舊指向原來的對象。上例中,當(dāng)我們將str1的值改為"bcd"時,JVM發(fā)現(xiàn)在棧中沒有存放該值的地址,便開辟了這個地址,并創(chuàng)建了一個新的對象,其字符串的值指向這個地址。
?? 事實上,String類被設(shè)計成為不可改變(immutable)的類。如果你要改變其值,可以,但JVM在運(yùn)行時根據(jù)新值悄悄創(chuàng)建了一個新對象,然后將這個對象的地址返回給原來類的引用。這個創(chuàng)建過程雖說是完全自動進(jìn)行的,但它畢竟占用了更多的時間。在對時間要求比較敏感的環(huán)境中,會帶有一定的不良影響。
? 再修改原來代碼:
? String str1 = "abc";
? String str2 = "abc";
?
? str1 = "bcd";
?
? String str3 = str1;
? System.out.println(str3);? //bcd
? String str4 = "bcd";
? System.out.println(str1 == str4);? //true
???
? str3 這個對象的引用直接指向str1所指向的對象(注意,str3并沒有創(chuàng)建新對象)。當(dāng)str1改完其值后,再創(chuàng)建一個String的引用str4,并指向因str1修改值而創(chuàng)建的新的對象??梢园l(fā)現(xiàn),這回str4也沒有創(chuàng)建新的對象,從而再次實現(xiàn)棧中數(shù)據(jù)的共享。
? 我們再接著看以下的代碼。
? String str1 = new String("abc");
? String str2 = "abc";
? System.out.println(str1==str2);? //false
? 創(chuàng)建了兩個引用。創(chuàng)建了兩個對象。兩個引用分別指向不同的兩個對象。
? String str1 = "abc";
? String str2 = new String("abc");
? System.out.println(str1==str2);? //false
? 創(chuàng)建了兩個引用。創(chuàng)建了兩個對象。兩個引用分別指向不同的兩個對象。
? 以上兩段代碼說明,只要是用new()來新建對象的,都會在堆中創(chuàng)建,而且其字符串是單獨(dú)存值的,即使與棧中的數(shù)據(jù)相同,也不會與棧中的數(shù)據(jù)共享。
6. 數(shù)據(jù)類型包裝類的值不可修改。不僅僅是String類的值不可修改,所有的數(shù)據(jù)類型包裝類都不能更改其內(nèi)部的值。
7. 結(jié)論與建議:
?? (1)我們在使用諸如String str = "abc";的格式定義類時,總是想當(dāng)然地認(rèn)為,我們創(chuàng)建了String類的對象str。擔(dān)心陷阱!對象可能并沒有被創(chuàng)建!唯一可以肯定的是,指向 String類的引用被創(chuàng)建了。至于這個引用到底是否指向了一個新的對象,必須根據(jù)上下文來考慮,除非你通過new()方法來顯要地創(chuàng)建一個新的對象。因此,更為準(zhǔn)確的說法是,我們創(chuàng)建了一個指向String類的對象的引用變量str,這個對象引用變量指向了某個值為"abc"的String類。清醒地認(rèn)識到這一點(diǎn)對排除程序中難以發(fā)現(xiàn)的bug是很有幫助的。
? (2)使用String str = "abc";的方式,可以在一定程度上提高程序的運(yùn)行速度,因為JVM會自動根據(jù)棧中數(shù)據(jù)的實際情況來決定是否有必要創(chuàng)建新對象。而對于String str = new String("abc");的代碼,則一概在堆中創(chuàng)建新對象,而不管其字符串值是否相等,是否有必要創(chuàng)建新對象,從而加重了程序的負(fù)擔(dān)。這個思想應(yīng)該是享元模式的思想,但JDK的內(nèi)部在這里實現(xiàn)是否應(yīng)用了這個模式,不得而知。
? (3)當(dāng)比較包裝類里面的數(shù)值是否相等時,用equals()方法;當(dāng)測試兩個包裝類的引用是否指向同一個對象時,用==。
? (4)由于String類的immutable性質(zhì),當(dāng)String變量需要經(jīng)常變換其值時,應(yīng)該考慮使用StringBuffer類,以提高程序效率。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=561129
|
|
|
|
|
|
在讀我自己的認(rèn)識之前
,
我們先來看一下
servet
的結(jié)構(gòu)圖
:
以下是我自己的一點(diǎn)淺見:
① Servlet 在初始化的時候 , 是通過 init(ServletConfig? config) 或 init() 來執(zhí)行的。
ServletConfig 是一個接口,它怎樣傳遞給他一格對象來進(jìn)行初始化呢?其實,是這個對象是由 servlet 容器來實例化的,由容器產(chǎn)生一格 ServletConfig 的實現(xiàn)類的對象,然后傳遞給 Servlet
結(jié)論: ServletConfig 由容器實例化
② 我們有些時候可能在 Servlet 初始化時給它一些固定的配置參數(shù),那么這些參數(shù)是怎樣傳遞到 Servlet 呢?
其實,我們在 web.xml 中給 servlet 配置啟動參數(shù),在容器對 servlet 進(jìn)行初始化的時候,會收集你所配置的參數(shù),記錄在 ServletConfig 的實現(xiàn)類中,所以你才可以通過 ServletConfig 對象的
??? public String getInitParameter(String name); 或
??? public Enumeration getInitParameterNames();
方法來取得你已經(jīng)配置好的參數(shù),也就是說,你對 servlet 的配置都已經(jīng)記錄在 ServletConfig 對象中了。
結(jié)論:你對 Servlet 的配置,在 Servlet 的初始化時都由容器來收集并且記錄到 ServletConfig 的實現(xiàn)類中。
?
③ 我們來看一個 Servlet 的配置
? <servlet>
??? <servlet-name>index</servlet-name>
??? <servlet-class>org.zy.pro.sw.servlet.IndexServlet</servlet-class>
??? <init-param>
????? <param-name>dbconfig</param-name>
????? <param-value>/WEB-INF/dbconfig.xml</param-value>
??? </init-param>
? </servlet>
在此,我們實現(xiàn)對數(shù)據(jù)庫的配置文件的加載。
當(dāng) Servlet 初始化完成后,我們可以通過
String? dbconf=this.getServletConfig().getInitParameter("dbconfig")
來取得我們的配置的參數(shù)的值。
但是,我們僅能得到一個配置的字符串。之后我們可以通過配置文件取得我們的數(shù)據(jù)庫的配置參數(shù),然后對數(shù)據(jù)庫進(jìn)行初始化。
其實我們也可以通過傳遞一個類的名字串,然后再實例化。
??? <init-param>
????? <param-name>dbconfig</param-name>
????? <param-value>org.zy.util.db.DBUtil</param-value>
??
?</init-param>
我們先取得配置參數(shù):
String? dbconf=this.getServletConfig().getInitParameter("dbconfig") ;
然后通過
Class.forName(dbconf).getInstance();
來實例化對象,就可以實現(xiàn)對數(shù)據(jù)庫的調(diào)用了。
結(jié)論:在 web.xml 中對 Servlet 的初始化,只能傳遞字符串類型的數(shù)據(jù)
④ ServletContext
ServletContext 是負(fù)責(zé)和 Servlet 的上文和下文交互,上面和 Servlet 容器交互,下面和 Servlet 中的請求和相應(yīng)進(jìn)行交互。
在 ServletConfig 中, ???
public ServletContext getServletContext(); 方法實現(xiàn)取得當(dāng)前 ServletContext 的對象。
你可能要問, ServletContext 是一個接口,那么你如何取得他的對象呢?
其實這個問題和 ServletConfig 相同,都是在 Servlet 進(jìn)行初始化的時候產(chǎn)生的對象,是由容器來初始化的。
<html>
<head>
<title>看看</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 這個屬性可以在打印時有效-->
<style media=print>
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
<style>
.tdp
{
border-bottom: 1 solid #000000;
border-left: 1 solid #000000;
border-right: 0 solid #ffffff;
border-top: 0 solid #ffffff;
}
.tabp
{
border-color: #000000 #000000 #000000 #000000;
border-style: solid;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 1px;
border-left-width: 1px;
}
.NOPRINT {
font-family: "宋體";
font-size: 9pt;
}
</style>
</head>
<body >
<center class="Noprint" >
<p>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0>
</OBJECT>
<input type=button value=打印 onclick=document.all.WebBrowser.ExecWB(6,1)>
<input type=button value=直接打印 onclick=document.all.WebBrowser.ExecWB(6,6)>
<input type=button value=頁面設(shè)置 onclick=document.all.WebBrowser.ExecWB(8,1)>
</p>
<p> <input type=button value=打印預(yù)覽 onclick=document.all.WebBrowser.ExecWB(7,1)>
<br/>
</p>
<hr align="center" width="90%" size="1" noshade>
</center>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td colspan="3" class="tdp">第1頁</td>
</tr>
<tr>
<td width="29%" class="tdp"> </td>
<td width="28%" class="tdp"> </td>
<td width="43%" class="tdp"> </td>
</tr>
<tr>
<td colspan="3" class="tdp"> </td>
</tr>
<tr>
<td colspan="3" class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>這樣的報表</p>
<p>對一般的要求就夠了。</p></td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
<hr align="center" width="90%" size="1" noshade class="NOPRINT" >
<!--分頁-->
<div class="PageNext"></div>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td class="tdp">第2頁</td>
</tr>
<tr>
<td class="tdp">看到分頁了吧</td>
</tr>
<tr>
<td class="tdp"> </td>
</tr>
<tr>
<td class="tdp"> </td>
</tr>
<tr>
<td class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>這樣的報表</p>
<p>對一般的要求就夠了。</p></td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<html xmlns="<title>Pure CSS Scrollable Table with Fixed Header</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="language" content="en-us" />
<script type="text/javascript">
<!--
/* http://www.alistapart.com/articles/zebratables/ */
function removeClassName (elem, className) {
?elem.className = elem.className.replace(className, "").trim();
}
function addCSSClass (elem, className) {
?removeClassName (elem, className);
?elem.className = (elem.className + " " + className).trim();
}
String.prototype.trim = function() {
?return this.replace( /^\s+|\s+$/, "" );
}
function stripedTable() {
?if (document.getElementById && document.getElementsByTagName) {?
??var allTables = document.getElementsByTagName('table');
??if (!allTables) { return; }
??for (var i = 0; i < allTables.length; i++) {
???if (allTables[i].className.match(/[\w\s ]*scrollTable[\w\s ]*/)) {
????var trs = allTables[i].getElementsByTagName("tr");
????for (var j = 0; j < trs.length; j++) {
?????removeClassName(trs[j], 'alternateRow');
?????addCSSClass(trs[j], 'normalRow');
????}
????for (var k = 0; k < trs.length; k += 2) {
?????removeClassName(trs[k], 'normalRow');
?????addCSSClass(trs[k], 'alternateRow');
????}
???}
??}
?}
}
/* onload state is fired, append onclick action to the table's DIV */
/* container. This allows the HTML document to validate correctly. */
/* addIEonScroll added on 2005-01-28?????????????????????????????? */
/* Terence Ordona, portal[AT]imaputz[DOT]com?????????????????????? */
function addIEonScroll() {
?var thisContainer = document.getElementById('tableContainer');
?if (!thisContainer) { return; }
?var onClickAction = 'toggleSelectBoxes();';
?thisContainer.onscroll = new Function(onClickAction);
}
/* Only WinIE will fire this function. All other browsers scroll the TBODY element and not the DIV */
/* This is to hide the SELECT elements from scrolling over the fixed Header. WinIE only.?????????? */
/* toggleSelectBoxes added on 2005-01-28 */
/* Terence Ordona, portal[AT]imaputz[DOT]com???????? */
function toggleSelectBoxes() {
?var thisContainer = document.getElementById('tableContainer');
?var thisHeader = document.getElementById('fixedHeader');
?if (!thisContainer || !thisHeader) { return; }
?var selectBoxes = thisContainer.getElementsByTagName('select');
?if (!selectBoxes) { return; }
?for (var i = 0; i < selectBoxes.length; i++) {
??if (thisContainer.scrollTop >= eval(selectBoxes[i].parentNode.offsetTop - thisHeader.offsetHeight)) {
???selectBoxes[i].style.visibility = 'hidden';
??} else {
???selectBoxes[i].style.visibility = 'visible';
??}
?}
}
window.onload = function() { stripedTable(); addIEonScroll(); }
-->
</script>
<style type="text/css">
<!--
/* Terence Ordona, portal[AT]imaputz[DOT]com???????? */
/* http://creativecommons.org/licenses/by-sa/2.0/??? */
/* begin some basic styling here???????????????????? */
body {
?background: #FFF;
?color: #000;
?font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif;
?margin: 10px;
?padding: 0
}
table, td, a {
?color: #000;
?font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif
}
h1 {
?font: normal normal 18px Verdana, Geneva, Arial, Helvetica, sans-serif;
?margin: 0 0 5px 0
}
h2 {
?font: normal normal 16px Verdana, Geneva, Arial, Helvetica, sans-serif;
?margin: 0 0 5px 0
}
h3 {
?font: normal normal 13px Verdana, Geneva, Arial, Helvetica, sans-serif;
?color: #008000;
?margin: 0 0 15px 0
}
/* end basic styling???????????????????????????????? */
/* define height and width of scrollable area. Add 16px to width for scrollbar????????? */
/* allow WinIE to scale 100% width of browser by not defining a width?????????????????? */
/* WARNING: applying a background here may cause problems with scrolling in WinIE 5.x?? */
div.tableContainer {
?clear: both;
?border: 1px solid #963;
?height: 285px;
?overflow: auto;
?width: 756px;
}
/* WinIE 6.x needs to re-account for it's scrollbar. Give it some padding */
\html div.tableContainer/* */ {
?padding: 0 16px 0 0;
?width: 740px;
}
/* clean up for allowing display Opera 5.x/6.x and MacIE 5.x */
html>body div.tableContainer {
?height: auto;
?padding: 0;
}
/* Reset overflow value to hidden for all non-IE browsers. */
/* Filter out Opera 5.x/6.x and MacIE 5.x????????????????? */
head:first-child+body div[class].tableContainer {
?height: 285px;
?overflow: hidden;
?width: 756px
}
/* define width of table. IE browsers only???????????????? */
/* if width is set to 100%, you can remove the width?????? */
/* property from div.tableContainer and have the div scale */
div.tableContainer table {
?float: left;
?width: 100%
}
/* WinIE 6.x needs to re-account for padding. Give it a negative margin */
\html div.tableContainer table/* */ {
?margin: 0 -16px 0 0
}
/* define width of table. Opera 5.x/6.x and MacIE 5.x */
html>body div.tableContainer table {
?float: none;
?margin: 0;
?width: 740px
}
/* define width of table. Add 16px to width for scrollbar.?????????? */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
head:first-child+body div[class].tableContainer table {
?width: 756px
}
/* set table header to a fixed position. WinIE 6.x only?????????????????????????????????????? */
/* In WinIE 6.x, any element with a position property set to relative and is a child of?????? */
/* an element that has an overflow property set, the relative value translates into fixed.??? */
/* Ex: parent element DIV with a class of tableContainer has an overflow property set to auto */
thead.fixedHeader tr {
?position: relative;
?/* expression is for WinIE 5.x only. Remove to validate and for pure CSS solution????? */
?top: expression(document.getElementById("tableContainer").scrollTop);
}
/* set THEAD element to have block level attributes. All other non-IE browsers??????????? */
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
/* Filter out Opera 5.x/6.x and MacIE 5.x???????????????????????????????????????????????? */
head:first-child+body thead[class].fixedHeader tr {
?display: block;
}
/* make the TH elements pretty */
thead.fixedHeader th {
?background: #C96;
?border-left: 1px solid #EB8;
?border-right: 1px solid #B74;
?border-top: 1px solid #EB8;
?font-weight: normal;
?padding: 4px 3px;
?text-align: left
}
/* make the A elements pretty. makes for nice clickable headers??????????????? */
thead.fixedHeader a, thead.fixedHeader a:link, thead.fixedHeader a:visited {
?color: #FFF;
?display: block;
?text-decoration: none;
?width: 100%
}
/* make the A elements pretty. makes for nice clickable headers??????????????? */
/* WARNING: swapping the background on hover may cause problems in WinIE 6.x?? */
thead.fixedHeader a:hover {
?color: #FFF;
?display: block;
?text-decoration: underline;
?width: 100%
}
/* define the table content to be scrollable????????????????????????????????????????????? */
/* set TBODY element to have block level attributes. All other non-IE browsers??????????? */
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
/* induced side effect is that child TDs no longer accept width: auto???????????????????? */
/* Filter out Opera 5.x/6.x and MacIE 5.x???????????????????????????????????????????????? */
head:first-child+body tbody[class].scrollContent {
?display: block;
?height: 262px;
?overflow: auto;
?width: 100%
}
/* make TD elements pretty. Provide alternating classes for striping the table */
/* http://www.alistapart.com/articles/zebratables/???????????????????????????? */
tbody.scrollContent td, tbody.scrollContent tr.normalRow td {
?background: #FFF;
?border-bottom: none;
?border-left: none;
?border-right: 1px solid #CCC;
?border-top: 1px solid #DDD;
?padding: 2px 3px 3px 4px
}
tbody.scrollContent tr.alternateRow td {
?background: #EEE;
?border-bottom: none;
?border-left: none;
?border-right: 1px solid #CCC;
?border-top: 1px solid #DDD;
?padding: 2px 3px 3px 4px
}
/* define width of TH elements: 1st, 2nd, and 3rd respectively.????? */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
/* Add 16px to last TH for scrollbar padding???????????????????????? */
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors??? */
head:first-child+body thead[class].fixedHeader th {
?width: 200px
}
head:first-child+body thead[class].fixedHeader th + th {
?width: 240px
}
head:first-child+body thead[class].fixedHeader th + th + th {
?border-right: none;
?padding: 4px 4px 4px 3px;
?width: 316px
}
/* define width of TH elements: 1st, 2nd, and 3rd respectively.????? */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
/* Add 16px to last TH for scrollbar padding???????????????????????? */
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors??? */
head:first-child+body tbody[class].scrollContent td {
?width: 200px
}
head:first-child+body tbody[class].scrollContent td + td {
?width: 240px
}
head:first-child+body tbody[class].scrollContent td + td + td {
?border-right: none;
?padding: 2px 4px 2px 3px;
?width: 300px
}
-->
</style>
</head><body>
<h1>(Almost) Pure CSS Scrollable Table with Fixed Header</h1>
<h2>Using CSS to allow scrolling within a single HTML table</h2>
<div><br/></div>
<h2>The Bullet Resistant Version</h2>
<h3>Lots of CSS Browser Filtering</h3>
<form id="sampleForm" action="bulletVersion.html" method="post">
<div id="tableContainer" class="tableContainer">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="scrollTable">
<thead class="fixedHeader" id="fixedHeader">
?<tr>
??<th><a href="#">Header 1</a></th>
??<th><a href="#">Header 2</a></th>
??<th><a href="#">Header 3</a></th>
?</tr>
</thead>
<tbody class="scrollContent">
?<tr>
??<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla vitae wisi. Nulla euismod aliquet tellus.</td>
??<td>In sit amet enim. Praesent vulputate tortor nec ante. Morbi sollicitudin est non neque.</td>
??<td>Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos.</td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td><select name="sampleSelect1" id="sampleSelect1"><option>Option 1</option><option>Option 2</option><option>Option 3</option><option>Option 4</option><option>Option 5</option></select></td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td><select name="sampleSelect2" id="sampleSelect2" size="5" multiple="multiple"><option>Option 1</option><option>Option 2</option><option>Option 3</option><option>Option 4</option><option>Option 5</option></select></td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td><input type="text" name="sampleText" id="sampleText" value="This is a sample Text form element" /></td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td><input type="password" name="samplePassword" id="samplePassword" value="password" /></td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td><input type="submit" name="sampleSubmit" id="sampleSubmit" value="Sample Submit Button" /></td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td><input type="reset" name="sampleReset" id="sampleReset" value="Sample Reset Button" /></td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td><input type="button" name="sampleButton" id="sampleButton" value="Sample Button Element" /></td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td><input type="checkbox" name="sampleCheckbox" id="sampleCheckboxA" value="sampleCheckboxA" /> <label for="sampleCheckboxA">Sample Checkbox A</label></td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td><input type="checkbox" name="sampleCheckbox" id="sampleCheckboxB" value="sampleCheckboxB" /> <label for="sampleCheckboxB">Sample Checkbox B</label></td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td><input type="radio" name="sampleRadio" id="sampleRadioA" value="sampleRadioA" /> <label for="sampleRadioA">Sample Radio A</label></td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td><input type="radio" name="sampleRadio" id="sampleRadioB" value="sampleRadioB" /> <label for="sampleRadioB">Sample Radio B</label></td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td><select name="sampleSelect3" id="sampleSelect3"><option>Option 1</option><option>Option 2</option><option>Option 3</option><option>Option 4</option><option>Option 5</option></select></td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td><select name="sampleSelect4" id="sampleSelect4" size="5" multiple="multiple"><option>Option 1</option><option>Option 2</option><option>Option 3</option><option>Option 4</option><option>Option 5</option></select></td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td><textarea cols="20" rows="5" name="sampleTextarea" id="sampleTextarea">Cell Content 3</textarea></td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td>More Cell Content 3</td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td>Even More Cell Content 3</td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td>And Repeat 3</td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td><select name="sampleSelect5" id="sampleSelect5"><option>Option 1</option><option>Option 2</option><option>Option 3</option><option>Option 4</option><option>Option 5</option></select></td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td><select name="sampleSelect6" id="sampleSelect6"><option>Option 1</option><option>Option 2</option><option>Option 3</option><option>Option 4</option><option>Option 5</option></select></td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td>Even More Cell Content 3</td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td>And Repeat 3</td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td>Cell Content 3</td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td>More Cell Content 3</td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td>Even More Cell Content 3</td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td>And Repeat 3</td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td>Cell Content 3</td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td>More Cell Content 3</td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td>Even More Cell Content 3</td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td>And Repeat 3</td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td>Cell Content 3</td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td>More Cell Content 3</td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td>Even More Cell Content 3</td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td>And Repeat 3</td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td>Cell Content 3</td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td>More Cell Content 3</td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td>Even More Cell Content 3</td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td>And Repeat 3</td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td>Cell Content 3</td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td>More Cell Content 3</td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td>Even More Cell Content 3</td>
?</tr>
?<tr>
??<td>And Repeat 1</td>
??<td>And Repeat 2</td>
??<td>And Repeat 3</td>
?</tr>
?<tr>
??<td>Cell Content 1</td>
??<td>Cell Content 2</td>
??<td>Cell Content 3</td>
?</tr>
?<tr>
??<td>More Cell Content 1</td>
??<td>More Cell Content 2</td>
??<td>More Cell Content 3</td>
?</tr>
?<tr>
??<td>Even More Cell Content 1</td>
??<td>Even More Cell Content 2</td>
??<td>Even More Cell Content 3</td>
?</tr>
?<tr>
??<td>End of Cell Content 1</td>
??<td>End of Cell Content 2</td>
??<td>End of Cell Content 3</td>
?</tr>
</tbody>
</table>
</div>
</form>
<div>
?<p>Also see the <a href=" Big Four Version</a> :: Support for current generation of the four major Browsers</p>
?<h3>Browser Support (table is scrollable with fixed headers)</h3>
?<ul>
??<li>Opera 7.x + (All Platforms) :: Tested with 7.2x and 7.5x</li>
??<li>Mozilla 1.x + (All Platforms) :: Tested with 1.0x and 1.6x</li>
??<li>IE 6.x + (Windows) :: Tested with 6.0x</li>
??<li>IE 5.x + (Windows) :: Tested with 5.0x and 5.5x</li>
??<li>Safari 1.x + (MacOS) :: Tested with 1.2x</li>
??<li>Konqueror 3.x + (Linux / BSD) :: Tested with 3.2x</li>
?</ul>
?<h3>Almost works (table is viewable)</h3>
?<ul>
??<li>IE 5.x + (MacOS) :: Tested with 5.2x</li>
??<li>Opera 5.x and 6.x :: Tested with 5.1x and 6.x</li>
?</ul>
?<h3>Degrades gracefully</h3>
?<ul>
??<li>All other non-supporting browsers</li>
?</ul>
?<h3>Notes:</h3>
?<ul>
??<li>Opera v5 to v7 adds margins to the THEAD and TBODY and their children</li>
??<li>On Konqueror 3.x the scrollbar may be slightly off.</li>
??<li>On Konqueror 3.x form elements may not hide correctly.</li>
??<li>On MacIE 5.x the last table header cell may obscure the up arrow of the scrollbar.</li>
??<li>Gecko/20041217 may have table cell alignment issues (bug?), Prior versions (eg: Gecko/20040113) do not have this</li>
?</ul>
?<h3>Updates:</h3>
?<ul>
??<li>2004.10.15 11am: Added link to Big Four Version</li>
??<li>2004.11.02 01pm: Fixed incorrect width on 2nd Cell. Was 250px, should be 240px.</li>
??<li>2005.01.28 07pm: Added form elements to aid in testing scrolling abilities</li>
??<li>2005.01.28 08pm: Added JS IE Select element workaround.</li>
?</ul>
</div>
<div>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
put a bunch of breaks to test scrolling within the HTML document itself.
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
put a bunch of breaks to test scrolling within the HTML document itself.
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
put a bunch of breaks to test scrolling within the HTML document itself.
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
done.
</div>
</body></html>
http://www.imaputz.com/cssStuff/bulletVersion.html