简易聊天室

时间:2021-06-02 11:07:44
【文件属性】:
文件名称:简易聊天室
文件大小:6KB
文件格式:ZIP
更新时间:2021-06-02 11:07:44
Java 简易聊天室本次实验的目的是通过以下题目掌握JSP内置对象,包括:request,response,session,application等。 (1)制作简易聊天室,能够实现简单的页面聊天功能。 (2)制作网页计数器,要求相同的窗口内刷新页面访问次数并不增加,并且用图片来显数字。1、 熟悉request、response、session、application、out等内置对象; 2、 选择制作网页计数器程序需准备数字图片;1、进入jsp子目录,编写简易聊天室的JSP程序,聊天室的需要实现的基本功能:输入昵称、聊天。 2.根据功能编写页面代码。二、网页计算器 利用内置对象application <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'Counter.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <% if(application.getAttribute("counter") == null) { application.setAttribute("counter", "1"); } else { String strnum = null; strnum = application.getAttribute("counter").toString(); int icount = 0; icount = Integer.valueOf(strnum).intValue(); icount++; application.setAttribute("counter", Integer.toString(icount)); } %> 您是第<%=application.getAttribute("counter") %>位访问者! </body> </html> 简易聊天室本次实验的目的是通过以下题目掌握JSP内置对象,包括:request,response,session,application等。 (1)制作简易聊天室,能够实现简单的页面聊天功能。 (2)制作网页计数器,要求相同的窗口内刷新页面访问次数并不增加,并且用图片来显数字。1、 熟悉request、response、session、application、out等内置对象; 2、 选择制作网页计数器程序需准备数字图片;1、进入jsp子目录,编写简易聊天室的JSP程序,聊天室的需要实现的基本功能:输入昵称、聊天。 2.根据功能编写页面代码。二、网页计算器 利用内置对象application <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'Counter.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <% if(application.getAttribute("counter") == null) { application.setAttribute("counter", "1"); } else { String strnum = null; strnum = application.getAttribute("counter").toString(); int icount = 0; icount = Integer.valueOf(strnum).intValue(); icount++; application.setAttribute("counter", Integer.toString(icount)); } %> 您是第<%=application.getAttribute("counter") %>位访问者! </body> </html>
【文件预览】:
Copy of Pro
----.project(1KB)
----.mymetadata(298B)
----src()
----WebRoot()
--------WEB-INF()
--------denglu.jsp(971B)
--------liaotian.jsp(3KB)
--------chuli2.jsp(2KB)
--------chuli.jsp(2KB)
--------META-INF()
----.myeclipse()
----.classpath(340B)

网友评论