- 浏览: 22862 次
- 性别:
- 来自: 天津
最新评论
思想斗争了很久,终于开始接触ajax,作为一个初学者,模仿是个不错的学习方法,至少我是这么学过来的,站长巨人的肩膀上。
这次模仿的内容来自《基于J2EE的Ajax宝典》电子书,在此表示感谢。介绍的是Jsp页面聊天器和ajax聊前器的区别,及ajax的特点体现。
---相对于传统的JSP聊天室而言,Ajax聊天室的速度更快,响应更加流畅。对于复杂页面,Ajax的优势将更加明显:Ajax聊天室只需从服务器获取必须更新的聊天记录,而无须下载整个页面。
Ajax聊天室的最大特点是页面无须刷新,用户感觉不到页面的下载。使用Ajax聊天室时,用户感觉到仿佛在使用普通的Socket聊天室,因为聊天室的页面无须刷新,但用户的聊天信息实时更新。这一切都依赖于Ajax的异步发送请求和动态更新页面。
学习能力自称很强的我,在这下才知道是多么的渺小啊,花了整整一天的时间才得以实现,但这个过程虽败犹荣啊,更深刻的了解了ajax功能实现的整个流程。
1:创建XMLHttpRequest对象
2:取得与服务器的连接(用到post请求)
3:发送post请求时应该增加该文件头
4:指定当XMLHttpRequest状态变化时的处理函数(一个监听的过程)
5:发送请求,及发送信息
-1:这里就是步骤4中的处理函数的书写了
下面贴出ajax聊天器的代码(无数据库)
聊天器聊天界面代码:
有三个控制类处理类(servlet)
1:注册控制处理
2:登陆控制处理类:
3:聊天控制处理类:
然后就是web.xml的配置了
最后就是业务处理了:
至此ajax聊天器的程序测试就这样完成了。
这次模仿的内容来自《基于J2EE的Ajax宝典》电子书,在此表示感谢。介绍的是Jsp页面聊天器和ajax聊前器的区别,及ajax的特点体现。
---相对于传统的JSP聊天室而言,Ajax聊天室的速度更快,响应更加流畅。对于复杂页面,Ajax的优势将更加明显:Ajax聊天室只需从服务器获取必须更新的聊天记录,而无须下载整个页面。
Ajax聊天室的最大特点是页面无须刷新,用户感觉不到页面的下载。使用Ajax聊天室时,用户感觉到仿佛在使用普通的Socket聊天室,因为聊天室的页面无须刷新,但用户的聊天信息实时更新。这一切都依赖于Ajax的异步发送请求和动态更新页面。
学习能力自称很强的我,在这下才知道是多么的渺小啊,花了整整一天的时间才得以实现,但这个过程虽败犹荣啊,更深刻的了解了ajax功能实现的整个流程。
1:创建XMLHttpRequest对象
2:取得与服务器的连接(用到post请求)
3:发送post请求时应该增加该文件头
4:指定当XMLHttpRequest状态变化时的处理函数(一个监听的过程)
5:发送请求,及发送信息
-1:这里就是步骤4中的处理函数的书写了
下面贴出ajax聊天器的代码(无数据库)
聊天器聊天界面代码:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'chat2.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"> --> <script type="text/javascript"> var input; var XMLHttpReq; function createXMLHttpRequest() { input=document.getElementById("123"); input.focus(); XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP"); var chatMsg=input.value; var url = "Chat.do"; XMLHttpReq.open("post", url, true); XMLHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); XMLHttpReq.onreadystatechange = processResponse; //发送请求后,将聊天信息的输入文本框清空 input.value=""; //发送请求,send的参数包含许多的key-value对 //即以“请求参数名=请求参数值”的形式发送请求参数 XMLHttpReq.send("chatMsg=" + chatMsg); // 发送请求 } function sendEmptyRequest() { //创建XMLHttpRequest对象 if(window.XMLHttpRequest) { XMLHttpReq=new XMLHttpRequest(); } if (window.ActiveXObject) { try { //使用AcitveXObject函数创建浏览器 XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { //如果出现异常,再次尝试以如下方式创建XMLHttpRequest对象 try { XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { window.alert("internet"); } } } //定义服务器响应的URL var url = "Chat.do"; //建立与服务器的连接 XMLHttpReq.open("post", url, true); //设置发送请求的参数格式 XMLHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); //指定响应处理函数 XMLHttpReq.onreadystatechange = processResponse; //发送请求 XMLHttpReq.send(null); setTimeout("sendEmptyRequest()", 800); } function processResponse() { //如果服务器响应已经完成 if(XMLHttpReq.readyState == 4) { //判断对象状态,如果服务器生成了正常响应 if (XMLHttpReq.status == 200) { //信息已经成功返回,开始处理信息 //将聊天文本域的内容设置成聊天信息 document.getElementById("chatArea").value = XMLHttpReq.responseText; } else { //页面不正常 window.alert("您所请求的页面有异常。"); } } } function enterHandler(event) { //定义键盘中发出事件的键 var keyCode=event.keyCode?event.keyCode:event.which?event.which: event.charCode;//回车键的代码为13,如果按下了回车键 if (keyCode == 13) { createXMLHttpRequest(); } } </script> </head > <body onload="JavaScript:sendEmptyRequest();"> <input type="button" onclick="JavaScript:createXMLHttpRequest();" value="clickme"> <table width="780" border="1" align="center"> <tr> <td><p align="center">聊天页面</p> <!-- 下面定义聊天使用的文本域,该文本域用于显示当前聊天信息 --> <p align="center"> <textarea id="chatArea" name="chatArea" cols="100" rows="30" readonly="readonly"></textarea> </p> <div align="center"> <!-- 下面是输入聊天信息所使用的文本,并为onKeyPress事件指定了监听函数 --> <input id="123" name="chatMsg" type="text" size="90" onKeyPress="JavaScript:enterHandler(event);"> <!-- 下面是输入聊天信息的文本框,并为onclick事件指定了监听函数 --> <input type="button" name="button" value="提交" onclick="JavaScript:createXMLHttpRequest();"> </div> <p> </p> </td> </tr> </table> </body> </html>
有三个控制类处理类(servlet)
1:注册控制处理
package com.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.method.ChatService; public class RegServlet extends HttpServlet { @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name=request.getParameter("username"); String pass=request.getParameter("password"); if(name==null||pass==null) { request.setAttribute("tip", "用户名和密码都不能为空"); forward("/reg.jsp", request, response); } //开始调用业务逻辑对象的方法 try { //调用业务逻辑对象的方法 if (ChatService.instance().addUser(name, pass)) { //如果注册成功,则将提示信息存入系统的tip属性 request.setAttribute("tip", "注册成功,请登录系统"); //将请求转发到reg.jsp页面显示 forward("/reg.jsp", request, response); } else { //如果不能正常注册,则将提示信息放入request属性 request.setAttribute("tip", "无法正常注册,请重试"); forward("/reg.jsp", request, response); } } //如果捕捉到异常,例如注册的用户名已经存在 catch (Exception e) { //将异常信息设置成request属性 request.setAttribute("tip", e.getMessage()); forward("/reg.jsp", request, response); } } private void forward(String url, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext sc = getServletConfig().getServletContext(); RequestDispatcher rd = sc.getRequestDispatcher(url); rd.forward(request, response); } /** * Constructor of the object. */ public RegServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass()); out.println(", using the GET method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass()); out.println(", using the POST method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } }
2:登陆控制处理类:
package com.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.method.ChatService; public class LoginServlet extends HttpServlet { /** * Constructor of the object. */ public LoginServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass()); out.println(", using the GET method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass()); out.println(", using the POST method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name=request.getParameter("username"); String pass=request.getParameter("password"); if(ChatService.instance().validLogin(name, pass)) { request.getSession().setAttribute("username", name); String message=ChatService.instance().getMsg(); request.setAttribute("message", message); forward("/chat2.jsp",request,response); } else { request.setAttribute("tip", "用户名和密码不匹配"); forward("/login.jsp",request,response); } } private void forward(String url, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext sc = getServletConfig().getServletContext(); RequestDispatcher rd = sc.getRequestDispatcher(url); rd.forward(request, response); } }
3:聊天控制处理类:
package com.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.method.ChatService; public class ChatServlet extends HttpServlet { /** * Constructor of the object. */ public ChatServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass()); out.println(", using the GET method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=gbk"); PrintWriter out = response.getWriter(); out .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>"); out.println(" <BODY>"); out.print(" This is "); out.print(this.getClass()); out.println(", using the GET method"); out.println(" </BODY>"); out.println("</HTML>"); out.flush(); out.close(); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String msg=request.getParameter("chatMsg"); String user=(String) request.getSession().getAttribute("username"); if(msg!=null) { ChatService.instance().addMsg(user, msg); } // String message=ChatService.instance().getMsg(); // request.setAttribute("message", message); // forward("/chat.jsp",request,response); //设置中文输出流 response.setContentType("text/html;charset=utf-8"); //获取页面输出流 PrintWriter out = response.getWriter(); //将当前系统的聊天记录输出到页面 out.println(ChatService.instance().getMsg()); } private void forward(String url, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext sc = getServletConfig().getServletContext(); RequestDispatcher rd = sc.getRequestDispatcher(url); rd.forward(request, response); } }
然后就是web.xml的配置了
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <description>This is the description of my J2EE component</description> <display-name>This is the display name of my J2EE component</display-name> <servlet-name>RegServlet</servlet-name> <servlet-class>com.servlet.RegServlet</servlet-class> </servlet> <servlet> <description>This is the description of my J2EE component</description> <display-name>This is the display name of my J2EE component</display-name> <servlet-name>ChatServlet</servlet-name> <servlet-class>com.servlet.ChatServlet</servlet-class> </servlet> <servlet> <description>This is the description of my J2EE component</description> <display-name>This is the display name of my J2EE component</display-name> <servlet-name>LoginServlet</servlet-name> <servlet-class>com.servlet.LoginServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>RegServlet</servlet-name> <url-pattern>/Reg.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ChatServlet</servlet-name> <url-pattern>/Chat.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>LoginServlet</servlet-name> <url-pattern>/Login.do</url-pattern> </servlet-mapping> </web-app>
最后就是业务处理了:
package com.method; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.LinkedList; import java.util.Properties; public class ChatService { private static ChatService cs; private Properties userList; private LinkedList<String> chatMsg; private ChatService() {} public static ChatService instance() { if(cs==null) { cs=new ChatService(); } return cs; } public boolean validLogin(String user,String pass)throws IOException { if(loadUser().getProperty(user)==null) { return false; } if(loadUser().getProperty(user).equals(pass)) { return true; } return false; } public boolean addUser(String name,String pass)throws Exception { if(userList==null) { userList=loadUser(); } if(userList.containsKey(name)) { throw new Exception("用户名已经存在,请重新选择用户名"); } userList.setProperty(name,pass); saveUserList(); return true; } public String getMsg() { if(chatMsg==null) { chatMsg=new LinkedList<String>(); return ""; } String result=""; for(String tmp:chatMsg) { result+=tmp+"\n"; } return result; } public void addMsg(String user,String msg) { if(chatMsg==null) { chatMsg=new LinkedList<String>(); } if(chatMsg.size()>40) { chatMsg.removeFirst(); } chatMsg.add(user+"说:"+msg); } private Properties loadUser()throws IOException { if(userList==null) { File f=new File("userFile.properties"); if(!f.exists()) f.createNewFile(); userList=new Properties(); userList.load(new FileInputStream(f)); } return userList; } private boolean saveUserList()throws IOException { if(userList==null) { return false; } userList.store(new FileOutputStream("userFile.properties"), "userList"); return true; } }
至此ajax聊天器的程序测试就这样完成了。
相关推荐
本课程“Ajax从入门到精通”旨在帮助初学者快速掌握Ajax的核心概念和技术,通过学习,你将能实现页面的异步交互,提升用户体验。 一、Ajax基础知识 Ajax的核心是JavaScript对象XMLHttpRequest,它允许在后台与...
此外,还可以参考各种在线教程和实践指南,学习如何使用Java、Ruby等编程语言结合AJAX开发Web应用。 #### 九、总结 AJAX技术极大地推动了Web应用的发展,为用户提供了一个更加流畅和交互性更强的网络体验。通过...
Ajax广泛应用于网页表单提交、无限滚动加载、实时聊天、地图应用、在线编辑器、文件上传等场景,大大提升了网页的交互性和用户体验。 总结来说,Ajax技术是现代Web开发中的重要工具,结合JavaScript原生API或jQuery...
Direct Web Remoting(DWR)简化了Java与JavaScript之间的通信,支持AJAX式的远程调用。 #### 六、参考资料与社区 - **JavaWorld@TW的Ajax讨论区**:这是一个活跃的在线社区,提供了关于Ajax的各种讨论和技术支持...
Java/JavaEE 学习笔记 作者在杰普学习时的学习笔记,是J2ee初学者必备手册,是大家学习J2EE开发的很好的参考笔记。 Java/JavaEE 学习笔记 内容目录: Unix 学习笔记..........7 一、Unix前言............7 二、...
### AJAX框架:DWR与EXT实践 #### DWR框架简介 DWR(Direct Web Remoting)是一种用于简化Ajax开发的框架,它允许开发者在客户端JavaScript中直接调用服务器端的Java方法,从而大大降低了开发复杂度。对于习惯于...
AJAX允许开发者在不刷新整个网页的情况下,通过后台与服务器交换数据并局部更新页面,从而提高用户体验。这篇博文可能是对AJAX的基本原理、实现方法以及实际应用的介绍。 在【描述】中虽然没有具体信息,但我们可以...
**JSP与Ajax技术简介** JSP(JavaServer Pages)是Java平台上的动态网页技术,它允许开发人员在HTML页面中嵌入Java代码,从而实现动态网页的创建。JSP的核心概念包括页面生命周期、指令、脚本元素以及内置对象等。...
通过这个“JavaScript从入门到精通”的教程,你将能够系统地学习并掌握JavaScript的各个方面,从基础语法到高级特性,再到实战应用,为成为Web开发的专家奠定坚实基础。无论是网页交互、后端通信还是移动应用开发,...
《Pro JSF and Ajax: Building Rich Internet Components》是一本深入探讨JavaServer Faces(JSF)与Ajax技术结合使用的专业书籍,旨在帮助读者构建功能强大且用户体验优秀的互联网组件。本书由Jonas Jacobi和John R...
【描述】"javaweb structs2 ssprint Hibernate经典入门案例 聊天项目"强调了这是一个针对初学者的实践案例,通过Struts2、Spring和Hibernate这三个核心组件的集成,来创建一个聊天系统。Struts2作为MVC(模型-视图-...
- AJAX异步通信:实现页面不刷新的数据更新,如实时聊天、无刷新加载更多内容。 - 事件处理:监听用户的点击、滚动等行为,实现响应式交互。 3. **Java在主页制作中的应用** - Applet:虽然现在使用较少,但...
2.3 Ajax聊天室 14 2.3.1 异步发送请求 14 2.3.2 解决多余刷新的问题 16 2.3.3 解析服务器响应 19 2.3.4 何时发送请求 20 2.3.5 Ajax 聊天室的特点 24 2.4 传统 Web 应用与 Ajax 的对比 24 2.5 小结 25 第 ...
2.3 Ajax聊天室················ 42 2.3.1 异步发送请求··················· 42 2.3.2 解决多余刷新的问题······· 44 2.3.3 解析服务器响应··············...
### DWR 快速入门与实战应用 #### DWR简介 DWR(Direct Web Remoting)是一种用于简化Ajax应用程序开发的框架。它提供了一个简单的方法来实现从客户端JavaScript调用服务器端Java方法的功能,同时也支持从Java端...
Direct Web Remoting (DWR) 是一个开源的Java库,允许Web应用程序在浏览器和服务器之间进行实时通信,绕过传统的AJAX限制。DWR通过提供一套JavaScript库与服务器端Java对象进行交互,使得动态更新页面变得简单而高效...
- 实现基于AJAX的即时聊天、轮询等功能。 - 掌握JSON数据格式及其在AJAX通信中的应用。 #### 10. UML - **知识点概述**:UML(Unified Modeling Language)是一种图形化的建模语言,广泛应用于软件工程领域。 - *...
- **定义**:Java Database Connectivity,是Java中用来与数据库进行通信的应用程序接口。 - **连接数据库**:通过`DriverManager.getConnection()` 方法建立连接。 - **执行SQL**:使用`Statement` 或 `...
此外,集锦中还包括了Java报表制作、BBS论坛项目、GOF设计模式、UML建模技术、版本控制软件(CVS和SVN)、XML技术、Junit单元测试、Linux系统学习、JDBC技术、MySQL和Oracle数据库教程、在线聊天系统、坦克大战项目...