• 大小: 3.59MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-02
  • 语言: Java
  • 标签: javawe  jsp  mysql  

资源简介

没有用到什么框架(带点了spring)比较简单 仅仅完成了图书的增删改查 jsp mysql mvc模式 文件里有数据库文件

资源截图

代码片段和文件信息

package controller;

import java.io.IOException;
import java.util.List;

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 entity.Cbs;
import entity.Shu;
import service.CbsService;
import service.ShuService;


@WebServlet(“/add“)
public class AddController extends HttpServlet {
private static final long serialVersionUID = 1L;

private ShuService shuservice = new ShuService();
private CbsService cbsservice = new CbsService();

protected void doGet(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {
//1.获取参数
//int id = Integer.parseInt(request.getParameter(“id“));

//2.业务处理  
//Shu shu = shuservice.getById(id);
List cbsList = cbsservice.getAll();

//3. 返回视图, 调用V-请求转发
//request.setAttribute(“shu“ shu);
request.setAttribute(“cbsList“ cbsList);
request.getRequestDispatcher(“/WEB-INF/jsp/add.jsp“).forward(request response);
}

protected void doPost(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {

String name = request.getParameter(“name“);
String author = request.getParameter(“author“);
Double price = Double.parseDouble(request.getParameter(“price“));
int cbsId = Integer.parseInt(request.getParameter(“cbsId“));



shuservice.insert(nameauthorpricecbsId);

response.sendRedirect(request.getContextPath()+“/list“);
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-03-06 12:39  tushu\
     目录           0  2019-03-06 12:39  tushu\src\util\
     目录           0  2019-03-06 12:39  tushu\src\service\
     目录           0  1980-01-01 00:00  tushu\.settings\
     目录           0  2019-03-06 12:39  tushu\src\filter\
     目录           0  2019-03-06 12:39  tushu\src\entity\
     目录           0  2019-03-06 12:39  tushu\src\dao\
     目录           0  2019-03-06 12:39  tushu\src\controller\
     目录           0  1980-01-01 00:00  tushu\src\
     文件        2646  2019-03-06 12:39  tushu\book.sql
     目录           0  1980-01-01 00:00  tushu\WebRoot\
     目录           0  2019-03-06 12:39  tushu\WebRoot\meta-INF\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\lib\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\classes\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\classes\controller\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\jsp\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\classes\util\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\classes\service\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\classes\filter\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\classes\entity\
     目录           0  2019-03-06 12:39  tushu\WebRoot\WEB-INF\classes\dao\
     文件        1446  2019-01-27 16:42  tushu\.classpath
     文件         905  2019-01-27 16:41  tushu\.project
     文件         564  2019-01-27 16:41  tushu\.settings\.jsdtscope
     文件         364  2019-01-27 16:41  tushu\.settings\org.eclipse.jdt.core.prefs
     文件         474  2019-01-27 16:41  tushu\.settings\org.eclipse.wst.common.component
     文件         345  2019-01-27 16:41  tushu\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2019-01-27 16:41  tushu\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2019-01-27 16:41  tushu\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件          39  2019-01-27 16:41  tushu\WebRoot\meta-INF\MANIFEST.MF
............此处省略37个文件信息

评论

共有 条评论