资源简介
jsp连接SQLserver数据库实现增删改查.这是一个完整的项目,适合新手使用啊教程都写的很详细。

代码片段和文件信息
package controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.student;
import dao.studentDAO;
public class AddServlet extends HttpServlet {
/**
* Constructor of the object.
*/
public AddServlet() {
super();
}
/**
* Destruction of the servlet.
*/
public void destroy() {
super.destroy(); // Just puts “destroy“ string in log
// Put your code here
}
/**
* The doGet method of the servlet.
*
* 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 {
doPost(request response);
}
/**
* The doPost method of the servlet.
*
* 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 {
//增加
request.setCharacterEncoding(“utf-8“);
response.setCharacterEncoding(“utf-8“);
String name = request.getParameter(“name“);
String java = request.getParameter(“java“);
String python = request.getParameter(“python“);
String javascript = request.getParameter(“javascript“);
studentDAO dao = new studentDAO();
boolean flag = dao.addStuDao(name java python javascript);
response.setContentType(“text/html utf-8“);
PrintWriter pw = response.getWriter();
if (flag) {
pw.write(“ript>alert(‘提交成功!‘);window.location=‘querty‘ ript>“);
System.out.println(“add true“);
} else {
pw.write(“ript>alert(‘提交失败!‘);window.location=‘querty‘ ript>“);
System.out.println(“add false“);
}
pw.flush();
pw.close();
}
/**
* Initialization of the servlet.
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-01-08 13:28 test\
文件 433 2018-12-30 15:43 test\.classpath
目录 0 2019-01-08 13:34 test\.myeclipse\
文件 285 2018-12-30 15:31 test\.myme
文件 1410 2018-12-30 15:59 test\.project
目录 0 2019-01-08 13:28 test\.settings\
文件 500 2018-12-30 15:31 test\.settings\.jsdtscope
文件 330 2018-12-30 15:31 test\.settings\org.eclipse.jdt.core.prefs
文件 49 2018-12-30 15:31 test\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2018-12-30 15:31 test\.settings\org.eclipse.wst.jsdt.ui.superType.name
目录 0 2019-01-08 13:28 test\WebRoot\
目录 0 2019-01-08 13:28 test\WebRoot\me
文件 36 2018-12-30 15:31 test\WebRoot\me
目录 0 2019-01-08 13:28 test\WebRoot\WEB-INF\
目录 0 2019-01-08 13:28 test\WebRoot\WEB-INF\classes\
目录 0 2019-01-08 13:28 test\WebRoot\WEB-INF\classes\controller\
文件 2154 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\controller\AddServlet.class
文件 1934 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\controller\DeleteServlet.class
文件 2276 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\controller\LoginServlet.class
文件 2394 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\controller\QuertyOneServlet.class
文件 1532 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\controller\QuertyServlet.class
文件 1598 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\controller\QuertyTwoServlet.class
目录 0 2019-01-08 13:28 test\WebRoot\WEB-INF\classes\dao\
文件 4433 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\dao\studentDAO.class
文件 1459 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\dao\userDAO.class
目录 0 2019-01-08 13:28 test\WebRoot\WEB-INF\classes\model\
文件 1634 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\model\student.class
文件 1067 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\model\user.class
目录 0 2019-01-08 13:28 test\WebRoot\WEB-INF\classes\util\
文件 1158 2019-01-06 22:10 test\WebRoot\WEB-INF\classes\util\JDBCUtil.class
目录 0 2019-01-08 13:28 test\WebRoot\WEB-INF\lib\
............此处省略22个文件信息
相关资源
- java串口通信全套完整代码-导入eclip
- jsonarray所必需的6个jar包.rar
- JSP企业人事管理系统设计(源代码+论
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- 实现一个图书管理系统
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- JSP,SQL,MVC的选课系统
- Java编写的qq聊天室
- 基于JSP的学生宿舍管理系统(源码 数
- JSP选课管理系统
- mysql jsp网站源码下载
- JSP做的化妆品商城
- Jsp购物车实例
- 商店商品管理系统 JAVA写的 有界面
评论
共有 条评论