心的方向

          新的征途......
          posts - 75,comments - 19,trackbacks - 0

          今天要實(shí)現(xiàn)一個(gè)在頁(yè)面中動(dòng)態(tài)添加以及刪除一行列表的功能,查找了幾種方法,在此備份,以便日后使用:

          ========================此方法比較簡(jiǎn)潔,而且可以解決問題========================
          function deleteCurrentRow()//刪除當(dāng)前行
          {
            var currRowIndex=event.srcElement.parentNode.parentNode.rowIndex;
            document.all.table10.deleteRow(currRowIndex);//table10--表格id
          }


          function insertRow()
          {
            var nRow=document.all.table10.rows.length; //表格的總行數(shù)
            var objTheRow=document.all.table10.insertRow(nRow);//在最下邊新增一行
            objTheRow.insertCell(0);//新增一個(gè)單元格
            objTheRow.insertCell(1);
            objTheRow.insertCell(2);
            objTheRow.cells(0).innerHTML=nRow;//對(duì)新增的單元格?容
            objTheRow.cells(1).innerHTML=" ";
            objTheRow.cells(2).innerHTML="<input type='button' value='del this row' onClick='deleteCurrentRow()'>";
          }

          ====================我的程序代碼======================
          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
          <HTML>
          <HEAD>
          <META http-equiv="Content-Type" content="text/html; charset=GB18030">
          <META name="GENERATOR" content="IBM WebSphere Studio">
          <TITLE>cfbcard.html</TITLE>
          </HEAD>

          <SCRIPT language="JavaScript">
          var j_1 = 1;
          function add_row_family(){
           newRow=document.all.family.insertRow(-1) 
           
           newcell=newRow.insertCell() 
           newRow.bgColor='#FFFFFF';
           newcell.className='STYLE3';
           newcell.align='center';
           //newcell.innerHTML="<input type='text' name='familyname"+j_1+"' style='WIDTH: 60px; font-size:9pt; color:#000000' />";
           newcell.innerHTML="<SELECT name='thesistogether"+j_1+"'>"+
                                  " <option value='請(qǐng)選擇'>"+
                "   請(qǐng)選擇"+
                "  </option>"+
                "  <option value='1'>"+
                "   111"+
                "  </option>"+
                "  <option value='2'>"+
                "   222"+
                "  </option>"+
                "  <option value='3'>"+
                "   333"+
                "  </option>"+
                "  <option value='4'>"+
                "   444"+
                "  </option>"+
                "  <option value='5'>"+
                "   555"+
                "  </option>"+
                
                                 "</SELECT>";
           for(var i = 0;i<12;i++){
           newcell=newRow.insertCell() ;
           newRow.bgColor='#FFFFFF';
           newcell.className='STYLE3';
           newcell.align='center';
           newcell.innerHTML="<input type='text' name='familyrelation"+j_1+"' style='WIDTH: 60px; font-size:9pt; color:#000000' />";
          }
           
           newcell=newRow.insertCell() ;
           newRow.bgColor='#FFFFFF';
           newcell.className='STYLE3';
           newcell.align='center';
           //newcell.innerHTML="<a href='javascript:delTableRow(\""+1+"\")'>刪除</a>";
            newcell.innerHTML="<input type='button' value='刪除' onClick='deleteCurrentRow()'>";

           j_1++;
           document.all.j_1.value=j_1;
           document.all.family.focus();
          }


           
           
           function deleteCurrentRow()//刪除當(dāng)前行
          {
            var currRowIndex=event.srcElement.parentNode.parentNode.rowIndex;
            document.all.family.deleteRow(currRowIndex);//table10--表格id
          }


          </script>

          <body bgcolor="#F5F1F5"  >

          <form name="form1" method="post" action="" onsubmit="">
          <table>
          <tr>
                <td align="right"><INPUT type="button" name="add" onclick="add_row_family();" value="添加"></td>
          </tr>
          <tr>
               <td>
           <table id="family" style="width:100%" border="1" cellspacing="1" cellpadding="2" class="tbMain">
                  <tr>
             <td class="td_name">111</td>
             <td class="td_name">222</td>
             <td class="td_name">333</td>
             <td class="td_name">444</td>
             <td class="td_name">555</td>
             <td class="td_name">666</td>
             <td class="td_name">777</td>
             <td class="td_name">888</td>
             <td class="td_name">999</td>
             <td class="td_name">000</td>
             <td class="td_name">123</td>
             <td class="td_name">456</td>
             <td class="td_name">789</td>
                <td class="td_name">刪除</td>
               </tr>
                 
              </table>
              </td>
           </tr>
          </table>
          </form>
          </body>
          </html>

          =================================另外一種方法==============
          如何刪除表格的行上次講到了如何動(dòng)態(tài)給表格增加行,那么這次就講講如何刪除表格的行了。首先建立一個(gè)表格,
          <table border="1">
           <tr>
            <td>姓名</td>
            <td>地址</td>
           </tr>
           <tbody id="mainbody">
           <tr id="delCell">
            <td>name</td>
            <td>address</td>
           </tr>
           </tbody>
          </table>
          取得tbody的元素var mailbody = document.getElementById("mainbody");,
          接著取得要?jiǎng)h除行的元素var cell = document.getElementById("delCell");
          最后就是從tbody中移去要?jiǎng)h除的行就可以了mainbody.removeChild(cell);
          完整的代碼如下:
          <html>
          <head>
           <title>動(dòng)態(tài)刪除表格的行</title>
           <script type="text/javascript">
           function deleteCell(){
            var mailbody = document.getElementById("mainbody");
            var cell = document.getElementById("delCell");
            if(cell!=undefined){
               mainbody.removeChild(cell);
            }
           }
          </script>
          </head>
          <body>
          <table border="1">
           <tr>
            <td>姓名</td>
            <td>地址</td>
           </tr>
           <tbody id="mainbody">
           <tr id="delCell">
            <td>name</td>
            <td>address</td>
           </tr>
           </tbody>
          </table>

          <input type="button" value="刪除" onclick="deleteCell()"/>
          </body>
          <html>

          posted @ 2007-04-18 23:49 阿偉 閱讀(2938) | 評(píng)論 (2)編輯 收藏

          在jsp中使用smartupload組件上傳文件[轉(zhuǎn)]

          jsp對(duì)上傳文件的支持不象php中支持的那么好,直接做成了函數(shù),也不象asp中要通過組件才能實(shí)現(xiàn)。jsp中可以通過javabean來實(shí)現(xiàn)。但是我們沒有必要自己去寫一個(gè)上載的bean,在網(wǎng)上已經(jīng)有了很多成型的技術(shù),smartupload就是其中的一個(gè)。但是smartupload是將文件先讀到服務(wù)器的內(nèi)存中,所以上傳太大的文件(超過100兆)有可能會(huì)出問題,也算是一個(gè)美中不足吧:)

             先說一下提交的頁(yè)面,smartupload組件要求用字節(jié)流的方式來提交<FORM action="upload.jsp"  encType=multipart/form-data method=post>。下面就是個(gè)例子upload.htm:

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
          <!-- saved from url=(0057)
          http://localhost:8080/jspsmartfile/jsp/uploadTemplate.jsp -->
          <HTML><HEAD>
          <META content="text/html; charset=gb2312" http-equiv=Content-Type>
          <META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
          <BODY bgColor=#e6e6e6><BR>
          <FORM action="upload.jsp"  encType=multipart/form-data method=post>
          <TABLE>
            <TBODY>
            <TR>
              <TD><FONT color=#000000 face=helv,helvetica size=1>&nbsp;&nbsp;File 
                :&nbsp;</FONT>&nbsp;&nbsp;<INPUT  size=60 type=file  name="file"></TD></TR>
                  <TR>
              <TR>
              <TD><FONT color=#000000 face=helv,helvetica size=1>&nbsp;&nbsp;File 
                :&nbsp;</FONT>&nbsp;&nbsp;<INPUT  size=60 type=file  name="file1"></TD></TR>
                  <TR>  
              <TD><FONT color=#000000 face=helv,helvetica size=1>&nbsp;&nbsp;File 
                :&nbsp;</FONT>&nbsp;&nbsp;<INPUT  size=60 type=text  name="text"></TD></TR>
            <TR>
              <TD
          align=right><INPUT type=submit value=Send name="send"></TD></TR></TBODY></TABLE></FORM></BODY></HTML>

            再來看一下接收的頁(yè)面 ,我們把文件上傳到服務(wù)器以后就直接把它再存入數(shù)據(jù)庫(kù)中:upload.jsp

          <%@ page contentType="text/html;charset=gb2312"%>
          <%@ page import="java.sql.*"%>
          <%@ page import="com.jspsmart.upload.*" %>
          <%@ page import="DBstep.iDBManager2000.*"%>
          <%
             
          //實(shí)例化上載bean
              com.jspsmart.upload.SmartUpload mySmartUpload=new com.jspsmart.upload.SmartUpload();
             
          //初始化
              mySmartUpload.initialize(pageContext); 
             
          //設(shè)置上載的最大值
              mySmartUpload.setMaxFileSize(500 * 1024*1024);
             
          //上載文件
              mySmartUpload.upload();
            
          //循環(huán)取得所有上載的文件
             for (int i=0;i<mySmartUpload.getFiles().getCount();i++){
            
          //取得上載的文件
             com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i);
             if (!myFile.isMissing())
              {
            
          //取得上載的文件的文件名
              String myFileName=myFile.getFileName();
             
          //取得不帶后綴的文件名
              String  suffix=myFileName.substring(0,myFileName.lastIndexOf('.'));
             
          //取得后綴名
              String  ext= mySmartUpload.getFiles().getFile(0).getFileExt();  
             
          //取得文件的大小 
              int fileSize=myFile.getSize();
             
          //保存路徑
              String aa=getServletContext().getRealPath("/")+"jsp\\";
              String trace=aa+myFileName;
             
          //取得別的參數(shù)
              String explain=(String)mySmartUpload.getRequest().getParameter("text");
              String send=(String)mySmartUpload.getRequest().getParameter("send");
             
          //將文件保存在服務(wù)器端
              myFile.saveAs(trace,mySmartUpload.SAVE_PHYSICAL);
             
          //下面的是將上載的文件保存到數(shù)據(jù)庫(kù)中
             
          //將文件讀到流中
              java.io.File file = new java.io.File(trace);
              java.io.FileInputStream fis = new java.io.FileInputStream(file);
            out.println(file.length());
            
          //打開數(shù)據(jù)庫(kù)
             ResultSet result=null;
             String mSql=null;
             PreparedStatement prestmt=null;
             DBstep.iDBManager2000 DbaObj=new DBstep.iDBManager2000();
             DbaObj.OpenConnection();
            
          //將文件寫到數(shù)據(jù)庫(kù)中
             mSql="insert into marklist (markname,password,marksize,markdate,MarkBody) values (?,?,?,?,?)";
             prestmt =DbaObj.Conn.prepareStatement(mSql);
             prestmt.setString(1, "aaa1");
             prestmt.setString(2, "0000");
             prestmt.setInt(3, fileSize);
             prestmt.setString(4, DbaObj.GetDateTime());
             prestmt.setBinaryStream(5,fis,(int)file.length());
             DbaObj.Conn.setAutoCommit(true) ;
             prestmt.executeUpdate();
             DbaObj.Conn.commit();
             out.println(("上載成功!!!").toString());
             }
             else
             { out.println(("上載失敗!!!").toString()); }
             }//與前面的if對(duì)應(yīng)
          %>

             再說一下下載,下載分兩種情況1。從數(shù)據(jù)庫(kù)直接下載2。從服務(wù)器上下載

            先說從數(shù)據(jù)庫(kù)直接下載的情形:就是把輸入流從數(shù)據(jù)庫(kù)里讀出來,然后轉(zhuǎn)存為文件

          <%@ page contentType="text/html; charset=gb2312" %>
          <%@ page import="java.sql.*"%>
          <%@ page import="java.io.*" %>
          <%@ page import="DBstep.iDBManager2000.*"%>
          <%
              int bytesum=0;
              int byteread=0;
           
          //打開數(shù)據(jù)庫(kù)
            ResultSet result=null;
            String Sql=null;
            PreparedStatement prestmt=null;
            DBstep.iDBManager2000 DbaObj=new DBstep.iDBManager2000();
            DbaObj.OpenConnection();
           
          //取得數(shù)據(jù)庫(kù)中的數(shù)據(jù)
           Sql="select  *  from  t_local_zhongzhuan ";
           result=DbaObj.ExecuteQuery(Sql);
           result.next();

           //將數(shù)據(jù)庫(kù)中的數(shù)據(jù)讀到流中
          InputStream inStream=result.getBinaryStream("content");
          FileOutputStream fs=new FileOutputStream( "c:/dffdsafd.doc");

            byte[]  buffer =new  byte[1444];
          int length;
              while ((byteread=inStream.read(buffer))!=-1)
              {
                 out.println("<DT><B>"+byteread+"</B></DT>");
                 bytesum+=byteread;
                 System.out.println(bytesum);
             
             
                 fs.write(buffer,0,byteread);
               }
          %>

          再說從服務(wù)器上下載的情形:

          <%@ page contentType="text/html; charset=gb2312" %>
          <%@ page import="java.io.*" %>
          <%
            String fileName = "zsc104.swf".toString();
          f//讀到流中
          InputStream inStream=new FileInputStream("c:/zsc104.swf");
           
          //設(shè)置輸出的格式
            response.reset();
            response.setContentType("bin");
            response.addHeader("Content-Disposition","attachment; filename=\"" + fileName + "\"");
           
          //循環(huán)取出流中的數(shù)據(jù)
            byte[] b = new byte[100];
            int len;
            while((len=inStream.read(b)) >0)
            response.getOutputStream().write(b,0,len);  
            inStream.close();
          %>

             好了,到這里只要不是太大的文件的上傳下載的操作都可以完成了。

          posted @ 2007-04-13 14:10 阿偉 閱讀(317) | 評(píng)論 (0)編輯 收藏


          在頁(yè)面中先設(shè)置一個(gè)hidden來傳遞參數(shù)以便其他頁(yè)面用request.getParameter()獲得,

          hidden必須寫在窗體form中,而且另一個(gè)要得到它的頁(yè)面必須是form中的action指向的頁(yè)

          面,不然得不到。切記!!!

          posted @ 2007-04-12 18:26 阿偉 閱讀(1976) | 評(píng)論 (1)編輯 收藏

          很多網(wǎng)頁(yè)都是框架結(jié)構(gòu)的,在很多的情況下會(huì)通過按鈕點(diǎn)擊事件或鏈接,跳出框架轉(zhuǎn)到其它界面。例如說點(diǎn)擊“注銷登錄”返回到登錄界面。

          一、通過運(yùn)行腳本跳出框架有以下幾種寫法:

          1.  <script language = javascript>window.open('Login.aspx','_top')</script>"

          2.  <script language = javascript>window.open('Login.aspx','_parent')</script>"

          3. <script language = javascript>window.parent.location.href='login.aspx'</script>

          4.    Response.Write("<script>window.parent.opener=null;window.top.close();</script>")

                 Response.Write("<script>window.open('index.aspx','');</script>")

                 這種方法會(huì)先關(guān)閉原框架窗口,再重新打開一個(gè)新的窗口。這在很多功能界面對(duì)瀏覽器進(jìn)行了改變?cè)O(shè)置,而回到登陸界面又用缺省設(shè)置的情況下適用。

          二、鏈接跳出框架

          這種情況就很簡(jiǎn)單了,加上 target="_top" 屬性就可以了。


          posted @ 2007-04-04 13:24 阿偉 閱讀(5681) | 評(píng)論 (4)編輯 收藏

          zilong


          文章來源:http://21958978.spaces.live.com/Lists/cns!A7DF246804AD47BB!102
          posted @ 2007-03-31 10:49 阿偉 閱讀(223) | 評(píng)論 (0)編輯 收藏

          Hibernate??VS? iBATIS

          轉(zhuǎn)之ewolf的工作專欄

          簡(jiǎn)介

          Hibernate 是當(dāng)前最流行的 O/R mapping 框架,當(dāng)前版本是 3.05 。它出身于 sf.net ,現(xiàn)在已經(jīng)成為 Jboss 的一部分了

          iBATIS 是另外一種優(yōu)秀的 O/R mapping 框架,當(dāng)前版本是 2.0 。目前屬于 apache 的一個(gè)子項(xiàng)目了。

          相對(duì) Hibernate O/R ”而言, iBATIS 是一種“ Sql Mapping ”的 ORM 實(shí)現(xiàn)。

          Hibernate 對(duì)數(shù)據(jù)庫(kù)結(jié)構(gòu)提供了較為完整的封裝, Hibernate O/R Mapping 實(shí)現(xiàn)了 POJO 和數(shù)據(jù)庫(kù)表之間的映射,以及 SQL 的自動(dòng)生成和執(zhí)行。程序員往往只需定義好了 POJO 到數(shù)據(jù)庫(kù)表的映射關(guān)系,即可通過 Hibernate 提供的方法完成持久層操作。程序員甚至不需要對(duì) SQL 的熟練掌握, Hibernate/OJB 會(huì)根據(jù)制定的存儲(chǔ)邏輯,自動(dòng)生成對(duì)應(yīng)的 SQL 并調(diào)用 JDBC 接口加以執(zhí)行。

          iBATIS 的著力點(diǎn),則在于 POJO SQL 之間的映射關(guān)系。也就是說, iBATIS 并不會(huì)為程序員在運(yùn)行期自動(dòng)生成 SQL 執(zhí)行。具體的 SQL 需要程序員編寫,然后通過映射配置文件,將 SQL 所需的參數(shù),以及返回的結(jié)果字段映射到指定 POJO

          使用 iBATIS 提供的 ORM 機(jī)制,對(duì)業(yè)務(wù)邏輯實(shí)現(xiàn)人員而言,面對(duì)的是純粹的 Java 對(duì)象,

          這一層與通過 Hibernate 實(shí)現(xiàn) ORM 而言基本一致,而對(duì)于具體的數(shù)據(jù)操作, Hibernate 會(huì)自動(dòng)生成 SQL 語(yǔ)句,而 iBATIS 則要求開發(fā)者編寫具體的 SQL 語(yǔ)句。相對(duì) Hibernate 而言, iBATIS SQL 開發(fā)的工作量和數(shù)據(jù)庫(kù)移植性上的讓步,為系統(tǒng)設(shè)計(jì)提供了更大的自由空間。

          二者的對(duì)比:

          1. ? iBATIS 非常簡(jiǎn)單易學(xué), Hibernate 相對(duì)較復(fù)雜,門檻較高。

          2. ? 二者都是比較優(yōu)秀的開源產(chǎn)品

          3. ? 當(dāng)系統(tǒng)屬于二次開發(fā) , 無(wú)法對(duì)數(shù)據(jù)庫(kù)結(jié)構(gòu)做到控制和修改 , iBATIS 的靈活性將比 Hibernate 更適合

          4. ? 系統(tǒng)數(shù)據(jù)處理量巨大,性能要求極為苛刻,這往往意味著我們必須通過經(jīng)過高度優(yōu)化的 SQL 語(yǔ)句(或存儲(chǔ)過程)才能達(dá)到系統(tǒng)性能設(shè)計(jì)指標(biāo)。在這種情況下 iBATIS 會(huì)有更好的可控性和表現(xiàn)。

          5. ? iBATIS 需要手寫 sql 語(yǔ)句,也可以生成一部分, Hibernate 則基本上可以自動(dòng)生成,偶爾會(huì)寫一些 Hql 。同樣的需求 ,iBATIS 的工作量比 Hibernate 要大很多。類似的,如果涉及到數(shù)據(jù)庫(kù)字段的修改, Hibernate 修改的地方很少,而 iBATIS 要把那些 sql mapping 的地方一一修改。

          6. ? 以數(shù)據(jù)庫(kù)字段一一對(duì)應(yīng)映射得到的 PO Hibernte 這種對(duì)象化映射得到的 PO 是截然不同的,本質(zhì)區(qū)別在于這種 PO 是扁平化的,不像 Hibernate 映射的 PO 是可以表達(dá)立體的對(duì)象繼承,聚合等等關(guān)系的,這將會(huì)直接影響到你的整個(gè)軟件系統(tǒng)的設(shè)計(jì)思路。

          7. ? Hibernate 現(xiàn)在已經(jīng)是主流 O/R Mapping 框架,從文檔的豐富性,產(chǎn)品的完善性,版本的開發(fā)速度都要強(qiáng)于 iBATIS

          8. ? 最關(guān)鍵的一句話是 iBATIS 的作者說的:

          If you are starting a new project and you're in full control of your object model and database design, Hibernate is a good choice of O/R tool.

          If you are accessing any 3rd party databases (e.g. vendor supplied), or you're working with a legacy database, or even just a really poorly designed database, then an O/R mapper might not be capable of handling the situation. That's were an SQL Mapper comes in handy

          ?

          結(jié)論:

          結(jié)論:

          Hibernate 和iBATIS可以說是互相補(bǔ)充,共同發(fā)展的關(guān)系.具體你想用什么要看實(shí)際情況.如果看了上面的文字還是拿不定注意,那就Just to try it.實(shí)踐是檢驗(yàn)真理的唯一標(biāo)準(zhǔn).鞋合不合適,只有試了才知道



          Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=413018


          文章來源:http://21958978.spaces.live.com/Blog/cns!A7DF246804AD47BB!195.entry
          posted @ 2007-03-31 10:49 阿偉 閱讀(212) | 評(píng)論 (0)編輯 收藏

          j2ee的O/R方案真是多,和Hibernate相比,iBatis最大的特點(diǎn)就是小巧,上手很快。看iBatis的文檔2小時(shí)就會(huì)用了,這個(gè)O/R Mapping特點(diǎn)就是簡(jiǎn)單易用。只要有SQL基礎(chǔ),相信你不用教程也能看明白。最新版本2.0(下載)。

          構(gòu)建ibatis基礎(chǔ)代碼
          ibatis 基礎(chǔ)代碼包括:


          1. ibatis 實(shí)例配置
          一個(gè)典型的配置文件如下(具體配置項(xiàng)目的含義見后):
          <?xml version="1.0" encoding="UTF-8" ?>
          <!DOCTYPE sqlMapConfig
          PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
          "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
          <sqlMapConfig>
          <settings
          cacheModelsEnabled="true"
          enhancementEnabled="true"
          lazyLoadingEnabled="true"
          errorTracingEnabled="true"
          maxRequests="32"
          maxSessions="10"
          maxTransactions="5"
          useStatementNamespaces="false"
          />
          <transactionManager type="JDBC">
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          <dataSource type="SIMPLE">
          <property name="JDBC.Driver"
          value="com.p6spy.engine.spy.P6SpyDriver"/>
          <property name="JDBC.ConnectionURL"
          value="jdbc:mysql://localhost/sample"/>
          <property name="JDBC.Username" value="user"/>
          <property name="JDBC.Password" value="mypass"/>
          <property name="Pool.MaximumActiveConnections"
          value="10"/>
          <property name="Pool.MaximumIdleConnections" value="5"/>
          <property name="Pool.MaximumCheckoutTime"
          value="120000"/>
          <property name="Pool.TimeToWait" value="500"/>
          <property name="Pool.PingQuery" value="select 1 from
          ACCOUNT"/>
          <property name="Pool.PingEnabled" value="false"/>
          <property name="Pool.PingConnectionsOlderThan"
          value="1"/>
          <property name="Pool.PingConnectionsNotUsedFor"
          value="1"/>
          </dataSource>
          </transactionManager>
          <sqlMap resource="com/ibatis/sample/User.xml"/>
          </sqlMapConfig>


          2. POJO(Plain Ordinary Java Object)
          下面是我們用作示例的一個(gè)POJO:
          public class User implements Serializable {
          private Integer id;
          private String name;
          private Integer sex;
          private Set addresses = new HashSet();
          /** default constructor */
          public User() {
          }
          public Integer getId() {
          return this.id;
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          }
          public void setId(Integer id) {
          this.id = id;
          }
          public String getName() {
          return this.name;
          }
          public void setName(String name) {
          this.name = name;
          }
          public Integer getSex() {
          return this.sex;
          }
          public void setSex(Integer sex) {
          this.sex = sex;
          }
          }


          3. 映射文件
          與Hibernate 不同。因?yàn)樾枰斯ぞ帉慡QL 代碼,ibatis 的映射文件一般采
          用手動(dòng)編寫(通過Copy/Paste,手工編寫映射文件也并沒想象中的麻煩)。
          針對(duì)上面POJO 的映射代碼如下:
          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE sqlMap
          PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
          "http://www.ibatis.com/dtd/sql-map-2.dtd">
          <sqlMap namespace="User">
          <typeAlias alias="user" type="com.ibatis.sample.User"/>
          <select id="getUser"
          parameterClass="java.lang.String"
          resultClass="user">
          <![CDATA[
          select
          name,
          sex
          from t_user
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          where name = #name#
          ]]>
          </select>
          <update id="updateUser"
          parameterClass="user">
          <![CDATA[
          UPDATE t_user
          SET
          name=#name#,
          sex=#sex#
          WHERE id = #id#
          ]]>
          </update>
          <insert id="insertUser"
          parameterClass="user"
          >
          INSERT INTO t_user (
          name,
          sex)
          VALUES (
          #name#,
          #sex#
          )
          </insert>
          <delete id="deleteUser"
          parameterClass="java.lang.String">
          delete from t_user
          where id = #value#
          </delete>
          </sqlMap>
          從上面的映射文件可以看出,通過<insert>、<delete>、<update>、
          <select>四個(gè)節(jié)點(diǎn),我們分別定義了針對(duì)TUser 對(duì)象的增刪改查操作。在這
          四個(gè)節(jié)點(diǎn)中,我們指定了對(duì)應(yīng)的SQL 語(yǔ)句,以u(píng)pdate節(jié)點(diǎn)為例:
          ……
          <update id="updateUser" ⑴
          parameterClass="user"> ⑵
          <![CDATA[ ⑶
          UPDATE t_user ⑷
          SET (
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          name=#name#, ⑸
          sex=#sex# ⑹
          )
          WHERE id = #id# ⑺
          ]]>
          </update>
          ……

          ⑴ ID
          指定了操作ID,之后我們可以在代碼中通過指定操作id 來執(zhí)行此節(jié)點(diǎn)所定
          義的操作,如:
          sqlMap.update("updateUser",user);
          ID設(shè)定使得在一個(gè)配置文件中定義兩個(gè)同名節(jié)點(diǎn)成為可能(兩個(gè)update節(jié)
          點(diǎn),以不同id區(qū)分)

          ⑵ parameterClass
          指定了操作所需的參數(shù)類型, 此例中update 操作以
          com.ibatis.sample.User 類型的對(duì)象作為參數(shù),目標(biāo)是將提供的User
          實(shí)例更新到數(shù)據(jù)庫(kù)。
          parameterClass="user"中,user為“com.ibatis.sample.User”
          類的別名,別名可通過typeAlias節(jié)點(diǎn)指定,如示例配置文件中的:
          <typeAlias alias="user" type="com.ibatis.sample.User"/>

          ⑶ <![CDATA[……]]>
          通過<![CDATA[……]]>節(jié)點(diǎn),可以避免SQL 中與XML 規(guī)范相沖突的字符對(duì)
          XML映射文件的合法性造成影響。

          ⑷ 執(zhí)行更新操作的SQL,這里的SQL 即實(shí)際數(shù)據(jù)庫(kù)支持的SQL 語(yǔ)句,將由
          ibatis填入?yún)?shù)后交給數(shù)據(jù)庫(kù)執(zhí)行。

          ⑸ SQL中所需的用戶名參數(shù),“#name#”在運(yùn)行期會(huì)由傳入的user對(duì)象的name
          屬性填充。

          ⑹ SQL 中所需的用戶性別參數(shù)“#sex#”,將在運(yùn)行期由傳入的user 對(duì)象的
          sex屬性填充。

          ⑺ SQL中所需的條件參數(shù)“#id#”,將在運(yùn)行期由傳入的user對(duì)象的id屬性
          填充。

          對(duì)于這個(gè)示例,ibatis在運(yùn)行期會(huì)讀取id 為“updateUser”的update節(jié)點(diǎn)
          的SQL定義,并調(diào)用指定的user對(duì)象的對(duì)應(yīng)getter方法獲取屬性值,并用此
          屬性值,對(duì)SQL中的參數(shù)進(jìn)行填充后提交數(shù)據(jù)庫(kù)執(zhí)行。
          此例對(duì)應(yīng)的應(yīng)用級(jí)代碼如下,其中演示了ibatis SQLMap的基本使用方法:
          String resource ="com/ibatis/sample/SqlMapConfig.xml";
          Reader reader;
          reader = Resources.getResourceAsReader(resource);
          XmlSqlMapClientBuilder xmlBuilder =
          new XmlSqlMapClientBuilder();
          SqlMapClient sqlMap = xmlBuilder.buildSqlMap(reader);
          (上面代碼調(diào)試不過可用一下代碼代替:
          Reader reader = Resources.getResourceAsReader( resource );
          ??SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);)
          //sqlMap系統(tǒng)初始化完畢,開始執(zhí)行update操作
          try{
          sqlMap.startTransaction();
          User user = new User();
          user.setId(new Integer(1));
          user.setName("Erica");
          user.setSex(new Integer(1));
          sqlMap.update("updateUser",user);
          sqlMap.commitTransaction();
          finally{
          sqlMap.endTransaction();
          }
          其中,SqlMapClient是ibatis運(yùn)作的核心,所有操作均通過SqlMapClient
          實(shí)例完成。
          可以看出,對(duì)于應(yīng)用層而言,程序員面對(duì)的是傳統(tǒng)意義上的數(shù)據(jù)對(duì)象,而非JDBC
          中煩雜的ResultSet,這使得上層邏輯開發(fā)人員的工作量大大減輕,同時(shí)代碼更
          加清晰簡(jiǎn)潔。
          數(shù)據(jù)庫(kù)操作在映射文件中加以定義,從而將數(shù)據(jù)存儲(chǔ)邏輯從上層邏輯代碼中獨(dú)立
          出來。
          而底層數(shù)據(jù)操作的SQL可配置化,使得我們可以控制最終的數(shù)據(jù)操作方式,通過
          SQL的優(yōu)化獲得最佳的數(shù)據(jù)庫(kù)執(zhí)行效能,這在依賴SQL自動(dòng)生成的“全自動(dòng)”O(jiān)RM
          機(jī)制中是所難以實(shí)現(xiàn)的。
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          ibatis配置
          結(jié)合上面示例中的ibatis配置文件。下面是對(duì)配置文件中各節(jié)點(diǎn)的說明:
          <?xml version="1.0" encoding="UTF-8" ?>
          <!DOCTYPE sqlMapConfig
          PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
          "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
          <sqlMapConfig>
          <settings ⑴
          cacheModelsEnabled="true"
          enhancementEnabled="true"
          lazyLoadingEnabled="true"
          errorTracingEnabled="true"
          maxRequests="32"
          maxSessions="10"
          maxTransactions="5"
          useStatementNamespaces="false"
          />
          <transactionManager type="JDBC"> ⑵
          <dataSource type="SIMPLE"> ⑶
          <property name="JDBC.Driver"
          value="com.p6spy.engine.spy.P6SpyDriver"/>
          <property name="JDBC.ConnectionURL"
          value="jdbc:mysql://localhost/sample"/>
          <property name="JDBC.Username" value="user"/>
          <property name="JDBC.Password" value="mypass"/>
          <property name="Pool.MaximumActiveConnections"
          value="10"/>
          <property name="Pool.MaximumIdleConnections" value="5"/>
          <property name="Pool.MaximumCheckoutTime"
          value="120000"/>
          <property name="Pool.TimeToWait" value="500"/>
          <property name="Pool.PingQuery" value="select 1 from
          ACCOUNT"/>
          <property name="Pool.PingEnabled" value="false"/>
          <property name="Pool.PingConnectionsOlderThan"
          value="1"/>
          <property name="Pool.PingConnectionsNotUsedFor"
          value="1"/>
          </dataSource>
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          </transactionManager>
          <sqlMap resource="com/ibatis/sample/User.xml"/> ⑷
          <sqlMap resource="com/ibatis/sample/Address.xml"/>
          </sqlMapConfig>

          ⑴ Settings 節(jié)點(diǎn)
          參數(shù) 描述
          cacheModelsEnabled 是否啟用SqlMapClient上的緩存機(jī)制。
          建議設(shè)為"true"
          enhancementEnabled 是否針對(duì)POJO啟用字節(jié)碼增強(qiáng)機(jī)制以提升
          getter/setter的調(diào)用效能,避免使用Java
          Reflect所帶來的性能開銷。
          同時(shí),這也為L(zhǎng)azy Loading帶來了極大的性能
          提升。
          建議設(shè)為"true"
          errorTracingEnabled 是否啟用錯(cuò)誤日志,在開發(fā)期間建議設(shè)為"true"
          以方便調(diào)試
          lazyLoadingEnabled 是否啟用延遲加載機(jī)制,建議設(shè)為"true"
          maxRequests 最大并發(fā)請(qǐng)求數(shù)(Statement并發(fā)數(shù))
          maxTransactions 最大并發(fā)事務(wù)數(shù)
          maxSessions 最大Session 數(shù)。即當(dāng)前最大允許的并發(fā)
          SqlMapClient數(shù)。
          maxSessions設(shè)定必須介于
          maxTransactions和maxRequests之間,即
          maxTransactions<maxSessions=<
          maxRequests
          useStatementNamespaces 是否使用Statement命名空間。
          這里的命名空間指的是映射文件中,sqlMap節(jié)點(diǎn)
          的namespace屬性,如在上例中針對(duì)t_user
          表的映射文件sqlMap節(jié)點(diǎn):
          <sqlMap namespace="User">
          這里,指定了此sqlMap節(jié)點(diǎn)下定義的操作均從
          屬于"User"命名空間。
          在useStatementNamespaces="true"的情
          況下,Statement調(diào)用需追加命名空間,如:
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          sqlMap.update("User.updateUser",use
          r);
          否則直接通過Statement名稱調(diào)用即可,如:
          sqlMap.update("updateUser",user);
          但請(qǐng)注意此時(shí)需要保證所有映射文件中,
          Statement定義無(wú)重名。

          ⑵ transactionManager節(jié)點(diǎn)
          transactionManager 節(jié)點(diǎn)定義了ibatis 的事務(wù)管理器,目前提供了以下幾
          種選擇:
          ? JDBC
          通過傳統(tǒng)JDBC Connection.commit/rollback實(shí)現(xiàn)事務(wù)支持。
          ? JTA
          使用容器提供的JTA服務(wù)實(shí)現(xiàn)全局事務(wù)管理。
          ? EXTERNAL
          外部事務(wù)管理,如在EJB中使用ibatis,通過EJB的部署配置即可實(shí)現(xiàn)自
          動(dòng)的事務(wù)管理機(jī)制。此時(shí)ibatis 將把所有事務(wù)委托給外部容器進(jìn)行管理。
          此外,通過Spring 等輕量級(jí)容器實(shí)現(xiàn)事務(wù)的配置化管理也是一個(gè)不錯(cuò)的選
          擇。關(guān)于結(jié)合容器實(shí)現(xiàn)事務(wù)管理,參見“高級(jí)特性”中的描述。

          ⑶ dataSource節(jié)點(diǎn)
          dataSource從屬于transactionManager節(jié)點(diǎn),用于設(shè)定ibatis運(yùn)行期使
          用的DataSource屬性。
          type屬性: dataSource節(jié)點(diǎn)的type屬性指定了dataSource的實(shí)現(xiàn)類型。
          可選項(xiàng)目:
          ? SIMPLE:
          SIMPLE是ibatis內(nèi)置的dataSource實(shí)現(xiàn),其中實(shí)現(xiàn)了一個(gè)簡(jiǎn)單的
          數(shù)據(jù)庫(kù)連接池機(jī)制, 對(duì)應(yīng)ibatis 實(shí)現(xiàn)類為
          com.ibatis.sqlmap.engine.datasource.SimpleDataSourceFactory。
          ? DBCP:
          基于Apache DBCP 連接池組件實(shí)現(xiàn)的DataSource 封裝,當(dāng)無(wú)容器提
          供DataSource 服務(wù)時(shí),建議使用該選項(xiàng),對(duì)應(yīng)ibatis 實(shí)現(xiàn)類為
          com.ibatis.sqlmap.engine.datasource.DbcpDataSourceFactory。
          ? JNDI:
          使用J2EE 容器提供的DataSource 實(shí)現(xiàn),DataSource 將通過指定
          的JNDI Name 從容器中獲取。對(duì)應(yīng)ibatis 實(shí)現(xiàn)類為
          com.ibatis.sqlmap.engine.datasource.JndiDataSourceFacto
          ry。
          dataSource的子節(jié)點(diǎn)說明(SIMPLE&DBCP):
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          參數(shù) 描述
          JDBC.Driver JDBC 驅(qū)動(dòng)。
          如:org.gjt.mm.mysql.Driver
          JDBC.ConnectionURL 數(shù)據(jù)庫(kù)URL。
          如:jdbc:mysql://localhost/sample
          如果用的是SQLServer JDBC Driver,需要
          在url后追加SelectMethod=Cursor以獲得
          JDBC事務(wù)的多Statement支持。
          JDBC.Username 數(shù)據(jù)庫(kù)用戶名
          JDBC.Password 數(shù)據(jù)庫(kù)用戶密碼
          Pool.MaximumActiveConn
          ections
          數(shù)據(jù)庫(kù)連接池可維持的最大容量。
          Pool.MaximumIdleConnec
          tions
          數(shù)據(jù)庫(kù)連接池中允許的掛起(idle)連接數(shù)。
          以上子節(jié)點(diǎn)適用于SIMPLE 和DBCP 模式,分別針對(duì)SIMPLE 和DBCP 模式的
          DataSource私有配置節(jié)點(diǎn)如下:
          SIMPLE:
          參數(shù) 描述
          Pool.MaximumCheckoutTi
          me
          數(shù)據(jù)庫(kù)聯(lián)接池中,連接被某個(gè)任務(wù)所允許占用的
          最大時(shí)間,如果超過這個(gè)時(shí)間限定,連接將被強(qiáng)
          制收回。(毫秒)
          Pool.TimeToWait 當(dāng)線程試圖從連接池中獲取連接時(shí),連接池中無(wú)
          可用連接可供使用,此時(shí)線程將進(jìn)入等待狀態(tài),
          直到池中出現(xiàn)空閑連接。此參數(shù)設(shè)定了線程所允
          許等待的最長(zhǎng)時(shí)間。(毫秒)
          Pool.PingQuery 數(shù)據(jù)庫(kù)連接狀態(tài)檢測(cè)語(yǔ)句。
          某些數(shù)據(jù)庫(kù)在連接在某段時(shí)間持續(xù)處于空閑狀態(tài)
          時(shí)會(huì)將其斷開。而連接池管理器將通過此語(yǔ)句檢
          測(cè)池中連接是否可用。
          檢測(cè)語(yǔ)句應(yīng)該是一個(gè)最簡(jiǎn)化的無(wú)邏輯SQL。
          如“select 1 from t_user”,如果執(zhí)行此語(yǔ)句
          成功,連接池管理器將認(rèn)為此連接處于可用狀態(tài)。
          Pool.PingEnabled 是否允許檢測(cè)連接狀態(tài)。
          Pool.PingConnectionsOl
          derThan
          對(duì)持續(xù)連接時(shí)間超過設(shè)定值(毫秒)的連接進(jìn)行
          檢測(cè)。
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          Pool.PingConnectionsNo
          tUsedFor
          對(duì)空閑超過設(shè)定值(毫秒)的連接進(jìn)行檢測(cè)。
          DBCP:
          參數(shù) 描述
          Pool.MaximumWait 當(dāng)線程試圖從連接池中獲取連接時(shí),連接池中無(wú)
          可用連接可供使用,此時(shí)線程將進(jìn)入等待狀態(tài),
          直到池中出現(xiàn)空閑連接。此參數(shù)設(shè)定了線程所允
          許等待的最長(zhǎng)時(shí)間。(毫秒)
          Pool.ValidationQuery 數(shù)據(jù)庫(kù)連接狀態(tài)檢測(cè)語(yǔ)句。
          某些數(shù)據(jù)庫(kù)在連接在某段時(shí)間持續(xù)處于空閑狀態(tài)
          時(shí)會(huì)將其斷開。而連接池管理器將通過此語(yǔ)句檢
          測(cè)池中連接是否可用。
          檢測(cè)語(yǔ)句應(yīng)該是一個(gè)最簡(jiǎn)化的無(wú)邏輯SQL。
          如“select 1 from t_user”,如果執(zhí)行此語(yǔ)句
          成功,連接池管理器將認(rèn)為此連接處于可用狀態(tài)。
          Pool.LogAbandoned 當(dāng)數(shù)據(jù)庫(kù)連接被廢棄時(shí),是否打印日志。
          Pool.RemoveAbandonedTi
          meout
          數(shù)據(jù)庫(kù)連接被廢棄的最大超時(shí)時(shí)間
          Pool.RemoveAbandoned 當(dāng)連接空閑時(shí)間超過
          RemoveAbandonedTimeout時(shí),是否將其廢
          棄。
          JNDI由于大部分配置是在應(yīng)用服務(wù)器中進(jìn)行,因此ibatis中的配置相對(duì)簡(jiǎn)單,下面
          是分別使用JDBC和JTA事務(wù)管理的JDNI配置:
          使用JDBC事務(wù)管理的JNDI DataSource配置
          <transactionManager type="JDBC" >
          <dataSource type="JNDI">
          <property name="DataSource"
          value="java:comp/env/jdbc/myDataSource"/>
          </dataSource>
          </transactionManager>
          <transactionManager type="JTA" >
          <property name="UserTransaction"
          value="java:/ctx/con/UserTransaction"/>
          <dataSource type="JNDI">
          <property name="DataSource"
          value="java:comp/env/jdbc/myDataSource"/>
          </dataSource>
          IBATIS Developer’s Guide Version 1.0
          September 2, 2004 So many open source projects. Why not Open your Documents?
          </transactionManager>

          ⑷ sqlMap節(jié)點(diǎn)
          sqlMap 節(jié)點(diǎn)指定了映射文件的位置,配置中可出現(xiàn)多個(gè)sqlMap 節(jié)點(diǎn),以指定
          項(xiàng)目?jī)?nèi)所包含的所有映射文件。

          Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=669112


          文章來源:http://21958978.spaces.live.com/Blog/cns!A7DF246804AD47BB!196.entry
          posted @ 2007-03-31 10:49 阿偉 閱讀(381) | 評(píng)論 (0)編輯 收藏
          inner join&left outer join&right outer join
          left outer join === left join
          rirht outer join === right join
          full outer join === full join
          inner join? === A = B
          ?
          no full inner join
          no left inner join
          no right inner join
          ?
          they are the same as the "inner join"
          ?
          ?
          ?
          ?
          Join types

          By default, a join is assumed to be an inner join. You can also request other types of joins by clicking Join Type on the Joins page of SQL Assist. The following types of joins are available:

          • Inner join
          • Left outer join
          • Right outer join
          • Full outer join

          7 An inner join is join method in which 7 a column that is not common to all of the tables being joined is dropped from 7 the resultant table. If your database supports the OUTER JOIN keywords, you 7 can extend the inner join to add rows from one table that have no matching 7 rows in the other table.

          For example, you want to join two tables to get the last name of the manager for each department. The first table is a Department table that lists the employee number of each department manager. The second table is an Employee table that lists the employee number and last name of each employee. However, some departments do not have a manager; in these cases, the employee number of the department manager is null. To include all departments regardless of whether they have a manager, and the last name of the manager, if one exists, you create a left outer join. The left outer join includes rows in the first table that match the second table or are null. The resulting SQL statement is as follows:

          SELECT DEPTNO, DEPTNAME, EMPNO, LASTNAME
             FROM DEPARTMENT LEFT OUTER JOIN EMPLOYEE
                ON MGRNO = EMPNO 

          A right outer join is the same as a left outer join, except that it includes rows in the second table that match the first table or are null. A full outer join includes matching rows and null rows from both tables.

          For example, you have two tables, Table 1 and Table 2, with the following data:

          Table 1. Table 1
          Column A Column B
          1 A
          2 B
          3 C
          Table 2. Table 2
          Column C Column D
          2 X
          4 2

          You specify a join condition of Column A = Column C. The result tables for the different types of joins are as follows:

          Inner join
          Table 3. Inner join result table
          Column A Column B Column C Column D
          2 B 2 X
          Left outer join
          Table 4. Left outer join result table
          Column A Column B Column C Column D
          1 A null null
          2 B 2 X
          3 C null null
          Right outer join
          Table 5. Right outer join result table
          Column A Column B Column C Column D
          2 B 2 X
          null null 4 2
          Full outer join
          Table 6. Full outer join result table
          Column A Column B Column C Column D
          1 A null null
          2 B 2 X
          3 C null null
          null null 4 2

          If you specify value (a,c), you obtain the following result:

          Table 7. Result of value (a,c)
          Value (a,c)
          1
          2
          3
          4
          Related concepts

          文章來源:http://21958978.spaces.live.com/Blog/cns!A7DF246804AD47BB!197.entry
          posted @ 2007-03-31 10:49 阿偉 閱讀(1143) | 評(píng)論 (0)編輯 收藏
          刻錄光碟超刻方法
          [size=2]最近在學(xué)習(xí)刻盤,剛好在wuyou看到一篇“刻錄光碟如何設(shè)置超刻”,轉(zhuǎn)過來一起學(xué)習(xí)一下。
          具體方法如下:
          1.啟動(dòng)NERO到如下畫面:
          [b]
          [img]http://bbs.crsky.com/1128632305/Mon_0702/6_181952_4b6f4a1db0f69cd.jpg[/img]

          2、在開始刻錄前首先需要在Nero中進(jìn)行參數(shù)設(shè)置,設(shè)置方法如下:
          [b]
          [img]http://bbs.crsky.com/1128632305/Mon_0702/6_181952_4be2b6e9fb19105.jpg[/img]

          單擊菜單:文件-設(shè)置--高級(jí)屬性,按圖設(shè)置:
          [b]
          [img]http://bbs.crsky.com/1128632305/Mon_0702/6_181952_09ddc4bcc1c9789.jpg[/img]

          3、從“文件”菜單下選擇“刻錄鏡像文件”,然后單擊工具欄上的刻錄按鈕,在刻錄方式下選擇“光盤一次刻錄”選項(xiàng)。
          4、這時(shí)Nero會(huì)提醒光盤容量不足,不用理會(huì),之后會(huì)出現(xiàn)以下提示信息,單擊“刻錄超燒光盤”按鈕開始刻錄。 接下來只要等待刻錄結(jié)束即可。[/size]
          [b]
          [img]http://bbs.crsky.com/1128632305/Mon_0702/6_181952_f6705fd32f2e2a2.jpg[/img]

          文章來源:http://21958978.spaces.live.com/Blog/cns!A7DF246804AD47BB!198.entry
          posted @ 2007-03-31 10:49 阿偉 閱讀(311) | 評(píng)論 (0)編輯 收藏
          Nero超刻方法
          ?
          2006-10-06 22:28:58
          ?
          大中小
          中文NERO
          ??? 首先,看你的刻錄機(jī)是否支持超刻。
          ??? 打開,Nero Burning ROM,菜單:
          刻錄器>>選擇刻錄器...,或快捷鍵CTRL+R,選中刻錄機(jī),看刻錄機(jī)屬性,如果提示是:“超燒功能:支持
          ”,那就可以超刻。有的nero版本有刻錄精靈,一定要關(guān)閉。
          ?
          ??? 然后,測(cè)試盤片最大超刻容量。
          ??? 放入CD-R,打開Nero ToolKit中的Nero CD-DVD Speed,選擇“其它”->(超刻測(cè)試...)。用它可以
          測(cè)試最大超刻容量。點(diǎn)擊“開始”按鈕,超刻測(cè)試開始。測(cè)試完成,軟件能把測(cè)試的最大時(shí)間(容量)以
          數(shù)據(jù)庫(kù)的形式保存起來,這個(gè)工具同時(shí)能夠檢測(cè)碟片的ATIP信息和給出碟片制造商和染料代號(hào)等信息。
          ?
          ??? 測(cè)完之后,在Nero Burning ROM菜單:
          ?首先,在菜單:
          文件->參數(shù)選項(xiàng)? ->專家功能
          選中Enable over burn Disk-at-once,打開超刻功能,同時(shí)寫上測(cè)試出的容量(小一點(diǎn)保險(xiǎn))
          ?其次,在文件->專輯信息(F7)->多區(qū)段,選擇無(wú)多區(qū)段。
          ?????? ->刻錄Burn,選擇關(guān)閉光盤Finalize CD,寫入模式Write Method->選擇光盤一次刻錄(Disc-At-
          Once,簡(jiǎn)稱DAO)
          ?? 最后,進(jìn)行刻錄的時(shí)候,跳出的窗口選擇“是”
          ?? 事實(shí)上,超刻與刻錄機(jī),刻錄盤關(guān)系很大,不同的刻錄機(jī)超刻能力不一樣,一般能超刻750M。
          以上的刻錄機(jī)都會(huì)把這點(diǎn)專門說明,因此,你的刻錄機(jī)未必能刻出盤能達(dá)到的超刻容量。
          請(qǐng)謹(jǐn)慎行事.
          英文版NERO
          ??? 首先,看你的刻錄機(jī)是否支持超刻。
          ??? 打開,Nero Burning ROM,菜單:
          ??? Recorder>>Choose Recorder...,或快捷鍵CTRL+R,選中刻錄機(jī),看刻錄機(jī)屬性,如果提示是
          verburn: suppored,那就可以超刻。有的nero版本有刻錄精靈,一定要關(guān)閉。
          ?
          ??? 然后,測(cè)試盤片最大超刻容量。
          ??? 放入CD-R,打開Nero ToolKit中的Nero CD-DVD Speed,選擇Extra->Overburning test...。用它可
          以測(cè)試最大超刻容量。點(diǎn)擊“開始”按鈕,超刻測(cè)試開始。測(cè)試完成,軟件能把測(cè)試的最大時(shí)間(容量)
          以數(shù)據(jù)庫(kù)的形式保存起來,這個(gè)工具同時(shí)能夠檢測(cè)碟片的ATIP信息和給出碟片制造商和染料代號(hào)等信息。
          ?
          ??? 測(cè)完之后,在Nero Burning ROM菜單:
          ? 首先,在菜單:
          File->Preference->Expert Features
          選中Enable over burn Disk-at-once,打開超刻功能,同時(shí)寫上測(cè)試出的容量(小一點(diǎn)保險(xiǎn))
          ? 其次,在文件File->Compilation Properties...(F7)->Multisesion,No Multisesson。
          ????????? ->Burn,選擇關(guān)閉光盤Finalize CD,寫入模式Write Method->選擇光盤一次刻錄(Disc-At-
          Once,簡(jiǎn)稱DAO)
          ?? 最后,進(jìn)行刻錄的時(shí)候,跳出的窗口選擇“是”
          ?? 事實(shí)上,超刻與刻錄機(jī),刻錄盤關(guān)系很大,不同的刻錄機(jī)超刻能力不一樣,一般能超刻750M。
          以上的刻錄機(jī)都會(huì)把這點(diǎn)專門說明,因此,你的刻錄機(jī)未必能刻出盤能達(dá)到的超刻容量。
          --------------------------------------------------------------------------------------------
          名詞解釋——超刻——一般有兩個(gè)意思:
          1、超CD-R容量刻錄。比如一般的CD-R盤片容量為700MB,你想刻入710MB的數(shù)據(jù);
          2、超速刻錄。比如你的刻錄機(jī)是52X,而你買的CD-R盤片標(biāo)稱值是40X,你要用52速刻錄。
          這里的“超刻”是指第一種——超容量刻錄,最大利用CD-R盤片。
          超刻需要具備三個(gè)條件:
          1、刻錄機(jī)支持超刻;
          2、CD-R盤片支持超刻;
          3、刻錄軟件設(shè)置正確。
          所以,超刻前,要先檢測(cè)你的盤片和刻錄機(jī)是否支持;刻錄時(shí),軟件要設(shè)置正確。
          ?
          ?

          文章來源:http://21958978.spaces.live.com/Blog/cns!A7DF246804AD47BB!199.entry
          posted @ 2007-03-31 10:49 阿偉 閱讀(723) | 評(píng)論 (0)編輯 收藏
          僅列出標(biāo)題
          共8頁(yè): 上一頁(yè) 1 2 3 4 5 6 7 8 下一頁(yè) 
          主站蜘蛛池模板: 石城县| 仁寿县| 忻城县| 吐鲁番市| 遂川县| 金湖县| 咸宁市| 晴隆县| 合作市| 深水埗区| 高淳县| 安平县| 怀仁县| 五河县| 黄大仙区| 阆中市| 政和县| 扬州市| 奎屯市| 革吉县| 古田县| 普定县| 穆棱市| 师宗县| 象山县| 贵州省| 满洲里市| 潮安县| 娄烦县| 富阳市| 平果县| 资兴市| 江口县| 红原县| 游戏| 城市| 文山县| 嘉祥县| 四平市| 思茅市| 新丰县|