2016年8月9日

          財務制度題庫

               摘要: 1財務制度題庫 單選題 1.下列各會計要素,(   )不是反映財務狀況的會計要素。 A.資產          B.負債          C.收入    ...  閱讀全文

          posted @ 2021-10-22 23:09 youngturk| 編輯 收藏

          jquery 向mybitis后臺傳完整時間

          var ssshsj = new Date( $("#ssshsj").val().replace(/-/g,"/")); 對于Ibatis操作Date/Time/DateTime,總結如下: 將pojo的屬性類型設置為java.sql.Date(或java.sql.Time, java.sql.Timestamp),此時會嚴格遵循這三種類型的語義。但此方法因存在前文中提到的性能問題,在JDK1.6以前的JDK版本中能少使用就少使用。 如果你想在pojo中使用java.util.Date, 則要注意: 完整的日期時間,要確保jdbcType為空,或為DATE,TIME以外的值 只需要時間,要指定jdbcType=”TIME” 只需要日期,要指定jdbcType=”DATE”

          posted @ 2017-03-26 00:22 youngturk| 編輯 收藏

          webwork 實現數據生成text文件,并進行壓縮,并進行下載

          //實現壓縮文件功能,采用commons-io-2.0.1.jar ,commons-compress-1.5.jar插件
                  final OutputStream out = new FileOutputStream("D:/EDI/EDi.zip");  //實例文件輸出流
                  ArchiveOutputStream os = new ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.ZIP, out);  
                  //實例化存檔輸出流,工廠方法創建zip的存檔輸出流
          //        File f1 = new File(file.getPath());
                  os.putArchiveEntry(new ZipArchiveEntry(file.getName()));  //生成存檔文件名
                  IOUtils.copy(new FileInputStream(file), os);  //添加拷貝存檔文件
                  
                  os.closeArchiveEntry();  
                  os.close();  
                  
                  //*************************
                  try {
                      File input = new File("D:/EDI/EDi.zip");//獲得下載文件路徑
                      contentType="application/octet-stream";
                      docStream = new FileInputStream(input);//獲得輸入流名稱
                      contentDisposition =URLEncoder.encode(input.getName() ,"UTF-8");
                     } catch (FileNotFoundException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                     }  
                     return "download";
          WEBWORK的文件下載機制。使用起來還是比較簡單的。
          下面是用法說明:
          首先在一個ACTION中,如果判斷有權限進行文件下載。
          則:
          1、讀出該下載文件,并生成一個流。 文件名應當從請求的request中讀出,或從用戶的表中取出。
          public String downLoadFile(String fileName){
             try {
              File input = new File("e:/engilish literature.doc");
              docStream = new FileInputStream(input);
              contentDisposition = "test.txt";
             } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
             }  
             return "download";
          }
          2、將輸出導向到一個特殊的RESULT中去。叫做Steam Result。
                   <action name="register" class="com.job2easy.web.user.RegisterAction">
                       <result name="success" type="dispatcher">
                           <param name="location">/home/register-result.jsp</param>
                       </result>
                       <result name="input">
                           <param name="location">/home/register.jsp</param>
                       </result>
                       <result name="download" type="stream">
                           <param name="contentType">application/x-msdownload</param>
                           <param name="inputName">docStream</param>
                           <param name="bufferSize">1024</param>              
                           <param name="contentDisposition">attachment;filename="${contentDisposition}"</param>
                       </result>

                       <interceptor-ref name="params"/>
                   </action>
          3、這中間有幾個參數需要配置:
               contentType設成 application/x-msdownload 就可以。這樣瀏覽器會保證彈出一個下載文件的對話框。
              inputName 這個比較重要,這個名字是輸入流的名稱, 以后要steam result的實現類中為根據OGNL的表達式去查找的。
              contentDisposition 這個是下載之后,保存在用戶端的文件名稱。${contentDisposition} 看一下代碼。如果寫成上述的方式,就有機會在ACTION中設置文件名。
          4、另外一個參數:contentLength就是下載文件的大小,webwork的stream result似乎實現有問題,不能根據文件的大小動態進行設置,只能寫死。
               這個參數的意義是告訴瀏覽下載的文件有多大,以便瀏覽器正確的顯示進度條。如果這個功能很重要的話,可以重新寫一個RESULT來實現。
          0

          posted @ 2016-08-09 17:49 youngturk 閱讀(276) | 評論 (0)編輯 收藏

          <2016年8月>
          31123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          導航

          統計

          公告

          this year :
          1 jQuery
          2 freemarker
          3 框架結構
          4 口語英語

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          EJB學習

          Flex學習

          learn English

          oracle

          spring MVC web service

          SQL

          Struts

          生活保健

          解析文件

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 安西县| 开封市| 勃利县| 青川县| 锡林郭勒盟| 陆丰市| 义乌市| 若羌县| 浑源县| 隆回县| 思南县| 奇台县| 阿图什市| 乐清市| 婺源县| 揭西县| 大兴区| 盐山县| 宣化县| 额尔古纳市| 招远市| 肇庆市| 宝丰县| 辽阳县| 吴旗县| 遂溪县| 正阳县| 铁力市| 城固县| 丹阳市| 中超| 商丘市| 洪泽县| 柳州市| 保亭| 临海市| 阆中市| 萨迦县| 吉木乃县| 夹江县| 富源县|