javaGrowing

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            92 隨筆 :: 33 文章 :: 49 評論 :: 0 Trackbacks

          #

          function MakeExcel(){
          var i,j;
          ? ?try {
          ? ? ?var xls ? ?= new ActiveXObject ( "Excel.Application" );
          ? ? }
          ? ?catch(e) {
          ? ? ? ? alert( "要打印該表,您必須安裝Excel電子表格軟件,同時瀏覽器須使用“ActiveX 控件”,您的瀏覽器須允許執(zhí)行控件。 請點擊【幫助】了解瀏覽器設(shè)置方法!");
          ? ? ? ? ? ? ?return "";
          ? ? }

          ? ?xls.visible =true; ?//設(shè)置excel為可見

          ? ?var xlBook = xls.Workbooks.Add;
          ? ?var xlsheet = xlBook.Worksheets(1);
          ? ?
          ? ? ?xlsheet.Range(xlsheet.Cells(1,1),xlsheet.Cells(1,7)).mergecells=true;
          ? ? ?xlsheet.Range(xlsheet.Cells(1,1),xlsheet.Cells(1,7)).value="發(fā)卡記錄";
          ? ? // ?xlsheet.Range(xlsheet.Cells(1,1),xlsheet.Cells(1,6)).Interior.ColorIndex=5;//設(shè)置底色為藍(lán)色
          ? ? ? ? ? ? ? ?// ? xlsheet.Range(xlsheet.Cells(1,1),xlsheet.Cells(1,6)).Font.ColorIndex=4;//設(shè)置字體色 ? ? ? ?
          ? // xlsheet.Rows(1). Interior .ColorIndex = 5 ;//設(shè)置底色為藍(lán)色 ?設(shè)置背景色 Rows(1).Font.ColorIndex=4 ?

          ? ?
          ? ?xlsheet.Rows(1).RowHeight = 25;
          ? ?
          ? ?xlsheet.Rows(1).Font.Size=14;
          ? ?
          ? ?xlsheet.Rows(1).Font.Name="黑體";
          ? ?

          ? ?xlsheet.Columns("A:D").ColumnWidth =18;
          ? ?
          ? ?xlsheet.Columns(2).NumberFormatLocal="@";
          ? ?xlsheet.Columns(7).NumberFormatLocal="@";


          ? ? //設(shè)置單元格內(nèi)容自動換行 range.WrapText ?= ?true ?;
          ? ? //設(shè)置單元格內(nèi)容水平對齊方式 range.HorizontalAlignment ?= ?Excel.XlHAlign.xlHAlignCenter;//設(shè)置單元格內(nèi)容豎直堆砌方式
          ? ? ?//range.VerticalAlignment=Excel.XlVAlign.xlVAlignCenter
          ? ?//range.WrapText ?= ?true; ?xlsheet.Rows(3).WrapText=true ?自動換行
          ?
          ? ?//設(shè)置標(biāo)題欄

          ? ? xlsheet.Cells(2,1).Value="卡號";
          ? ? xlsheet.Cells(2,2).Value="密碼";
          ? ? xlsheet.Cells(2,3).Value="計費方式";
          ? ? xlsheet.Cells(2,4).Value="有效天數(shù)";
          ? ? xlsheet.Cells(2,5).Value="金額";
          ? ? xlsheet.Cells(2,6).Value="所屬服務(wù)項目";
          ? ? ? xlsheet.Cells(2,7).Value="發(fā)卡時間";

          ? ? var oTable=document.all['fors:data'];
          ? ? var rowNum=oTable.rows.length;
          ? ? for(i=2;i<=rowNum;i++){
          ? ? for (j=1;j<=7;j++){
          //html table類容寫到excel

          ? ? ? xlsheet.Cells(i+1,j).Value=oTable.rows(i-1).cells(j-1).innerHTML;
          ? ? ? ? ? ?}


          ? ?}
          ? ?
          ? ?// xlsheet.Range(xlsheet.Cells(i, 4), xlsheet.Cells(i-1, 6)).BorderAround , 4
          ? ? // for(mn=1,mn<=6;mn++) . ? ? xlsheet.Range(xlsheet.Cells(1, mn), xlsheet.Cells(i1, j)).Columns.AutoFit;
          ? ? ?xlsheet.Columns.AutoFit;
          ? ? ? ? ? ? ? ? xlsheet.Range( xlsheet.Cells(1,1),xlsheet.Cells(rowNum+1,7)).HorizontalAlignment =-4108;//居中
          ? ? ? ? ? ? ? ? ? xlsheet.Range( xlsheet.Cells(1,1),xlsheet.Cells(1,7)).VerticalAlignment =-4108;
          ? ? ? ? ? ? ? ? xlsheet.Range( xlsheet.Cells(2,1),xlsheet.Cells(rowNum+1,7)).Font.Size=10;

          ? ? ?xlsheet.Range( xlsheet.Cells(2,1),xlsheet.Cells(rowNum+1,7)).Borders(3).Weight = 2; //設(shè)置左邊距
          ? ? ? xlsheet.Range( xlsheet.Cells(2,1),xlsheet.Cells(rowNum+1,7)).Borders(4).Weight = 2;//設(shè)置右邊距
          ? ? ? ? ? ? xlsheet.Range( xlsheet.Cells(2,1),xlsheet.Cells(rowNum+1,7)).Borders(1).Weight = 2;//設(shè)置頂邊距
          ? ? ? xlsheet.Range( xlsheet.Cells(2,1),xlsheet.Cells(rowNum+1,7)).Borders(2).Weight = 2;//設(shè)置底邊距
          xls.UserControl = true; ?//很重要,不能省略,不然會出問題 意思是excel交由用戶控制
          ? ? ? xls=null;
          ? ? ? xlBook=null;
          ? ? ? xlsheet=null;

          }
          posted @ 2006-11-09 21:24 javaGrowing 閱讀(640) | 評論 (0)編輯 收藏

          問題:
          ?1、同時安裝Desktop、Engine,Engine部分控件不能用,老是提示要授權(quán)。
          ?2、將Desktop卸載,Engine大多數(shù)控件能用,少部分不能用。

          問題關(guān)鍵:
          ?Engine授權(quán)文件有問題。現(xiàn)在網(wǎng)上Engine9.0的授權(quán)文件版本太多了,但有些可以,有些是不能用的。其實我就是被這個問題所困,遲遲不能解決,現(xiàn)將可用的Engine9.0授權(quán)文件公布如下(絕對可用):
          3dengine,9,ecp379783729,none,D7MGJE2110L5J9HSX169
          designer,9,ecp240010879,none,GB20C3RM03HXNTNE9005
          gdbedit,9,ecp180013971,none,PMYP34S0PBAM2T8AG239
          spatialengine,9,ecp339810398,none,8SJA84S0PDJ94P7EJ048
          standardengine,9,ecp100001222,none,6PC42XLJH4C5LMZ59217
          streetmapengine,9,ecp299948323,none,1JHDJK988L2MC2EN0146?

          解決方法:
          ?1、安裝Desktop,配置License Manager,過程我就不說了吧;
          ?2、安裝Engine,用以上授權(quán)文件注冊。
          ?3、此時部分控件仍然不能用。
          ?4、請將license.dat中的Feature Designe項刪除并保存,重啟License Manager;
          ?5、問題解決。

          2006/10/24

          解決Oracle 9i和Tomcat端口沖突(轉(zhuǎn)載)

          方案一:
          ??? 新裝了系統(tǒng)后,發(fā)現(xiàn)在調(diào)試程序時TOMCAT提示8080端口已被占用,于是運行NETSTAT -ANO查看端口使用情況,發(fā)現(xiàn)8080端口被ORACLE的監(jiān)聽器給占用了,于是結(jié)合上網(wǎng)查到方法,將ORACLE XDB的HTTP服務(wù)端口改成8081,問題解決。
          ?
          總結(jié)一下可解決的方法:
          一、更改TOMCAT的默認(rèn)端口
          ???? 相關(guān)文件:"TOMCAT ROOT"\conf\server.xml
          ?
          二、使用sys登錄Oracle,利用dbms_xdb修改端口設(shè)置
          SQL> call dbms_xdb.cfg_update(updateXML(
          ??? 2??????? dbms_xdb.cfg_get()
          ??? 3????? , '/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()'
          ??? 4????? , 8081))
          ??? 5? /
          ??? 運行完后提示:Call completed.
          接著
          SQL> COMMIT;
          ??? 提示:Commit complete.
          SQL> EXEC dbms_xdb.cfg_refresh;
          ??? 提示:PL/SQL procedure successfully completed.
          三、使用Enterprise Manager Console,選擇數(shù)據(jù)庫——XML 數(shù)據(jù)庫——配置,更改http-port的默認(rèn)值為8081。

          方案二:
          ??? 安裝Oracle數(shù)據(jù)庫后,當(dāng)我們訪問8080端口時,會彈出一個XDB窗口,要求輸入用戶名和密碼。這樣將和我們本地一些使用該端口的應(yīng)用沖突,比如tomcat、jboss等,雖然這些端口是可以修改的,但總是不爽oracle一直占用這個端口。
          ??? Oracle數(shù)據(jù)庫可以使用TCP協(xié)議通過8080端口進(jìn)行連接,所以占用了8080端口。
          要取消占用,可以打開Oracle安裝目錄下的database目錄內(nèi)的SPFILE[SID名].ORA文件進(jìn)行修改。這個文件是Oracle的啟動配置文件。
          把其中的*.dispatchers='(PROTOCOL=TCP) (SERVICE=or9iXDB)'這一行去掉即可。
          然后重啟計算機(jī),或者在服務(wù)中重啟OracleService[SID名]這個服務(wù)。重啟后可能無法使用Enterprise Manager Console和其他客戶端連接,這時請使用Oracle的Configuration and Migration Tools/Net Configuration Assistant工具刪除監(jiān)聽器,然后新建一個監(jiān)聽器,重啟監(jiān)聽器。
          使用Configuration and Migration Tools/Net Manager工具,將服務(wù)命名刪除,然后新建一個。
          現(xiàn)在Oracle應(yīng)該就可以正常使用,8080也不會占用了。
          補(bǔ)充:
          其實這與服務(wù)的啟動順序有關(guān),可以先把oracle監(jiān)聽器服務(wù)設(shè)為手動,tomcat設(shè)為自動,重啟電腦,測試http://localhost:8080,這時可以看到大貓了,哈哈...然后再把oracle監(jiān)聽器啟動,就不會沖突了。
          posted @ 2006-11-09 09:13 javaGrowing 閱讀(617) | 評論 (1)編輯 收藏

          response.setHeader("Cache-Control","no-cache"); //HTTP 1.1

          ?response.setHeader("Pragma","no-cache"); //HTTP 1.0

          ?response.setDateHeader ("Expires", 0); //prevents caching at the proxy server

          posted @ 2006-11-08 14:42 javaGrowing 閱讀(1305) | 評論 (0)編輯 收藏

          我的數(shù)據(jù)庫結(jié)構(gòu)是這樣的:

          首先一開始我可以獲得一個頻道的channelId,我根據(jù)這個channelId得到一個首頁區(qū)塊的List,我在hibernate中配置homepagearea的加載方式,這樣就可以通過homepage的到關(guān)聯(lián)的欄目column(多對一關(guān)系),然后我還是使用hibernate的自動加載,取到column關(guān)聯(lián)的專題subject(一對多關(guān)系)。
          這時候問題出來了,由于column到subject的關(guān)聯(lián)沒有帶channel信息,所以,我取到的subject實際上是一個column下所有的subject,而我期望的是要得到,一個homepagearea下根據(jù)channelId和columnId取得的subject.

          解決思路:
          希望通過hibernate直接建立homepage和subject的1對多關(guān)聯(lián)關(guān)系

          解決方法
          首先我改變原來利用工具生成的hibernate配置文件和entitybean
          先列出原來的homepagearea的配置文件
          <?xml version="1.0"?>
          <!DOCTYPE hibernate-mapping PUBLIC
          ??? "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          ??? "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

          <hibernate-mapping>
          <class
          ??? name="com.easou.wapsearch.channel.entity.CsHomepageArea"
          ??? table="CS_HOMEPAGE_AREA"
          ??? schema="WAPUSER"
          ??? lazy="true"
          >
          ??? <id
          ??????? name="id"
          ??????? type="long"
          ??????? column="ID"
          ??????? length="22"
          ??? >
          ??? ?<generator class="assigned">
          ??? ??
          ??? ?</generator>
          ??? </id>
          ??? <property
          ??????? name="createdBy"
          ??????? type="long"
          ??????? column="CREATED_BY"
          ??????? length="22"
          ??? />
          ??? <property
          ??????? name="createdDate"
          ??????? type="timestamp"
          ??????? column="CREATED_DATE"
          ??????? length="7"
          ??? />
          ??? <property
          ??????? name="isMore"
          ??????? type="long"
          ??????? column="IS_MORE"
          ??????? length="22"
          ??? />
          ??? <property
          ??????? name="name"
          ??????? type="string"
          ??????? column="NAME"
          ??????? length="50"
          ??? />
          ??? <property
          ??????? name="rowCount"
          ??????? type="long"
          ??????? column="ROW_COUNT"
          ??????? length="22"
          ??? />
          ??? <property
          ??????? name="showCount"
          ??????? type="long"
          ??????? column="SHOW_COUNT"
          ??????? length="22"
          ??? />
          ??? <property
          ??????? name="theOrder"
          ??????? type="long"
          ??????? column="THE_ORDER"
          ??????? length="22"
          ??? />
          ??? <property
          ??????? name="updateBy"
          ??????? type="long"
          ??????? column="UPDATE_BY"
          ??????? length="22"
          ??? />
          ??? <property
          ??????? name="updateDate"
          ??????? type="timestamp"
          ??????? column="UPDATE_DATE"
          ??????? length="7"
          ??? />

          ??? <!-- Associations -->
          ??? <!-- bi-directional many-to-one association to CsChannel -->
          ??? <many-to-one
          ??????? name="csChannel"???????
          ??? >
          ??????? <column name="CHANNEL_ID" length="22"/>
          ??? </many-to-one>
          ??? <!-- bi-directional many-to-one association to CsColumn -->
          ??? <many-to-one
          ??????? name="csColumn"???????
          ??? >
          ??????? <column name="COLUMN_ID" length="22"/>
          ??? </many-to-one>

          </class>
          </hibernate-mapping>

          為了讓homepagearea和subject形成一種一對多的關(guān)系,我增加的一個
          <set name="csSubjects" inverse="true" cascade="save-update"
          ???lazy="false" order-by="THE_ORDER" table="CS_SUBJECT"
          ???outer-join="true">
          ???<key>
          ????<column name="CHANNEL_ID" index="CHANNEL_ID" />
          ????<column name="COLUMN_ID" index="COLUMN_ID" />
          ???</key>
          ???<one-to-many
          ????class="com.easou.wapsearch.channel.entity.CsSubject" />
          </set>
          但是由于hibernate一對多映射的一端必須是主鍵,而且我這里需要關(guān)聯(lián)的還是2列信息,所以我還必須要修改配置文件的主鍵設(shè)置
          <composite-id mapped="false" unsaved-value="none">
          ????? <key-many-to-one name="csChannel" column="CHANNEL_ID"></key-many-to-one>
          ???<key-many-to-one name="csColumn" column="COLUMN_ID"></key-many-to-one>
          </composite-id>
          并且遮蔽掉原有的channel和column多對一關(guān)聯(lián)關(guān)系,否則會報告重復(fù)錯誤
          <!-- Associations
          ?? bi-directional many-to-one association to CsChannel
          ??<many-to-one name="csChannel" lazy="true">
          ???<column name="CHANNEL_ID" length="22" />
          ??</many-to-one>
          ?? bi-directional many-to-one association to CsColumn
          ??<many-to-one name="csColumn" lazy="true">
          ???<column name="COLUMN_ID" length="22" />
          ??</many-to-one>

          ??-->
          這樣hibernate才會在加載homepagearea時自動把subject的關(guān)聯(lián)信息也加載進(jìn)來了


          最后的homepagearea配置文件
          <?xml version="1.0"?>
          <!DOCTYPE hibernate-mapping PUBLIC
          ??? "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          ??? "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

          <hibernate-mapping>
          ?<class name="com.easou.wapsearch.channel.entity.CsHomepageArea"
          ??table="CS_HOMEPAGE_AREA" schema="WAPUSER" lazy="true">
          ??<composite-id mapped="false" unsaved-value="none">
          ????? <key-many-to-one name="csChannel" column="CHANNEL_ID"></key-many-to-one>
          ???<key-many-to-one name="csColumn" column="COLUMN_ID"></key-many-to-one>
          ??</composite-id>
          ??<property name="createdBy" type="long" column="CREATED_BY"
          ???length="22" />
          ??<property name="createdDate" type="timestamp"
          ???column="CREATED_DATE" length="7" />
          ??<property name="isMore" type="long" column="IS_MORE"
          ???length="22" />
          ??<property name="name" type="string" column="NAME" length="50" />
          ??<property name="rowCount" type="long" column="ROW_COUNT"
          ???length="22" />
          ??<property name="showCount" type="long" column="SHOW_COUNT"
          ???length="22" />
          ??<property name="theOrder" type="long" column="THE_ORDER"
          ???length="22" />
          ??<property name="updateBy" type="long" column="UPDATE_BY"
          ???length="22" />
          ??<property name="updateDate" type="timestamp"
          ???column="UPDATE_DATE" length="7" />

          ??<!-- Associations
          ?? bi-directional many-to-one association to CsChannel
          ??<many-to-one name="csChannel" lazy="true">
          ???<column name="CHANNEL_ID" length="22" />
          ??</many-to-one>
          ?? bi-directional many-to-one association to CsColumn
          ??<many-to-one name="csColumn" lazy="true">
          ???<column name="COLUMN_ID" length="22" />
          ??</many-to-one>

          ??-->
          ??<set name="csSubjects" inverse="true" cascade="save-update"
          ???lazy="false" order-by="THE_ORDER" table="CS_SUBJECT"
          ???outer-join="true">
          ???<key>
          ????<column name="CHANNEL_ID" index="CHANNEL_ID" />
          ????<column name="COLUMN_ID" index="COLUMN_ID" />
          ???</key>
          ???<one-to-many
          ????class="com.easou.wapsearch.channel.entity.CsSubject" />

          ??</set>


          ?</class>

          </hibernate-mapping>

          經(jīng)驗總結(jié):
          1、本來使用hibernate的加載策略就是為了把一些業(yè)務(wù)邏輯直接融合在數(shù)據(jù)庫關(guān)系當(dāng)中,但是由于自己邏輯沒有考慮清楚造成了加載時信息的丟失(而且我覺得我的表結(jié)構(gòu)有問題,不知有有沒有dba給我指點一下問題)。
          2、hibernate的一對多關(guān)聯(lián)關(guān)系多端是1端是針對主鍵的,所以不論你是關(guān)聯(lián)的是1列2列還是3列,它們都應(yīng)該是你的1端的主鍵或者聯(lián)合主鍵(其實一對一,多對一,多對多的原理也是相似的)。

          參考資料:hibernate_reference(3.2)

          posted @ 2006-11-08 11:50 javaGrowing 閱讀(382) | 評論 (0)編輯 收藏

          用戶在瀏覽網(wǎng)頁時,如果在網(wǎng)頁中單擊鼠標(biāo)右鍵并選擇菜單中的“查看源文件”選項后,系統(tǒng)就會調(diào)用記事本打開該網(wǎng)頁的HTML源文件,用戶可以通過修改注冊表來更改默認(rèn)的打開程序,然后如下:
          一:打開注冊表。
          “開始”菜單->“運行”->輸入 regedit 然后點確定。
          二:打開HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\INTERNET EXPLORER,在其下新建一個主鍵"View Source Editor",在其下再新一個主鍵"Editor Name",又擊右側(cè)窗口中的"默認(rèn)"將數(shù)值設(shè)為更換程序的路徑及文件名.

          三:重新啟動INTERNET EXPLORER,查看某個網(wǎng)頁的源文件,用戶就會發(fā)現(xiàn)打開的程序已經(jīng)更改了.

          posted @ 2006-11-06 20:19 javaGrowing 閱讀(300) | 評論 (0)編輯 收藏

          僅列出標(biāo)題
          共19頁: First 上一頁 3 4 5 6 7 8 9 10 11 下一頁 Last 
          主站蜘蛛池模板: 库伦旗| 公主岭市| 汾西县| 永福县| 潜江市| 绥阳县| 高州市| 荆州市| 墨脱县| 西华县| 山东省| 博乐市| 惠州市| 湘潭县| 龙里县| 城步| 山阴县| 清水河县| 江门市| 紫阳县| 屏山县| 太原市| 清流县| 宜兴市| 旬阳县| 玉溪市| 漳浦县| 乌兰察布市| 南川市| 全椒县| 黔南| 巨野县| 太仆寺旗| 如皋市| 汝南县| 尉犁县| 丰镇市| 修武县| 夏河县| 广平县| 建昌县|