tomcat设置主目录的问题,呀,
中文问题呀,
在这个论坛里面满地都是的,
好好珍惜你的分吧

解决方案 »

  1.   

    那些问号是"iso-8859-1"格式的,要转换成中文,可以加上
    String a="要转换的文字";
    a=new String(a.getBytes("iso-8859-1"),"gb2312");
    out.print(a);
      

  2.   

    在apache tomcat4.0\conn\server.xml里找到以下这段
    <Context path="/abc" docBase="ROOT/test11/abc" 
    debug="0" reloadable="true" />
    在其后再加上
    <Context path="/jsp" docBase="d://java/jsp" 
    debug="0" reloadable="true" />
    这就是虚拟目录了,
    path是你的在你浏览器里写的: ip:port/jsp
    docbase是你机器的绝对路径 盘符后要加//
    中文问提只要在jsp程序里的第一行加上
    <%@ page contentType="text/html;charset=gb2312"%>就可以了
      

  3.   

    你试着把这个写到一个javabean里面,再引用它就可以了
    public getGBStr(String s){
                 try{
                     String temp = s;
                     byte[] tempb =temp.getBytes("ISO8859-1");
                     String result = new String(tempb);
                     return result;
                     }
                     catch(Exception e){
                       }
                       return "null";
                       }
                 }
      

  4.   

    public getGBStr(String s){
    public String getGBStr(String s){
    改成这个样子