IE7以上版本没有问题,但是在IE6下,一旦调用applet,登录的session就会过期,要求重新登录,后发现是调用applet的时候,applet自己创建了一个session,和原来的session id不一样引起的.
有没有办法解决,可以让applet和IE使用同一个id的session吗?还是说有其他办法,求解答

解决方案 »

  1.   

    你的问题好像说的不是很清楚,session是用户回话的对象,每一次的会话不一样,id本来就不一样啊
      

  2.   

    就是说本来用户登录了,然后调用applet后,就session过期了, 必须重新登录
      

  3.   

    applet和服务器通讯了吧?
    要吧jsessionid放到 addProperty("Cookie", J_SESSION_ID);
      

  4.   


    楼上能再说的详细些吗? 我不懂...
    这个是在applet里加吗还是说把jsessionid传到服务器端,然后在action里面在addProperty
      

  5.   

    con.setRequestProperty("Cookie", cookie);
    applet要想维持和浏览器一样的session就需要将JSESSIONID通过cookie传给服务器public static String post(String url, Map<String, String> param) throws Exception {
    String responseContent = "";
    StringBuffer buffer = new StringBuffer();
    URL u = new URL(url);
    HttpURLConnection con = (HttpURLConnection)u.openConnection();
    con.setRequestMethod("POST");
    con.setDoInput(true);
    con.setDoOutput(true);
    // String postData = "kw=%E6%A6%86%E6%AC%A1&ie=utf-8&rich_text=1&floor_num=83&fid=120054&tid=1253912975&content=%3CIMG+class%3DBDE_Smiley+height%3D40+src%3D%22http%3A%2F%2Fstatic.tieba.baidu.com%2Ftb%2Feditor%2Fimages%2Fjd%2Fj_0012.gif%22+width%3D40+pic_type%3D%22%22%3E&sign_id=26074444&tbs=9569d296092c17d01319215829&vcode_md5=";//
    String postData = convertMapToParameters(param);
    postData = new String(gbk2utf8(postData), "utf-8");
    System.out.println("---__________"+postData);
    con.setRequestProperty("X-Requested-With","XMLHttpRequest");
    con.setRequestProperty("Accept-Language","zh-CN,zh;q=0.8");
    con.setRequestProperty("Referer","http://tieba.baidu.com/p/124770XXXX");
    con.setRequestProperty("Accept", "application/json, text/javascript, */*; q=0.01");
    con.setRequestProperty("Content-Type",
    "application/x-www-form-urlencoded; charset=UTF-8");
    con.setRequestProperty("UA-CPU", "x86");
    con.setRequestProperty("Accept-Encoding", "gzip,deflate");
    con.setRequestProperty("User-Agent", USER_AGENT);
    con.setRequestProperty("Host","tieba.baidu.com");
    con.setRequestProperty("Content-Length",String.valueOf(url.getBytes().length + postData.getBytes().length));
    con.setRequestProperty("Connection","keep-alive");
    con.setRequestProperty("Cache-Control","no-cache");

    //     con.setRequestProperty("Origin","http://tieba.baidu.com");




    //

    // con.setRequestProperty("Accept-Charset","GBK,utf-8;q=0.7,*;q=0.3");
    con.setRequestProperty("Cookie", cookie);
    DataOutputStream out = new DataOutputStream(con.getOutputStream());
    out.writeBytes(postData);
    out.flush();
    out.close();
    InputStream in = con.getInputStream();
    in = new GZIPInputStream(in);
    BufferedReader reader = new BufferedReader(new InputStreamReader(in));
    String line = "";
    while((line = reader.readLine()) != null) {
    buffer.append(line);
    buffer.append("\n");
    }
    in.close();
    reader.close();
    con.disconnect();
    responseContent = buffer.toString();
    return responseContent;
    }