资源简介
本文采用的是Jsp和SQL SERVER技术,通过使用数据库达到数据的存取,从而开发出了个人通讯录管理系统。讨论了开发该系统的可行性,提出了本系统的需求并给出了系统的总体框架,选择了NetBeans IDE 6.5和SQL SERVER 等作为开发工具,实现了本系统的各项功能。该系统实现的主要功能有:模块添加,删除,更改以及任务的添加,更改和删除功能,采用了人机对话方式,界面美观友好,信息查询灵活,方便,快捷,准确,数据存储安全可靠,全面地展示了企业的形象。系统利用用户权限限定,从而提高了程序的安全性,该系统通过测试,能达到预期的效果。
代码片段和文件信息
/*
* To change this template choose Tools | Templates
* and open the template in the editor.
*/
package com;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author Administrator
*/
public class add extends HttpServlet {
/**
* Processes requests for both HTTP GET
and POST
methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
response.setContentType(“text/html;charset=UTF-8“);
request.setCharacterEncoding(“utf-8“);
PrintWriter out = response.getWriter();
String name = request.getParameter(“name“);
String age = request.getParameter(“age“);
String sex = request.getParameter(“sex“);
String birth = request.getParameter(“birth“);
String phone = request.getParameter(“phone“);
String email=request.getParameter(“email“);
String address=request.getParameter(“address“);
Statement sqlStmt;
try {
if (request.getSession().getAttribute(“conn“) == null) {
response.sendRedirect(“index.jsp“);
} else {
Connection conn = (Connection) request.getSession().getAttribute(“conn“);
sqlStmt = conn.createStatement();
String sqlQuery = “insert into list values(‘“ +name + “‘‘“ + age + “‘‘“ + sex + “‘‘“ + birth + “‘‘“ + phone +“‘‘“ + email + “‘‘“ +address+ “‘)“;
sqlStmt.executeUpdate(sqlQuery);
response.sendRedirect(“welcome.jsp“);
}
} catch (SQLException ex) {
Logger.getLogger(add.class.getName()).log(Level.SEVERE null ex);
} finally {
out.close();
}
}
//
/**
* Handles the HTTP GET
method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
processRequest(request response);
}
/**
* Handles the HTTP POST
method.
* @param request servlet request
*
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1114 2009-06-13 09:24 200609010531董秀兰\DD\build\web\add.jsp
文件 1034 2009-06-13 09:48 200609010531董秀兰\DD\build\web\delete.jsp
文件 2004 2009-06-13 12:25 200609010531董秀兰\DD\build\web\edit.jsp
文件 789 2009-06-13 12:17 200609010531董秀兰\DD\build\web\index.jsp
文件 503 2009-06-13 13:02 200609010531董秀兰\DD\build\web\J2EE.dpf
文件 25 2009-06-13 08:56 200609010531董秀兰\DD\build\web\me
目录 0 2009-06-13 08:56 200609010531董秀兰\DD\build\web\me
文件 731 2009-06-13 08:56 200609010531董秀兰\DD\build\web\search_id.jsp
文件 734 2009-06-13 08:56 200609010531董秀兰\DD\build\web\search_name.jsp
文件 1788 2009-06-13 12:53 200609010531董秀兰\DD\build\web\show_id.jsp
文件 1895 2009-06-13 12:53 200609010531董秀兰\DD\build\web\show_name.jsp
文件 616 2009-06-13 08:56 200609010531董秀兰\DD\build\web\test.jsp
文件 0 2009-06-13 08:56 200609010531董秀兰\DD\build\web\WEB-INF\classes\.netbeans_automatic_build
文件 3088 2009-06-13 09:50 200609010531董秀兰\DD\build\web\WEB-INF\classes\com\add.class
文件 3389 2009-06-13 12:39 200609010531董秀兰\DD\build\web\WEB-INF\classes\com\edit.class
文件 3379 2009-06-13 08:56 200609010531董秀兰\DD\build\web\WEB-INF\classes\com\login.class
目录 0 2009-06-13 08:56 200609010531董秀兰\DD\build\web\WEB-INF\classes\com
目录 0 2009-06-13 08:56 200609010531董秀兰\DD\build\web\WEB-INF\classes
文件 294726 2009-06-13 08:56 200609010531董秀兰\DD\build\web\WEB-INF\lib\jtds-1.2.2.jar
目录 0 2009-06-13 08:56 200609010531董秀兰\DD\build\web\WEB-INF\lib
文件 503 2009-06-13 08:56 200609010531董秀兰\DD\build\web\WEB-INF\sun-web.xm
文件 1231 2009-06-13 09:11 200609010531董秀兰\DD\build\web\WEB-INF\web.xm
目录 0 2009-06-13 08:56 200609010531董秀兰\DD\build\web\WEB-INF
文件 963 2009-06-13 13:02 200609010531董秀兰\DD\build\web\welcome.jsp
目录 0 2009-06-13 09:10 200609010531董秀兰\DD\build\web
目录 0 2009-06-13 08:56 200609010531董秀兰\DD\build
文件 3485 2009-06-13 08:52 200609010531董秀兰\DD\build.xm
文件 1106 2009-06-13 12:16 200609010531董秀兰\DD\create.sql
文件 318022 2009-06-13 08:56 200609010531董秀兰\DD\dist\DD.war
目录 0 2009-06-13 08:56 200609010531董秀兰\DD\dist
............此处省略39个文件信息
- 上一篇:高考信息系统-Java课程设计
- 下一篇:android日历源代码
评论
共有 条评论