-
大小: 9.88MB文件类型: .zip金币: 2下载: 0 次发布日期: 2023-10-08
- 语言: Java
- 标签: javajquery json 增删改查 jquery整合
资源简介
本人最终整合的java+jquery增删改查例子,找资料好费劲的,绝对值得收藏。内置数据库表+项目

代码片段和文件信息
package com.action;
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 com.dao.JsonDao;
public class JSONServlet extends HttpServlet {
JsonDao d = new JsonDao();
/**
* Constructor of the object.
*/
public JSONServlet() {
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.setContentType(“text/html“);
response.setCharacterEncoding(“utf-8“);
String type = request.getParameter(“type“);
if (type.equals(“select“)) {
PrintWriter out = response.getWriter();
String json = d.getJson();
out.println(json);
out.flush();
out.close();
} else if (type.equals(“add“)) {
String name = request.getParameter(“name“);
String newName = new String(name.getBytes(“ISO8859_1“)“utf-8“) ;
String password = request.getParameter(“password“);
PrintWriter out = response.getWriter();
if (d.add(newName password)) {
out.println(“添加成功!“);
} else {
out.println(“添加失败!“);
}
out.flush();
out.close();
}else if(type.equals(“del“))
{
int id = Integer.parseInt(request.getParameter(“id“));
PrintWriter out = response.getWriter();
if (d.delete(id)) {
out.println(“删除成功!“);
} else {
out.println(“删除失败!“);
}
out.flush();
out.close();
}else if(type.equals(“get“))
{
int id = Integer.parseInt(request.getParameter(“id“));
PrintWriter out = response.getWriter();
String json = d.getByid(id);
out.println(json);
out.flush();
out.close();
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-10-05 23:34 jquery增删改查\
目录 0 2012-10-05 23:33 jquery增删改查\json+jquery\
文件 927 2012-10-05 16:59 jquery增删改查\json+jquery\.classpath
目录 0 2012-10-05 23:35 jquery增删改查\json+jquery\.myeclipse\
文件 306 2012-10-05 11:32 jquery增删改查\json+jquery\.myme
文件 1229 2012-10-05 13:32 jquery增删改查\json+jquery\.project
目录 0 2012-10-05 23:33 jquery增删改查\json+jquery\.settings\
文件 330 2012-10-05 11:39 jquery增删改查\json+jquery\.settings\org.eclipse.jdt.core.prefs
目录 0 2012-10-05 23:34 jquery增删改查\json+jquery\WebRoot\
目录 0 2012-10-05 23:33 jquery增删改查\json+jquery\WebRoot\me
文件 39 2012-10-05 11:32 jquery增删改查\json+jquery\WebRoot\me
目录 0 2012-10-05 23:34 jquery增删改查\json+jquery\WebRoot\WEB-INF\
目录 0 2012-10-05 23:34 jquery增删改查\json+jquery\WebRoot\WEB-INF\classes\
目录 0 2012-10-05 23:34 jquery增删改查\json+jquery\WebRoot\WEB-INF\classes\com\
目录 0 2012-10-05 23:34 jquery增删改查\json+jquery\WebRoot\WEB-INF\classes\com\action\
文件 3064 2012-10-05 23:18 jquery增删改查\json+jquery\WebRoot\WEB-INF\classes\com\action\JSONServlet.class
目录 0 2012-10-05 23:34 jquery增删改查\json+jquery\WebRoot\WEB-INF\classes\com\dao\
文件 1566 2012-10-05 23:20 jquery增删改查\json+jquery\WebRoot\WEB-INF\classes\com\dao\ba
文件 4518 2012-10-05 23:18 jquery增删改查\json+jquery\WebRoot\WEB-INF\classes\com\dao\JsonDao.class
目录 0 2012-10-05 23:34 jquery增删改查\json+jquery\WebRoot\WEB-INF\lib\
文件 232019 2012-10-05 13:40 jquery增删改查\json+jquery\WebRoot\WEB-INF\lib\commons-beanutils-1.8.3.jar
文件 575389 2012-10-05 13:40 jquery增删改查\json+jquery\WebRoot\WEB-INF\lib\commons-collections-3.2.1.jar
文件 279193 2012-10-05 13:39 jquery增删改查\json+jquery\WebRoot\WEB-INF\lib\commons-lang-2.5.jar
文件 60686 2012-10-05 13:38 jquery增删改查\json+jquery\WebRoot\WEB-INF\lib\commons-logging-1.1.1.jar
文件 86487 2012-10-05 13:40 jquery增删改查\json+jquery\WebRoot\WEB-INF\lib\ezmorph-1.0.6.jar
文件 159123 2012-10-05 11:37 jquery增删改查\json+jquery\WebRoot\WEB-INF\lib\json-lib-2.4-jdk15.jar
文件 709922 2012-10-05 16:59 jquery增删改查\json+jquery\WebRoot\WEB-INF\lib\mysql-connector-java-5.1.7-bin.jar
文件 800 2012-10-05 11:43 jquery增删改查\json+jquery\WebRoot\WEB-INF\web.xm
文件 5778 2012-10-05 23:23 jquery增删改查\json+jquery\WebRoot\index.jsp
目录 0 2012-10-05 23:33 jquery增删改查\json+jquery\WebRoot\js\
目录 0 2012-10-05 23:33 jquery增删改查\json+jquery\WebRoot\js\images\
............此处省略1153个文件信息
- 上一篇:javaswing课程设计——课程表
- 下一篇:Android 串口通信
相关资源
- jsonarray所必需的6个jar包.rar
- 简单的登录页面,实现增删改查(运
- fastjson-1.1.37.jar
- Ajax分页-增删改查-Oracle数据库-默认
- 无框架增删改查+登陆+分页+事务处理
-
xm
l转Json的jar包 - JavaWeb中文件上传最强工具类
- list map转换成json格式以及相关jar包(
- ssm实现增删改查
- 在JAVA中封装JSON数据
- dom4j jar包,JSON必须jar包
- java音乐网站
- 完整json-lib jar包以及依赖包
- JSON转换所需的各种jar包
- java+ajax+json+jquery完整
- Mybatis+Servlet整合增删改查模板
- SQLite在android中实现增删改查小
- Android Http URL Connection获取数据并JSON解
- json6个必备包
- Android开发之与服务器jsp发送、接受
- java json jar包 绿色官方版
- Android PHP JSON 实现登陆注册功能
- JSON从服务器数据到Android客户端
- Android开发小程序:A、B应用实现数据
- 使用json需要的jar包
- json用到的jar
- json 常用jar包
- java实现与数据库连接验证用户登录实
- json-lib所需全部jar包json-lib-2.2.3-jdk13
- javaFX实现的图书馆后台管理系统,有
评论
共有 条评论