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

📄 init.jsp

📁 jsp网站编程技巧教程 想学jsp的来吧
💻 JSP
字号:
<!--this file are used to init this web server-->
<html>
<title>
初始化聊天室
</title>
<head>
</head>
<body>
<%@ page import="java.util.Vector" %>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Date " %>
<%
//init the  chat msg
Vector chat1MsgVector=new Vector();
Vector chat2MsgVector=new Vector();

chat1MsgVector.addElement("<font color='red' size='2'>欢迎来到聊天室1.</font><br>");
chat2MsgVector.addElement("<font color='red' size='2'>欢迎来到聊天室2.</font><br>");

//the following code are used to init the welcome msg

getServletContext().setAttribute("chat1Msg",chat1MsgVector);
getServletContext().setAttribute("chat2Msg",chat2MsgVector);
//*********************************************************************
//init the chat user list
Vector chat1User=new Vector();
Vector chat2User=new Vector();

//zhou is the operator
chat1User.addElement("zhou");
chat2User.addElement("zhou");

getServletContext().setAttribute("chat1User",chat1User);
getServletContext().setAttribute("chat2User",chat2User);
//*******************************************************************************

//the following code are used to init the chat topic !!!

getServletContext().setAttribute("chat1Topic","新青年");
getServletContext().setAttribute("chat2Topic","MM专用");
%>

<%

Hashtable userLife=new Hashtable();
Hashtable userIP=new Hashtable();
Date zhouTime=new Date();
String zhouIP="192.168.101.27";
userLife.put("zhou",new Long(zhouTime.getTime()));
userIP.put("zhou",zhouIP);
getServletContext().setAttribute("userLife",userLife);
getServletContext().setAttribute("userIP",userIP);

%>
</body>
</html>

⌨️ 快捷键说明

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