javaGrowing

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

          #

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

          ? ?xls.visible =true; ?//設置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="發卡記錄";
          ? ? // ?xlsheet.Range(xlsheet.Cells(1,1),xlsheet.Cells(1,6)).Interior.ColorIndex=5;//設置底色為藍色
          ? ? ? ? ? ? ? ?// ? xlsheet.Range(xlsheet.Cells(1,1),xlsheet.Cells(1,6)).Font.ColorIndex=4;//設置字體色 ? ? ? ?
          ? // xlsheet.Rows(1). Interior .ColorIndex = 5 ;//設置底色為藍色 ?設置背景色 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="@";


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

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

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

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

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

          問題關鍵:
          ?Engine授權文件有問題?,F在網上Engine9.0的授權文件版本太多了,但有些可以,有些是不能用的。其實我就是被這個問題所困,遲遲不能解決,現將可用的Engine9.0授權文件公布如下(絕對可用):
          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,用以上授權文件注冊。
          ?3、此時部分控件仍然不能用。
          ?4、請將license.dat中的Feature Designe項刪除并保存,重啟License Manager;
          ?5、問題解決。

          2006/10/24

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

          方案一:
          ??? 新裝了系統后,發現在調試程序時TOMCAT提示8080端口已被占用,于是運行NETSTAT -ANO查看端口使用情況,發現8080端口被ORACLE的監聽器給占用了,于是結合上網查到方法,將ORACLE XDB的HTTP服務端口改成8081,問題解決。
          ?
          總結一下可解決的方法:
          一、更改TOMCAT的默認端口
          ???? 相關文件:"TOMCAT ROOT"\conf\server.xml
          ?
          二、使用sys登錄Oracle,利用dbms_xdb修改端口設置
          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,選擇數據庫——XML 數據庫——配置,更改http-port的默認值為8081。

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

          我的數據庫結構是這樣的:

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

          解決思路:
          希望通過hibernate直接建立homepage和subject的1對多關聯關系

          解決方法
          首先我改變原來利用工具生成的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形成一種一對多的關系,我增加的一個
          <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一對多映射的一端必須是主鍵,而且我這里需要關聯的還是2列信息,所以我還必須要修改配置文件的主鍵設置
          <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多對一關聯關系,否則會報告重復錯誤
          <!-- 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的關聯信息也加載進來了


          最后的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>

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

          參考資料:hibernate_reference(3.2)

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

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

          三:重新啟動INTERNET EXPLORER,查看某個網頁的源文件,用戶就會發現打開的程序已經更改了.

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

          僅列出標題
          共19頁: First 上一頁 3 4 5 6 7 8 9 10 11 下一頁 Last 
          主站蜘蛛池模板: 米泉市| 光泽县| 蒙城县| 陆河县| 陆丰市| 丹棱县| 晋州市| 甘南县| 喀喇沁旗| 武义县| 江门市| 封开县| 正安县| 奉节县| 贵定县| 大英县| 大安市| 涿鹿县| 铜川市| 泰宁县| 棋牌| 都匀市| 赣州市| 泾川县| 永新县| 儋州市| 柳林县| 襄城县| 白银市| 星子县| 香格里拉县| 怀宁县| 小金县| 台山市| 江油市| 岑溪市| 冕宁县| 金川县| 夏津县| 全南县| 苏尼特左旗|