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

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

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

    狼愛上貍

    我胡漢三又回來了

    tomcat 5.0.28的問題

    1.配置成首頁的問題

    ? ??????? <Logger className="org.apache.catalina.logger.FileLogger"
    ???????????????? directory="logs"? prefix="localhost_log." suffix=".txt"
    ??????????? timestamp="true"/>
    ?????? ?這里增加:
    ???????? <Context path="" docBase="C:/Tomcat/webapps/myweb" debug="0" reloadable="true" crossContext="true"/>

    ? 要說的是myweb/web-inf/web.xml的文件最好改下名,我的從weblogic轉過來,看了很多論壇,因為這里沒改名,一直錯誤,還不知道怎回事,改了名就好了,該是沖突問題。

    2. 亂碼問題

    如果你沒有亂碼,不用看,有了亂碼,你就成亂麻,總得要解決,現在論壇有說這,有說那,只要解決了你的難題的,就是好方案。

    我的問題時,從數據庫中讀出沒亂碼,寫入出現亂碼,我的方案是:

    (1).在filters中做個SetCharacterEncodingFilter.java的bean文件。

    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.UnavailableException;

    public class SetCharacterEncodingFilter implements Filter{
    protected String encoding = null;
    protected FilterConfig filterConfig = null;
    protected boolean ignore = true;

    public void destroy() {
    ?this.encoding = null;
    ?this.filterConfig = null;
    }

    public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain)
    throws IOException, ServletException {

    // Conditionally select and set the character encoding to be used
    if (ignore || (request.getCharacterEncoding() == null)) {
    ?String encoding = selectEncoding(request);
    ?if (encoding != null)
    ?? request.setCharacterEncoding(encoding);
    }

    // Pass control on to the next filter
    chain.doFilter(request, response);
    }

    public void init(FilterConfig filterConfig) throws ServletException {

    this.filterConfig = filterConfig;
    this.encoding = filterConfig.getInitParameter("encoding");
    String value = filterConfig.getInitParameter("ignore");
    if (value == null)
    this.ignore = true;
    else if (value.equalsIgnoreCase("true"))
    this.ignore = true;
    else if (value.equalsIgnoreCase("yes"))
    this.ignore = true;
    else
    this.ignore = false;
    }

    protected String selectEncoding(ServletRequest request) {
    return (this.encoding);
    }
    }

    編譯上段代碼時,要在classpath中注冊servlet.jar文件。
    (2).在web.xml中引入:

    <filter>
     <filter-name>Set Character Encoding</filter-name>
     <filter-class>filters.SetCharacterEncodingFilter</filter-class>
     <init-param>
      <param-name>encoding</param-name>
      <param-value>GBK</param-value>
     </init-param>
    </filter>

    <filter-mapping>
     <filter-name>Set Character Encoding</filter-name>
     <url-pattern>/*</url-pattern>
    </filter-mapping>

    (3)在server.xml中修改

    ??????????????? port="8080"??maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    ?????????????? enableLookups="false" redirectPort="8443" acceptCount="100"
    ?????????????? debug="0" connectionTimeout="20000"
    ?????????????? disableUploadTimeout="true" URIEncoding="ISO-8859-1" />

    ???? 有種說法是把URIEncoding="ISO-8859-1"可換成URIEncoding="GBK",自己測試,對的就是硬道理。

    最后順便說下mysql-connector-java-5.0.3-bin.jar的jdbc連接代碼,與以前低版本的不一樣。

    String sDBDriver="com.mysql.jdbc.Driver";
    String sConnStr="jdbc:mysql://localhost:3306/gain?user=root&password=password";


    posted on 2006-10-12 23:08 狼愛上貍 閱讀(272) 評論(0)  編輯  收藏 所屬分類: JAVA

    主站蜘蛛池模板: 久久丫精品国产亚洲av不卡| 78成人精品电影在线播放日韩精品电影一区亚洲 | 在线免费观看一级片| 99久久精品免费精品国产| 免费无码又黄又爽又刺激| 亚洲国产成人va在线观看网址| 免费夜色污私人影院网站电影| 久久99国产乱子伦精品免费| 亚洲国产精品无码久久九九| 国产亚洲精品仙踪林在线播放| 国产yw855.c免费视频| 亚洲一卡二卡三卡| 成人免费午夜无码视频| 亚洲精品自偷自拍无码| 免费播放一区二区三区| 亚洲黄色在线视频| 无码视频免费一区二三区| 亚洲精品无码成人片久久不卡 | 伊人免费在线观看高清版| 成年午夜视频免费观看视频| 在线亚洲高清揄拍自拍一品区| 免费看搞黄视频网站| 久久亚洲精品国产精品| 操美女视频免费网站| 日韩毛片免费一二三| 亚洲成熟xxxxx电影| a级毛片毛片免费观看永久| 久久精品蜜芽亚洲国产AV| 国产在线国偷精品产拍免费| 特级毛片A级毛片免费播放| 亚洲成AV人片在线观看无码 | 日韩成人毛片高清视频免费看| 亚洲精品无码av人在线观看 | 特色特黄a毛片高清免费观看 | 亚洲乱码精品久久久久..| 亚州免费一级毛片| 亚洲avav天堂av在线网毛片| 亚洲国产成人高清在线观看| 天天天欲色欲色WWW免费| 在线毛片片免费观看| 亚洲精品国精品久久99热一|