• 大小: 1.45MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-11
  • 语言: Java
  • 标签: JSP  汽车管理  系统  

资源简介

本系统为博主所写的汽车管理系统,仅供学习使用 1.本系统实现了用户的注册和登录 2.实现的对汽车的增删该查 3.博主使用的为MySQL数据库和JDBC技术 4.本系统的几个亮点: 1.实现了用户的登录状态 2.在修改的时候实现了数据回显 3.实现了批量删除功能 4.使用过滤器修改编码格式

资源截图

代码片段和文件信息

package com.xs.controller;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xs.entity.Car;

public class CarAddServlet extends HttpServlet {

@Override
protected void service(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {

String cid = request.getParameter(“cid“);
String cname = request.getParameter(“cname“);
String cprice = request.getParameter(“cprice“);
String color = request.getParameter(“color“);
String cbrand = request.getParameter(“cbrand“);
String clazz = request.getParameter(“clazz“);

Connection conn = null;

try {
Class.forName(“com.mysql.jdbc.Driver“);
conn = DriverManager.getConnection(“jdbc:mysql://localhost:3306/weekdemo““root““root“);
PreparedStatement ps = conn.prepareStatement(“insert into tb_car values(??????)“);
ps.setInt(1 Integer.parseInt(cid));
ps.setString(2 cname);
ps.setDouble(3 Double.parseDouble(cprice));
ps.setString(4 color);
ps.setString(5 cbrand);
ps.setString(6 clazz);
int in = ps.executeUpdate();
if(in > 0){
response.sendRedirect(“show“);
}else{
response.sendRedirect(“error.jsp“);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
if(conn != null){
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
if(conn != null){
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
}


}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-11-17 10:24  weekDemo1\
     文件         922  2018-11-17 10:24  weekDemo1\.classpath
     文件        1042  2018-11-17 10:24  weekDemo1\.project
     目录           0  2018-11-17 10:24  weekDemo1\.settings\
     文件         503  2018-11-17 10:24  weekDemo1\.settings\.jsdtscope
     文件         364  2018-11-17 10:24  weekDemo1\.settings\org.eclipse.jdt.core.prefs
     文件         479  2018-11-17 10:24  weekDemo1\.settings\org.eclipse.wst.common.component
     文件         345  2018-11-17 10:24  weekDemo1\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2018-11-17 10:24  weekDemo1\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2018-11-17 10:24  weekDemo1\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2018-11-17 10:24  weekDemo1\build\
     目录           0  2018-11-17 10:24  weekDemo1\build\classes\
     目录           0  2018-11-17 10:24  weekDemo1\build\classes\com\
     目录           0  2018-11-17 10:24  weekDemo1\build\classes\com\xs\
     目录           0  2018-11-17 10:24  weekDemo1\build\classes\com\xs\controller\
     文件        3691  2018-11-17 10:24  weekDemo1\build\classes\com\xs\controller\CarAddServlet.class
     文件        3105  2018-11-17 10:24  weekDemo1\build\classes\com\xs\controller\CarDeleteByIdServlet.class
     文件        3657  2018-11-17 10:24  weekDemo1\build\classes\com\xs\controller\CarDeleteServlet.class
     文件        4947  2018-11-17 10:24  weekDemo1\build\classes\com\xs\controller\CarSelectByNameServlet.class
     文件        3990  2018-11-17 10:24  weekDemo1\build\classes\com\xs\controller\CarShowServlet.class
     文件        3746  2018-11-17 10:24  weekDemo1\build\classes\com\xs\controller\CarUpdateByIdServlet.class
     文件        3073  2018-11-17 10:24  weekDemo1\build\classes\com\xs\controller\UserLoginServlet.class
     文件        2455  2018-11-17 10:24  weekDemo1\build\classes\com\xs\controller\UserRegServlet.class
     目录           0  2018-11-17 10:24  weekDemo1\build\classes\com\xs\entity\
     文件        2196  2018-11-17 10:24  weekDemo1\build\classes\com\xs\entity\Car.class
     文件        1706  2018-11-17 10:24  weekDemo1\build\classes\com\xs\entity\User.class
     目录           0  2018-11-17 10:24  weekDemo1\build\classes\com\xs\filter\
     文件        1233  2018-11-17 10:24  weekDemo1\build\classes\com\xs\filter\ServletFilter.class
     目录           0  2018-11-17 10:24  weekDemo1\src\
     目录           0  2018-11-17 10:24  weekDemo1\src\com\
     目录           0  2018-11-17 10:24  weekDemo1\src\com\xs\
............此处省略35个文件信息

评论

共有 条评论