删除所有在线会话的一个属性 [英] Remove one attribute of all online sessions

查看:92
本文介绍了删除所有在线会话的一个属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想删除所有在线会话的一个属性。我已将一个简短文本文件的内容缓存到会话中。但问题发生在我更新文本文件时,它继续使用旧内容,这就是我要删除所有在线会话属性的原因。


任何一个见面这个问题?请帮帮我...



我在jsp中包含我的代码如下:

Hi all,

I want to remove one attribute of all online sessions. I have cached a content of one short textfile to session. But the problem occur when i update the textfile, it continue use old content so that is reason which i want to remove the attribute of all online session.

Any one meet this problem? Please help me...

The include my code in a jsp as following:

result =(String) session.getAttribute("TVMS");
if(result == "" || result == null){
try{
System.out.println("RUNNING READ FILE CODE");
    BufferedReader reader = new BufferedReader(new FileReader(application.getRealPath("/")+"/TVMS.txt"));
    StringBuilder sb = new StringBuilder();
    String line;
    while((line = reader.readLine())!= null){
         result += line + "^";
    }
    session.setAttribute("TVMS", result.substring(0, result.length()-1));
}catch (Exception e) {
    e.printStackTrace();
}





在javascript中我声明了一个清单:





And in javascript I declare a list:

var tvmslist = "<%=result%>".split('^');

function runText(){
    if("<%=userid%>" == "testhcm05"){

        var cur = new Date();
        if(tvmslist.length>0){
           alert("At this time " + cur +" Run");         

        }
        setTimeout("runText()", 60000);
    }
}









使用上面的代码,如果我修改TVMS.txt它仍然使用旧内容(存储在会话变量中)。所以我想在更新文本文件时删除所有在线会话的属性。



With above code, if I modify the TVMS.txt it still using old content (be stored in session variable). So I want to remove the attribute of all online session when I update the text file.

推荐答案

这篇关于删除所有在线会话的一个属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆