资源简介
主要用servlet搭建出来的图书管理系统,其中有对MySQL数据库的增删改查,等简单的Javaweb项目
代码片段和文件信息
package login;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import QAQ.Do;
/**
* Servlet implementation class addAction
*/
@WebServlet(“/addAction“)
public class addAction extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public addAction() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {
// TODO Auto-generated method stub
response.setContentType(“text/html“);
// 这句话的意思,是让浏览器用utf8来解析返回的数据
response.setHeader(“Content-type“ “text/html;charset=UTF-8“);
// 这句话的意思,是告诉servlet用UTF-8转码,而不是用默认的ISO8859
response.setHeader(“content-type“ “text/html;charset=UTF-8“);
response.setCharacterEncoding(“UTF-8“);
request.setCharacterEncoding(“UTF-8“);
PrintWriter out = response.getWriter();
String Id = request.getParameter(“Id“);
int id = Integer.parseInt(Id);
int book_id = id;
String book_name = request.getParameter(“book_name“);
String book_num = request.getParameter(“book_num“);
String book_concern = request.getParameter(“book_concern“);
String book_writer = request.getParameter(“book_writer“);
System.out.println(book_name+book_num+book_concern+book_writer);
Do a = new Do();
// a.show2( book_name book_concern book_writerbook_num book_indate);
if(a.show2(id book_namebook_concernbook_writerbook_idbook_num)) {
String docType = “\n“;
out.println(docType + “\n“
+ “tle> tle>\n“
+ “\n“ + “添加成功
\n“);
}else {
String docType = “\n“;
out.println(docType + “\n“
+ “tle> tle>\n“
+ “\n“ + “添加失败
\n“);
}
}
// public static int toInt(String strNum ){
// Integer integer = new Integer(strNum);
// return integer.parseInt(strNum);
// }
/**
* @see HttpServlet#doPost(HttpServletRequest request HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {
// TODO Auto-generated method stub
doGet(request response);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1019 2018-03-29 16:39 bookmanage\.classpath
文件 1268 2018-02-14 12:43 bookmanage\.project
文件 567 2018-02-14 12:43 bookmanage\.settings\.jsdtscope
文件 99 2018-02-19 11:36 bookmanage\.settings\org.eclipse.core.resources.prefs
文件 364 2018-02-14 12:43 bookmanage\.settings\org.eclipse.jdt.core.prefs
文件 482 2018-02-14 12:43 bookmanage\.settings\org.eclipse.wst.common.component
文件 305 2018-03-29 14:33 bookmanage\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2018-02-14 12:43 bookmanage\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2018-02-14 12:43 bookmanage\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 95 2018-02-19 08:24 bookmanage\.settings\org.jboss.ide.eclipse.as.core.prefs
文件 162 2018-02-14 12:44 bookmanage\.tern-project
文件 2904 2018-04-12 08:59 bookmanage\build\classes\login\addAction.class
文件 2406 2018-04-12 08:59 bookmanage\build\classes\login\DelAction.class
文件 3363 2018-04-12 08:59 bookmanage\build\classes\login\loginAction.class
文件 4670 2018-04-12 08:59 bookmanage\build\classes\login\queryAction.class
文件 2550 2018-04-12 08:59 bookmanage\build\classes\login\updateAction.class
文件 6419 2018-04-12 08:59 bookmanage\build\classes\QAQ\Do.class
文件 496 2018-02-27 16:46 bookmanage\milestone.txt
文件 2934 2018-02-27 17:03 bookmanage\src\login\addAction.java
文件 2338 2018-02-20 08:31 bookmanage\src\login\DelAction.java
文件 3108 2018-02-28 12:44 bookmanage\src\login\loginAction.java
文件 4450 2018-02-28 11:51 bookmanage\src\login\queryAction.java
文件 2450 2018-02-20 09:58 bookmanage\src\login\updateAction.java
文件 10907 2018-02-27 17:09 bookmanage\src\QAQ\Do.java
文件 4249 2018-02-19 11:36 bookmanage\src\QAQ\text.java
文件 963 2018-02-27 17:03 bookmanage\WebContent\add.jsp
文件 691 2018-02-20 18:31 bookmanage\WebContent\css\index.css
文件 518 2018-02-20 08:12 bookmanage\WebContent\del.jsp
文件 232 2018-02-20 20:10 bookmanage\WebContent\foot.html
文件 1404 2018-02-27 09:23 bookmanage\WebContent\index.html
............此处省略35个文件信息
评论
共有 条评论