隨筆-9  評論-1  文章-0  trackbacks-0
            2009年11月5日
          posted @ 2009-11-05 11:31 QQ小妹 閱讀(157) | 評論 (1)編輯 收藏
            2009年6月14日

               現(xiàn)在工作不好找呀,可是我進入這個不好的局面,生活的所迫,也不得不加入這求職大隊伍中。

          希望自己能夠適應這個社會,能夠快速的找到一個自己的位置。

               生活每一個轉折點都是那么的不驚異,好好認清自己,只能跟自己默默說一聲,加油了。

          posted @ 2009-06-14 20:42 QQ小妹 閱讀(152) | 評論 (0)編輯 收藏
            2008年7月3日

          1.Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Attribute "xmlns" must be declared for element type "beans".


          add
          <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

          in applicationContext.xml
          posted @ 2008-07-03 17:00 QQ小妹 閱讀(823) | 評論 (0)編輯 收藏
          package filters;

          import java.io.IOException;
          import javax.servlet.Filter;
          import javax.servlet.FilterChain;
          import javax.servlet.FilterConfig;
          import javax.servlet.ServletException;
          import javax.servlet.ServletRequest;
          import javax.servlet.ServletResponse;
          import javax.servlet.http.HttpServletRequest;
          import javax.servlet.http.HttpServletRequestWrapper;

          public class TomcatFormFilter implements Filter {
              
          /**
               * Request.java 對 HttpServletRequestWrapper 進行擴充, 不影響原來的功能并能提供所 有的
               * HttpServletRequest 接口中的功能. 它可以統(tǒng)一的對 Tomcat 默認設置下的中文問題進行解決而只 需要用新的 Request
               * 對象替換頁面中的 request 對象即可.
               
          */

              
          class Request extends HttpServletRequestWrapper {
                  
          public Request(HttpServletRequest request) {
                      
          super(request);
                  }


                  
          /**
                   * 轉換由表單讀取的數(shù)據(jù)的內碼. 從 ISO 字符轉到 GBK.
                   
          */

                  
          public String toChi(String input) {
                      
          try {
                          
          byte[] bytes = input.getBytes("ISO8859-1");
                          
          return new String(bytes, "GBK");
                      }
           catch (Exception ex) {
                      }

                      
          return null;
                  }


                  
          /**
                   * Return the HttpServletRequest holded by this object.
                   
          */

                  
          private HttpServletRequest getHttpServletRequest() {
                      
          return (HttpServletRequest) super.getRequest();
                  }


                  
          /**
                   * 讀取參數(shù) -- 修正了中文問題.
                   
          */

                  
          public String getParameter(String name) {
                      
          return toChi(getHttpServletRequest().getParameter(name));
                  }


                  
          /**
                   * 讀取參數(shù)列表 - 修正了中文問題.
                   *
          */

                  
          public String[] getParameterValues(String name) {
                      String values[] 
          = getHttpServletRequest().getParameterValues(name);
                      
          if (values != null{
                          
          for (int i = 0; i < values.length; i++{
                              values[i] 
          = toChi(values[i]);
                          }

                      }


                      
          return values;
                  }

              }


              
          public void destroy() {
              }


              
          public void doFilter(ServletRequest request, ServletResponse response,
                      FilterChain chain) 
          throws IOException, ServletException {
                  HttpServletRequest httpreq 
          = (HttpServletRequest) request;
                  
          if (httpreq.getMethod().equals("POST")) {
                      request.setCharacterEncoding(
          "GBK");
                  }
           else {
                      request 
          = new Request(httpreq);
                  }

                  chain.doFilter(request, response);
              }


              
          public void init(FilterConfig filterConfig) throws ServletException {
                  
              }

          }
          posted @ 2008-07-03 13:39 QQ小妹| 編輯 收藏
          僅列出標題  
          every day is new day
          主站蜘蛛池模板: 凌云县| 洪雅县| 闸北区| 泰州市| 延边| 九龙县| 鸡东县| 土默特左旗| 聊城市| 郑州市| 平顺县| 祁门县| 都兰县| 永新县| 定远县| 平潭县| 台州市| 淳安县| 嘉鱼县| 双峰县| 义马市| 千阳县| 汶川县| 闽清县| 临漳县| 拉萨市| 武定县| 揭东县| 丹阳市| 东乡族自治县| 滕州市| 通化市| 高邑县| 隆回县| 台东县| 舒城县| 郸城县| 三原县| 镇原县| 绥棱县| 桦川县|