📄 sendmsg.jsp
字号:
<html>
<meta http-equiv="refresh" content="120">
<title>
</title>
<head>
<style type="text/css">
<!--
a:link,a:visited {text-decoration:none;color:669999}
a.lb:hover{text-decoration:underline;color:black}
a:hover {text-decoration:underline;color:#333333}
a:active{text-decoration:none;color:black}
.cn0 {font-family: "宋体"; font-size: 13.5px;}
.cnt0 {font-family: "宋体"; font-size: 14.5px}
.cnt1 {font-family: "宋体"; font-size: 14.5px;line-height:160%}
.cnt2 {font-family: "宋体"; font-size: 14.5px;line-height:160%; letter-spacing: 3px}
.cnt3 {font-family: "宋体"; font-size: 14.5px;line-height:160%;color:#336699}
.e0 {font-family: "Arial","tahoma"; font-size: 9pt}
.e1 {font-family: "Arial","tahoma"; font-size: 9pt;line-height:140%}
.e2 {font-family: "Arial","tahoma"; font-size: 14.5px;line-height:160%}
-->
</style>
<script language="JavaScript" type="text/javascript">
function setCookie()
{
document.cookie=form1.color.selectedIndex+"#"+form1.whisperto.selectedIndex+"#"+form1.action.selectedIndex+"#"+form1.ifwhisper.checked;
}
function setFocus()
{
form1.message.focus();
var cookieValue=document.cookie;
var formValue=cookieValue.split("#");
form1.color.selectedIndex=formValue[0];
form1.whisperto.selectedIndex=formValue[1];
form1.action.selectedIndex=formValue[2];
_formValue=formValue[3].split(";");
if (_formValue[0]=="false")
{
form1.ifwhisper.checked=false;
}
if (_formValue[0]=="true")
{
form1.ifwhisper.checked=true;
}
}
</script>
</head>
<body bgcolor="#cccc99" onload="setFocus()">
<!--import some necessary class -->
<%@ page import="java.util.Vector" %>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Date" %>
<%!
//define a useful function which will be used by the following code
public void clearVector()
{
Vector _tempChat1Msg=(Vector)getServletContext().getAttribute("chat1Msg");
if (_tempChat1Msg.size()>40)
{
_tempChat1Msg.removeAllElements();
_tempChat1Msg.addElement("<font color='orange' size='2'>"+"系统管理员清除了消息队列,大家慢聊"+".</font><br>");
}
}
%>
<%
//***********************************************************************************************
//init some parameter which by the following code frequently
boolean boolcanupdatemsg=true;
Vector tempChat1Msg=(Vector)getServletContext().getAttribute("chat1Msg");
String cUserName=(String)session.getValue("username");
Date userTime=new Date();
String timestamp="["+userTime.getHours()+":"+userTime.getMinutes()+":"+userTime.getSeconds()+"]";
//***********************************************************************************************
%>
<%
//***********************************************************************************************
//receive some parameter and analysis them
byte[] temp_t;
String temp_p;
temp_p=request.getParameter("message");
temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
byte[] object_t;
String object_p;
object_p=request.getParameter("whisperto");
object_t=object_p.getBytes("ISO8859-1");
String object=new String(object_t);
String color=request.getParameter("color");
String action=request.getParameter("action");
String ifwhisper=request.getParameter("ifwhisper");
//***********************************************************************************************
%>
<%
//***********************************************************************************************
//analysis the parameter
if(temp.startsWith("<"))
{
temp="<font color='red' size='2'>请不要使用html标记"+timestamp+"</font><br>";
tempChat1Msg.addElement(temp);
boolcanupdatemsg=false;
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (temp.endsWith("/>"))
{
temp="<font color='red' size='2'>请不要使用html标记"+timestamp+"</font><br>";
tempChat1Msg.addElement(temp);
boolcanupdatemsg=false;
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
//***********************************************************************************************
try
{
if (ifwhisper==null)
{
ifwhisper="off";
}
else
{
ifwhisper="on";
}
}
catch (Exception fe)
{
//to do
}
//***********************************************************************************************
//the following are used to analysis the whisper msg
String whispertemp="init";
if (ifwhisper.equals("on"))
{
whispertemp="#"+cUserName+"#"+object+"#";
}
//***********************************************************************************************
//to add the timestamp to the msg
temp=temp+"。<font color='#ff6600'>"+timestamp+"</font>";
//***********************************************************************************************
if (object.equals("all"))
{
object="每一个人";
}
%>
<%
//the following code are used to define if this user can update the msg
//cUserName are defined before this code paragraph
//String cUserName=(String)session.getValue("username");
Vector _tempuser=(Vector)getServletContext().getAttribute("chat1User");
if (_tempuser.contains(cUserName)==false)
{
boolcanupdatemsg=false;
}
%>
<%
cUserName="<font color='red' size='2'>"+cUserName+"</font>";
object="<font color='#ff6600' size='2'>"+object+"</font>";
if (boolcanupdatemsg==true)
{
//update some msg so that the user have the asbility to update the msg
Hashtable userLife=(Hashtable)getServletContext().getAttribute("userLife");
userLife.put((String)session.getValue("username"),new Long(userTime.getTime()));
getServletContext().setAttribute("userLife",userLife);
//**************************************************************
}
if (boolcanupdatemsg==true)
{
if(ifwhisper.equals("off")) //no whisper
{
//the following is face
if(action.equals("1"))
{
clearVector();
action="对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("2"))
{
clearVector();
action="微微笑着对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("3"))
{
clearVector();
action="温柔地对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("4"))
{
clearVector();
action="脸红红的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("5"))
{
clearVector();
action="摇头晃脑得意的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("6"))
{
clearVector();
action="大笑着对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("7"))
{
clearVector();
action="神秘兮兮的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("8"))
{
clearVector();
action="战战兢兢的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("9"))
{
clearVector();
action="嘟着嘴对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("10"))
{
clearVector();
action="慢条斯理的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("11"))
{
clearVector();
action="同情的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("12"))
{
clearVector();
action="幸灾乐祸的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("13"))
{
clearVector();
action="快要哭的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("14"))
{
clearVector();
action="拳打脚踢的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("15"))
{
clearVector();
action="不怀好意的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("16"))
{
clearVector();
action="遗憾的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("17"))
{
clearVector();
action="诧异的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("18"))
{
clearVector();
action="幸福的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("19"))
{
clearVector();
action="翻箱倒柜的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("20"))
{
clearVector();
action="悲痛的";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("21"))
{
clearVector();
action="正气凌然的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("22"))
{
clearVector();
action="严肃的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("23"))
{
clearVector();
action="生气的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("24"))
{
clearVector();
action="大声的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说:"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("25"))
{
clearVector();
action="傻乎乎的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("26"))
{
clearVector();
action="很满足的对";
tempChat1Msg.addElement("<font color="+color+" size='2'>"+cUserName+action+object+"说"+temp+"</font><br>");
getServletContext().setAttribute("chat1Msg",tempChat1Msg);
}
if (action.equals("27"))
{
clearVector();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -