<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-77  評論-5  文章-2  trackbacks-0
     

    package com.zte.platform;

    import java.io.IOException;

    import javax.faces.webapp.FacesServlet;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;

    public class ZteFacesServlet extends HttpServlet
    {

     private static final String INIT_PARAM_ERROR_PAGE = "errorPage";
            private Log log = LogFactory.getLog(getClass());       
           

     private FacesServlet delegate;

     private String errorPage;

     public void init(ServletConfig servletConfig) throws ServletException
     {
      delegate = new FacesServlet();
      delegate.init(servletConfig);
      errorPage = servletConfig.getInitParameter(INIT_PARAM_ERROR_PAGE);
     }

     public void destroy()
     {
      delegate.destroy();
     }

     public ServletConfig getServletConfig()
     {
      return delegate.getServletConfig();
     }

     public String getServletInfo()
     {
      return delegate.getServletInfo();
     }

     public void service(ServletRequest request, ServletResponse response)
       throws ServletException, IOException
     {
      try
      {
       delegate.service(request, response);
      } catch (Throwable e)
      {
                log.error("page exception ,redirect to error page ",e);
                try{
       redirectToErrorPage((HttpServletRequest) request,
         (HttpServletResponse) response);
                }
                catch(Exception ex)
                {
                 log.error("fail to redirect to error page",ex);
                 //throw new RuntimeException("fail to redirect to error page,original exceptioin is", e);
                }
      }
     }

     private void redirectToErrorPage(HttpServletRequest request,
       HttpServletResponse response) throws IOException
     {
      if (!"".equals(errorPage))
      {
       response.sendRedirect(request.getContextPath() + errorPage);
      }
     }

    }


    文章來源:http://stocknewbie.bokee.com/viewdiary.18876476.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(181) | 評論 (0)編輯 收藏

    divHtml = divHtml + "<iframe src='about:blank' style='position:absolute;top:0px;left:0px; visibility:inherit;  width:190px;height:232px;z-index:-1; scrolling='no' frameborder='0' filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';'></iframe>"
      

    document.all.myDiv.innerHTML = divHtml;

     

    這種方式有個問題,就是width和height寫死了,

    如果div自身設置了width和height,可以將iframe的width,height設置成100%

    divHtml = divHtml + "<iframe src='about:blank' style='position:absolute;top:0px;left:0px; visibility:inherit;  width:100%;height:100%;z-index:-1; scrolling='no' frameborder='0' filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';'></iframe>"


    文章來源:http://stocknewbie.bokee.com/viewdiary.18876477.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(236) | 評論 (0)編輯 收藏

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PushbackInputStream;
    import java.util.ArrayList;
    import java.util.HashSet;
    import java.util.List;
    import java.util.Set;

    public class UtfTool
    {

        /**
         * ant 編譯之后的result文件,注意要編譯提示錯誤的文件名要在同一行
         * 可以設置命令提示窗口的緩沖區大小實現
         * @param resultFileName
         */
        public static Set getFileNamesFromCompileResult(String resultFileName)
         throws java.io.IOException
        {
     Set<String> set = new HashSet();
     BufferedReader reader = new BufferedReader(new FileReader(
      resultFileName));
     String start = "[javac] ";
     int startLen = start.length();
     String end = ".java:";
     int endLen = end.length();
     
     String errMsg = "\\65279";
     while (reader.ready())
     {
         String line = reader.readLine();
         int indexStart = line.indexOf(start);
        
         if(line.indexOf(errMsg) == -1)
         {
      continue;
         }
         if (indexStart != -1)
         {
      int indexEnd = line.indexOf(end);
      if (indexEnd != -1)
      {
          String name = line.substring(indexStart + startLen,
           indexEnd + endLen - 1);
          set.add(name.trim());
      }
         }
     }
     return set;

        }
       
        /**
         * 讀取流中前面的字符,看是否有bom,如果有bom,將bom頭先讀掉丟棄
         * @param in
         * @return
         * @throws IOException
         */
        public static InputStream getInputStream(InputStream in) throws IOException
        {

     PushbackInputStream testin = new PushbackInputStream(in);
     int ch = testin.read();
     if (ch != 0xEF)
     {
         testin.unread(ch);
     } else if ((ch = testin.read()) != 0xBB)
     {
         testin.unread(ch);
         testin.unread(0xef);
     } else if ((ch = testin.read()) != 0xBF)
     {
         throw new IOException("錯誤的UTF-8格式文件");
     } else
     {
         //不需要做,這里是bom頭被讀完了
        //// System.out.println("still exist bom");

     }
     return testin;

        }
       
       
       
        /**
         * 根據一個文件名,讀取完文件,干掉bom頭。
         * @param fileName
         * @throws IOException
         */
        public static void trimBom(String fileName) throws IOException
        {

     FileInputStream fin = new FileInputStream(fileName);
     //開始寫臨時文件
     InputStream in = getInputStream(fin);
     String tmpFileName = fileName + ".tmp";
     FileOutputStream out = new FileOutputStream(tmpFileName);
     byte b[] = new byte[4096];

     int len = 0;
     while (in.available() > 0)
     {
         len = in.read(b, 0, 4096);
         out.write(b, 0, len);
     }

     in.close();
     fin.close();
     out.close();

     //臨時文件寫完,開始將臨時文件寫回本文件。
     in = new FileInputStream(tmpFileName);
     System.out.println("[" + fileName + "]");
     out = new FileOutputStream(fileName);

     while (in.available() > 0)
     {
         len = in.read(b, 0, 4096);
         out.write(b, 0, len);
     }
     in.close();
     out.close();
        }

        /**
         * 根據ant編譯錯誤來去除bom
         * @param resultFile
         * @throws IOException
         */
        static void trimBomByCompileResult(String resultFile) throws IOException
        {
     Set<String> set = getFileNamesFromCompileResult(resultFile);
     for (String fName : set)
     {
         trimBom(fName);
     }
        }

        public static void main(String[] args) throws IOException
        {
     trimBomByCompileResult("c:/result3.txt");
     
     ///List<String> list = getFileNamesFromCompileResult(resultFile);

    // InputStream in = new FileInputStream(
    //  "D:/cc/SSB_SRC_DEV_lijinglin2/TP_SSB/SSB_CJ203_Component/ProductCode/com/zte/ssb/component/access/implementation/dao/ImplementationDAO.java");
    // getInputStream2(in);
    // in.close();
        }
    }


    文章來源:http://stocknewbie.bokee.com/viewdiary.22061282.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(1860) | 評論 (0)編輯 收藏

    執行sql

    select  o.name,cl.name,cm.text from sysobjects o,syscolumns cl, syscomments cm
     where o.id = cl.id and cl.cdefault = cm.id  and o.type='U'
      and o.name='test2' and cl.name like 'col%'

     

    test2是標明, col%是列名通配符, 'U' 表示表格是用戶表

     

    返回結果:

     

    name                           name                           text                                                                                                                                                                                                                                                           
    ----                           ----                           ----                                                                                                                                                                                                                                                           
    test2                          col1                           DEFAULT (0)                                                                                                                                                                                                                                                    
    test2                          col2                           DEFAULT  2                                                                                                                                                                                                                                                     
    test2                          col3                           DEFAULT  getdate()            

     

     

    syscolumns 中 id 表示對應的表格在sysobjects中id, cdefault表示在syscomments中的缺省值注釋id

     

     

    缺省值可能會出現函數, 例如  default getdate(),

    所以我覺得應該這個缺省值可以剝離掉default, 如果使用hibernate實現,還只能用dynamic insert,dynamic update.

     

     


    文章來源:http://stocknewbie.bokee.com/viewdiary.31463433.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(488) | 評論 (0)編輯 收藏
    僅列出標題
    共5頁: 上一頁 1 2 3 4 5 
    主站蜘蛛池模板: 亚洲一区精品视频在线| 亚洲一线产区二线产区区| 91短视频免费在线观看| 亚洲一区二区三区高清在线观看| 国产又大又长又粗又硬的免费视频 | 男人的天堂亚洲一区二区三区| CAOPORM国产精品视频免费| 亚洲精品线在线观看| 男女啪啪永久免费观看网站| 久久免费视频一区| 亚洲综合色区中文字幕| 亚洲精品无码永久在线观看| 真实国产乱子伦精品免费| 免费看一级高潮毛片| 亚洲av成人一区二区三区| 亚洲精品国产精品乱码不99| 国产成人啪精品视频免费网| 国产成人精品免费视频网页大全| 国产激情久久久久影院老熟女免费| 亚洲一区二区三区高清不卡| 亚洲精品免费在线观看| 亚洲第一永久AV网站久久精品男人的天堂AV | 久久久久久亚洲精品中文字幕| 免费人成在线观看播放国产| 亚洲啪啪免费视频| 免费无码av片在线观看| 国产精品成人69XXX免费视频| 亚洲AV电影天堂男人的天堂| 亚洲免费福利视频| 亚洲一区在线观看视频| 91亚洲精品自在在线观看| 久久亚洲国产伦理| 亚洲国产成人久久综合碰碰动漫3d| 亚洲成a人片在线观看久| 国产又长又粗又爽免费视频| 在线观看91精品国产不卡免费| 在线看片韩国免费人成视频| 四虎成年永久免费网站 | 亚洲无人区一区二区三区| 亚洲综合色在线观看亚洲| 亚洲片国产一区一级在线观看 |