⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 input.jsp

📁 一个使用jdbc存储和调用大对象(比如图片等)的例子
💻 JSP
字号:
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="chat.css">
<script language="JavaScript">

function checkForm() {
	if (document.chatForm.usermessage.value == "") {
		alert("发言不能为空!");
		document.chatForm.usermessage.focus();
		return false;
	}
	else {
		document.chatForm.usermessage.focus();
		return true;
	}
}

function userLogout() {
	top.window.location="logout.jsp?logout=yes";	
}

function openWindow(url) {
	var newWin = window.open(url,"","toolbar=no,status=no,scrollbars=yes,menubar=no,width=450,height=320");
	return false;
}
</script>

</HEAD>
<BODY bgcolor="#FF9900" topmargin="10">
<FORM name="chatForm"  method="post">
<table border="0" width="100%" align="center" cellspacing="0" cellpadding="0">
<tr valign="top"><td>
<%
String first = (String)request.getParameter("first");
String talkMessage=(String)request.getParameter("usermessage");
String action = (String)request.getParameter("action");
String fontcolor = (String) request.getParameter("fontcolor");
String talkwith =(String)request.getParameter("talkwith");
String systemSpeak=(String) request.getParameter("systemSpeak");

//用户等级资料     
String experience = (String) session.getValue("experience");
String userlevel = (String) session.getValue("userlevel");
if (experience == null) experience = "0";
if (userlevel == null) userlevel = "过客";
		
String Name=(String)session.getValue("Name");
out.println("【<font color='#0000ff'>"+Name+"</font>】"+"对");


//用户第一次进入,初始化状态
if (first == null) {	
	talkMessage="系统公告:<font color = blue>"+Name+"</font>进入了聊天室,大家欢迎!";	
	action = "no";
	fontcolor = "#000000";
	systemSpeak = "yes";
}
   
if(talkwith==null) {
	 talkwith = "所有人";	 
}

%> 
        <input type="text" name="talkwith" value= <%= talkwith %> size="8" style="font-size:9pt">
        动作 
        <select name="action" size="1" style="font-size:9pt">
          <option value="no" checked>说话</option>
          <option value="友好地拉着B的手说:">问好</option>
          <option value="向B会意地点点头,说:">点头</option>
          <option value="对B妩媚地甜甜一笑,说:">妩媚</option>
          <option value="万事不萦于心地呵呵笑着对B说:">开朗</option>
          <option value="一脸的坏笑,不怀好意地打量着B,说:">坏笑</option>
          <option value="忍住泪水,强挤出一丝笑容对B说:">苦笑</option>
          <option value="白了B一眼,十分不屑地说:">白眼</option>
          <option value="轻轻地在B的额头上吻了一下,温柔地说:">轻吻</option>
          <option value="热烈地拥抱着B,几乎透不过气来,说:">拥抱</option>
          <option value="含情脉脉地凝视着B说:">深情</option>
          <option value="泪珠儿在眼眶里打转,无限伤心地对B说:">伤心</option>
          <option value="羞红了脸,拧过身子背对着B说:">害羞</option>
          <option value="气得全身发抖,两眼喷火瞪着B,说:">愤怒</option>
          <option value="向B招招手,中间夹了个飞吻,说:">招手</option>
          <option value="嘟着嘴哼哼哧哧地对B说:">不满</option>
          <option value="兴奋得不得了,对着B翩翩起舞,说:">兴奋</option>
          <option value="情不自禁地搂着B热吻起来,还叽哩咕噜地说:">狂吻</option>
          <option value="泪光闪闪看着B,脸上写满了委屈的说:">委屈</option>
          <option value="急得直跺脚,气急败坏地对B说:">着急</option>
          <option value="泪如泉涌,对着B哗啦哗啦哭了起来,说:">嚎啕</option>
          <option value="皱起眉头别转脸,却又偷看B一眼,故作生气说:">撒娇</option>
          <option value="眯起斗鸡眼看着B一阵奸笑说:">奸笑</option>
          <option value="突然跃起飞脚猛踢B屁股,说:">飞脚</option>
          <option value="左右开弓抽得B满地找牙,说:">抽掴</option>
          <option value="冲B皮笑肉不笑地说:">假笑</option>
        </select>
        <input type="hidden" name="first" value="first">
        <input type="hidden" name="systemSpeak" value="no">
<%
String aloneTalk=request.getParameter("alonetalk");
if(aloneTalk==null)
aloneTalk="no";
if(aloneTalk.equals("no"))
out.print("<input type=\"checkbox\" name=\"alonetalk\" value=\"yes\" > 悄悄话 ");
else
out.print("<input type=\"checkbox\" name=\"alonetalk\" value=\"yes\" checked > 悄悄话");
%>

  <a href="chathelp.htm" onclick="return openWindow(this.href);">聊天帮助</a> <a href="advanced.jsp" onclick="return openWindow(this.href);">高级功能</a><br>
        <input type="text" name="usermessage" size=50 style="font-size:9pt">
        <select name="fontcolor" size="1" style="font-size:9pt">
          <option style="COLOR: #000000" value="#000000" <% if(fontcolor.equals("#000000")) out.print("selected"); %>>黑色 
          <option style="COLOR: #7ec0ee" value="#7ec0ee" <% if(fontcolor.equals("#7ec0ee")) out.print("selected"); %>>淡蓝 
          <option style="COLOR: #0088ff" value="#0088ff" <% if(fontcolor.equals("#0088ff")) out.print("selected"); %>>海蓝 
          <option style="COLOR: #0000ff" value="#0000ff" <% if(fontcolor.equals("#0000ff")) out.print("selected"); %>>草蓝 
          <option style="COLOR: #000088" value="#000088" <% if(fontcolor.equals("#000088")) out.print("selected"); %>>深蓝 
          <option style="COLOR: #8800ff" value="#8800ff" <% if(fontcolor.equals("#8800ff")) out.print("selected"); %>>蓝紫 
          <option style="COLOR: #ab82ff" value="#AB82FF" <% if(fontcolor.equals("#AB82FF")) out.print("selected"); %>>紫色 
          <option style="COLOR: #ff88ff" value="#ff88ff" <% if(fontcolor.equals("#ff88ff")) out.print("selected"); %>>紫金 
          <option style="COLOR: #ff00ff" value="#ff00ff" <% if(fontcolor.equals("#ff00ff")) out.print("selected"); %>>红紫 
          <option style="COLOR: #ff0088" value="#ff0088" <% if(fontcolor.equals("#ff0088")) out.print("selected"); %>>玫红 
          <option style="COLOR: #ff0000" value="#ff0000" <% if(fontcolor.equals("#ff0000")) out.print("selected"); %>>大红 
          <option style="COLOR: #f4a460" value="#f4a460" <% if(fontcolor.equals("#f4a460")) out.print("selected"); %>>棕色 
          <option style="COLOR: #888800" value="#888800" <% if(fontcolor.equals("#888800")) out.print("selected"); %>>卡其 
          <option style="COLOR: #888888" value="#888888" <% if(fontcolor.equals("#888888")) out.print("selected"); %>>铁灰 
          <option style="COLOR: #90e090" value="#90E090" <% if(fontcolor.equals("#90E090")) out.print("selected"); %>>绿色 
          <option style="COLOR: #008800" value="#008800" <% if(fontcolor.equals("#008800")) out.print("selected"); %>>橄榄 
          <option style="COLOR: #008888" value="#008888" <% if(fontcolor.equals("#008888")) out.print("selected"); %>>灰蓝 
        </select>
        <input type="submit" name="Submit" value="发送" style="font-size:9pt" onclick="return checkForm();">
        <input type="button" name="logout" value="离开" style="font-size:9pt" onclick="return userLogout();">
        
        </td>
        
      <td>      
		<table width="200" border="0" cellspacing="0" cellpadding="0" align="center" height="91" bgcolor="#FF9900" align="right">
			<tr> 
			<td width="9" rowspan="3"><img src="../images/chat_left.gif" width="9" height="91"></td>
			<td colspan="3" height="10"><img src="../images/chat_top.gif" width="62" height="10"></td>
			<td width="9" rowspan="3"><img src="../images/chat_right.gif" width="9" height="91"></td>
			</tr>
			<tr>
			<td colspan="3" height="71" bgcolor="#FEEE94" valign="middle" align="center"> 
				<table width="91%" border="0" cellspacing="0" cellpadding="0">
				<tr align="center" valign="middle"> 
				<td colspan="3">
				功力值: <font color="#FF3300"><%= experience %></font> 分 (<font color="#FF3300"><%= userlevel %></font>)</td>
				</tr>
				<tr align="center" valign="middle"> 
				<td width="35%"><a href="../bbs/index1.html" target="_blank">生活茶馆</a></td>
				<td width="33%"><a href="../bbs/index2.html" target="_blank">爱成网事 </a></td>
				<td width="32%"><a href="../bbs/index3.html" target="_blank">我为e狂 </a></td>
				</tr>
				<tr align="center" valign="middle"> 
				<td width="35%"><a href="../bbs/index4.html" target="_blank">光 与 影</a></td>
				<td width="33%"><a href="../bbs/index5.html" target="_blank">云游四海 </a></td>
				<td width="32%"><a href="../bbs/index6.html" target="_blank">飘飘娱仙 </a></td>
				</tr>
				<tr align="center" valign="middle"> 
				<td width="35%"><a href="../bbs/index7.html" target="_blank">城市故事</a></td>
				<td width="33%"><a href="../bbs/index8.html" target="_blank">健身美体 </a></td>
				<td width="32%"><a href="">会员注册 </a></td>
				</tr>
				</table>
			</td>
			</tr>
			<tr>
			<td colspan="3" height="10" bgcolor="#E86A1B"><img src="../images/spacer.gif" width="1" height="10"></td>
			</tr>
			</table>
      </td>
      
    </tr>
  </table>
<%
String action2 = "";
int i = action.indexOf("B");
if (i != -1) {
	action = action.substring(0,i) + "<font color='blue'>" + talkwith + "</font>" + action.substring(i+1);
}

if(!action.equals("no")) {
	talkMessage = action + "<font color=" + fontcolor + ">" + talkMessage + "</font>";
	action2 = "yes";	
}	

else if (first != null) {
	talkMessage = "<font color = " + fontcolor + ">" + talkMessage + "</font>";
	action2 = "no";	
}
String online = (String) session.getValue("online");
if (online == null) {
	online = "";
}
if (online.equals("no")) {
	out.print("<script>alert(\"你已经被踢出,不要再捣乱啦!\");</script>");	
	return;
}

if (Name == null) {
	return;
}

Vector  Message = null;
synchronized (application) { 
	Message= (Vector)application.getAttribute("Message");
	
	if(Message==null) {
		Message= new Vector(30,10);
	}
	if(Message.size()>200) {
		Message.removeAllElements();
	}
	
	Message.addElement(aloneTalk); 
	Message.addElement(Name);
	Message.addElement(talkwith);
	Message.addElement(talkMessage);
	Message.addElement(systemSpeak);
	Message.addElement(action2);
	application.setAttribute("Message", Message);  
}

%>
</FORM>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -