| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 969 人关注过本帖
标题:谁有空啊,帮我看看,谢谢
只看楼主 加入收藏
caihua
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2012-9-6
结帖率:66.67%
收藏
已结贴  问题点数:10 回复次数:7 
谁有空啊,帮我看看,谢谢
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 看看 谢谢 
2013-05-23 14:30
caihua
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2012-9-6
收藏
得分:0 
为什么一点注册链接不过去,就变成这样了
2013-05-23 14:30
博望、小五
Rank: 2
等 级:论坛游民
帖 子:24
专家分:16
注 册:2012-12-3
收藏
得分:4 
回复 2楼 caihua
你Severlet写错了,获取不到
2013-05-23 15:44
caihua
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2012-9-6
收藏
得分:0 
回复 3楼 博望、小五
那要怎样写啊,我写了好多个
2013-05-24 20:13
樊佑剑
Rank: 1
等 级:新手上路
帖 子:1
专家分:4
注 册:2013-5-25
收藏
得分:4 
回复 4楼 caihua
您的源代码可以发过来吗
2013-05-25 07:23
caihua
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2012-9-6
收藏
得分:0 
程序代码:
package import *;
import *;

public class CodingConvert {

  public CodingConvert() {}

  public static String sqlConvert(String sql) throws
      UnsupportedEncodingException {

    return convertEncoding(sql, "GBK", "ISO-8859-1");
  }

  /**
   * 将ISO-8859-1字符集转化为gb2312字符集
   * @param srcText 源字符串
   * @return destText 目标字符串
   * @throws UnsupportedEncodingException 不支持字符集异常
   */
  public static String isoToGBK(String srcText) throws
      UnsupportedEncodingException {
    return convertEncoding(srcText, "ISO-8859-1", "GBK");

  }

  /**
   * 将gb2312字符集转化为ISO-8859-1字符集
   * @param srcText 源字符串
   * @return destText 目标字符串
   * @throws UnsupportedEncodingException 不支持字符集异常
   */
  public static String GBKToIso(String srcText) throws
      UnsupportedEncodingException {
    try {
      return convertEncoding(srcText, "GBK", "ISO-8859-1");
    }
    catch (UnsupportedEncodingException e) {
      e.printStackTrace();
      return srcText;
    }
  }

  /**
   * 代码字符集转换
   * @param str 原始字符串
   * @param sourEncoding 源代码字符集
   * @param destEncoding 目标代码字符集
   * @return result 转换后字符串
   * @throws UnsupportedEncodingException 不支持字符集异常
   */
  public static String convertEncoding(String str,
                                       String sourEncoding,
                                       String destEncoding) throws
      UnsupportedEncodingException {

    if (str == null || str.equals(""))
      return "";
    int convertNum = 0;
    char[] inputChars = new char[str.length()];
    CharToByteConverter ctbConverter = (CharToByteConverter)
        CharToByteConverter.getConverter(sourEncoding);
    ctbConverter.setSubstitutionMode(false);
    for (int i = 0; i < str.length(); i++) {
      if (ctbConverter.canConvert(str.charAt(i))) {
        inputChars[convertNum++] = str.charAt(i);
      }
      else {
        if (ctbConverter.canConvert(str.charAt(i))) {
          inputChars[convertNum++] = str.charAt(i);
        }
        else {
          return str;
        }
      }
    }
    byte[] outputBytes = new byte[inputChars.length * 2];
    try {
      int count = ctbConverter.convert(inputChars, 0, inputChars.length,
                                       outputBytes, 0, outputBytes.length);
    }
    catch (Exception e) {
      System.out.println("1");
      e.printStackTrace();
    }

    ByteToCharConverter btcConverter = ByteToCharConverter.getConverter(
        destEncoding);

    char[] outputChars = new char[outputBytes.length];
    try {
      int count = btcConverter.convert(outputBytes, 0, outputBytes.length,
                                       outputChars, 0, outputChars.length);
    }
    catch (Exception e) {
      System.out.println("2");
      e.printStackTrace();
    }

    String result = new String(outputChars);
    return result.trim();
  }
}
2013-05-25 16:42
caihua
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2012-9-6
收藏
得分:0 
回复 5楼 樊佑剑
我想让denglu.jsp和zhuce.jsp连接上
图片附件: 游客没有浏览图片的权限,请 登录注册
2013-05-25 16:47
ee2906682
Rank: 1
等 级:新手上路
帖 子:8
专家分:9
注 册:2013-4-30
收藏
得分:4 
项目没发布到服务器
2013-05-30 00:12
快速回复:谁有空啊,帮我看看,谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020778 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved