<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 
    主站蜘蛛池模板: 国产一级淫片视频免费看| 久久久久久国产精品免费免费| 亚洲av无码无在线观看红杏| 美女羞羞喷液视频免费| 日韩黄色免费观看| 亚洲成a人片在线观| 99热在线精品免费全部my| 色天使亚洲综合在线观看| 黄页网站免费在线观看| 亚洲AV日韩综合一区尤物| 毛片免费视频播放| 亚洲乱妇熟女爽到高潮的片| 日本免费电影一区| 欧洲乱码伦视频免费国产 | 97在线观看永久免费视频| 亚洲永久中文字幕在线| 亚洲精品动漫免费二区| 亚洲精品理论电影在线观看| 日本免费人成黄页网观看视频| 九月丁香婷婷亚洲综合色| 久久综合给合久久国产免费| 亚洲美女一区二区三区| 无码高潮少妇毛多水多水免费| 亚洲av女电影网| 免费无码肉片在线观看| 黄页网址在线免费观看| 亚洲人精品午夜射精日韩| 中文字幕天天躁日日躁狠狠躁免费| 久久久亚洲精品蜜桃臀| 亚洲一区二区三区免费在线观看| 亚洲国产精品一区二区九九 | 色久悠悠婷婷综合在线亚洲| 日韩精品无码免费专区网站| 亚洲人成影院午夜网站| 全部免费国产潢色一级| 无码人妻一区二区三区免费看 | 久久久久亚洲AV无码专区首| 国产一卡二卡四卡免费| 美女尿口扒开图片免费| 亚洲精品永久www忘忧草| 亚洲?v女人的天堂在线观看|