📄 freshlist.java
字号:
package org.yeeku.refresh;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
import java.util.*;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
public class FreshList
{
public List execute() throws Exception
{
WebContext ctx;
ctx=WebContextFactory.get();
HttpSession session =ctx.getSession();
String UserName=(String)session.getAttribute("username");
ServletContext M_application=ctx.getServletContext();
List chatUsers;
chatUsers=(List)M_application.getAttribute("chatUser");
List Userreturn=new ArrayList();
if(chatUsers!=null)
{
List temporaryuser=new ArrayList();
List temporary=new ArrayList();
List checkuser=new ArrayList();
for(int i=0;i<=chatUsers.size()-1;i++)
{
String onlineName=(String)chatUsers.get(i);
checkuser=(List)M_application.getAttribute(onlineName);
String firstuser=(String)checkuser.get(0);
if(firstuser.equals("请等待对方回复") && onlineName.equals(UserName))
{
temporaryuser.add(onlineName);
}
else if(!(firstuser.equals("请发送消息")))
{
temporary.add(onlineName);
}
else
{
Userreturn.add(onlineName);
}
}
String username="forsureuser";//分界线
Userreturn.add(username);
int k;
for(k=0;k<=temporaryuser.size()-1;k++)
{
String chatingName=(String)temporaryuser.get(k);
Userreturn.add(chatingName);
}
username="chatinguser";//分界线
Userreturn.add(username);
for(k=0;k<=temporary.size()-1;k++)
{
String chatingName=(String)temporary.get(k);
Userreturn.add(chatingName);
}
}
if(Userreturn==null)
{
String user="No UserOnline";
chatUsers.add(user);
}
return Userreturn;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -