设计思路:先是创建两个表,一个用来操作库内商品的增删改查,一个用来记录商品的流水信息。

设计过程:先对商品的属性进行创建javaBean编写,之后编写数据库连接类,之后编写数据库操作类,之后编写服务类,之后编写Servlet类,最后编写JSP,然后对web.xml进行写入

代码:Course.java

package com.zh.entity;

public class Course {
private int ID;
private String name;
private String mf;
private String model;
private String spec;
public int get_ID() {
return ID;
}
public void set_ID(int ID) {
this.ID = ID;
}
public String get_name() {
return name;
}
public void set_name(String name) {
this.name=name;
}
public String get_mf() {
return mf;
}
public void set_mf(String mf) {
this.mf=mf;
}
public String get_model() {
return model;
}
public void set_model(String model) {
this.model=model;
}
public String get_spec() {
return spec;
}
public void set_spec(String spec) {
this.spec=spec;
}
public Course() {};
public Course(int ID,String name,String mf,String model,String spec) {
this.ID=ID;
this.name=name;
this.mf=mf;
this.model=model;
this.spec=spec;
}
public Course(String name,String mf,String model,String spec) {
this.name=name;
this.mf=mf;
this.model=model;
this.spec=spec;
}
}

代码:DButil.java

package com.zh.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; public class DButil {
public static Connection getConnection(){
Connection conn = null;
try {
conn = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/saler?serverTimezone=UTC","root","hao19990507.");
System.out.println("连接成功");
}catch (Exception e){
e.printStackTrace();
}
return conn;
} public static void close(Statement sta,Connection con){
if (sta != null) {
try {
sta.close();
} catch (SQLException e) {
e.printStackTrace();
}
} if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public static void close(ResultSet rs,Statement sta,Connection con){
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
} if (sta != null) {
try {
sta.close();
} catch (SQLException e) {
e.printStackTrace();
}
} if (con != null) {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}

代码:CourseDao.java

package com.zh.dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List; import com.zh.entity.Course;
import com.zh.util.DButil; public class CourseDao {
public void main(String []args) { }
/*增加
*
*/
public boolean add(Course Bean) {
String sql="insert into goods(name,mf,model,spec) values('"+Bean.get_name()+"','"+Bean.get_mf()+"','"+Bean.get_model()+"','"+Bean.get_spec()+"')";
Connection conn = null;
Statement state = null;
boolean f = false;
int a=0;
try {
conn=DButil.getConnection();
state = conn.createStatement();
state.execute(sql);
a=state.executeUpdate(sql); } catch (Exception e) {
e.printStackTrace();
} finally {
DButil.close(state, conn);
} if (a>0) {
f = true;
}
return f;
}
/*删除
*
*/
public boolean deleteByID(int ID) {
boolean f=false;
String sql="delete from goods where ID='"+ID+"'";
Connection conn=DButil.getConnection();
Statement state = null;
int a = 0;
try { state = conn.createStatement();
state.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
} finally {
DButil.close(state, conn);
} if (a > 0) {
f = true;
}
return f; }
/* 修改
*
*/ public boolean update(Course b) {
String sql="updata goods set name='"+b.get_name()+"', mf='"+b.get_mf()+"',model='"+b.get_model()+"' where ID='"+b.get_ID()+ "'";
boolean f = false;
int a = 0;
Connection conn=DButil.getConnection();
Statement state = null;
try {
state = conn.createStatement();
state.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
} finally {
DButil.close(state, conn);
} if (a > 0) {
f = true;
}
return f;
} /**
* 通过ID获得一个bean对象
*/
public Course findByID(int ID) {
Connection conn=null;
Statement state=null;
ResultSet rs=null;
Course u=null;
try {
conn=DButil.getConnection();
String sql="select*from goods where ID='"+ID+"'"; state=conn.createStatement();
rs=state.executeQuery(sql);
u=new Course();
while(rs.next()) {
String name=rs.getString("name");
String mf=rs.getString("mf");
String model=rs.getString("model");
String spec=rs.getString("spec");
u.set_ID(ID);
u.set_name(name);
u.set_mf(mf);
u.set_model(model);
u.set_spec(spec);
}
}catch (Exception e) {
e.printStackTrace();
} finally {
DButil.close(rs, state, conn);
} return u;
}
/*
* 通过name获得一个类对象
*/
public Course findByName(String name) {
String sql = "select * from goods where name ='" + name + "'";
Connection conn = DButil.getConnection();
Statement state = null;
ResultSet rs = null;
Course course = null; try {
state = conn.createStatement();
rs = state.executeQuery(sql);
while (rs.next()) {
int id = rs.getInt("id");
String name1 = rs.getString("name");
String mf = rs.getString("mf");
String model=rs.getString("model");
String spec=rs.getString("spec");
course = new Course(id, name1, mf, model,spec);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
DButil.close(rs, state, conn);
} return course;
}
/*
* 查找
*/
public List<Course> search(String name, String mf, String model,String spec) {
String sql = "select * from goods where ";
if (name != "") {
sql += "name like '%" + name + "%'";
}
if (mf != "") {
sql += "teacher like '%" + mf + "%'";
}
if (model != "") {
sql += "classroom like '%" + model + "%'";
}
if (spec != "") {
sql += "classroom like '%" + spec + "%'";
}
List<Course> list = new ArrayList<>();
Connection conn = DButil.getConnection();
Statement state = null;
ResultSet rs = null; try {
state = conn.createStatement();
rs = state.executeQuery(sql);
Course bean = null;
while (rs.next()) {
int ID = rs.getInt("ID");
String name1 = rs.getString("name");
String mf1 = rs.getString("mf");
String model1 = rs.getString("model");
String spec1=rs.getString("spec");
bean = new Course(ID, name1,mf1,model1, spec1);
list.add(bean);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
DButil.close(rs, state, conn);
} return list;
}
/*
* 显示全部
*/
public List<Course> list() {
String sql = "select * from goods";
List<Course> list = new ArrayList<>();
Connection conn = DButil.getConnection();
Statement state = null;
ResultSet rs = null; try {
state = conn.createStatement();
rs = state.executeQuery(sql);
Course bean = null;
while (rs.next()) {
int ID = rs.getInt("ID");
String name1 = rs.getString("name");
String mf1 = rs.getString("mf");
String model1 = rs.getString("model");
String spec1=rs.getString("spec");
bean = new Course(ID, name1,mf1,model1, spec1);
list.add(bean);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
DButil.close(rs, state, conn);
} return list;
} }

代码:Courseservice.java

package com.zh.service;
import java.util.List; import com.zh.dao.CourseDao;
import com.zh.entity.Course;
/**
* CourseService
* 服务层
* @author
*
*/
public class CourseService { //CourseDao cDao = new CourseDao(); /**
* 添加
* @param course
* @return
*/
public boolean add(Course course) {
boolean f = false;
try {
CourseDao cDao = new CourseDao();
cDao.add(course);
f = true;
}catch (Exception e) {
e.printStackTrace();
}
return f;
} /**
* 删除
*/ public void del(int id) {
CourseDao cDao = new CourseDao();
cDao.deleteByID(id);
} /**
* 修改
* @return
*/
public void update(Course course) {
CourseDao cDao = new CourseDao();
cDao.update(course);
} /**
* 通过ID得到一个Course
* @return
*/
public Course getCourseByID(int ID) {
CourseDao cDao = new CourseDao();
return cDao.findByID(ID);
}
/**
* 通过name得到一个Course
* @return
*/
public Course getCourseByName(String name) {
CourseDao cDao = new CourseDao();
return cDao.findByName(name);
} /**
* 查找
* @return
*/
public List<Course> search(String name, String mf, String model,String spec) {
CourseDao cDao = new CourseDao();
return cDao.search(name, mf, model,spec);
} /**
* 全部数据
* @return
*/
public List<Course> list() {
CourseDao cDao = new CourseDao();
return cDao.list();
}
}

代码:CourseServlet.java

package com.zh.servlet;

import java.io.IOException;
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.zh.dao.CourseDao;
import com.zh.entity.Course;
import com.zh.service.CourseService; public class CourseServlet extends HttpServlet {
private static final long serialVersionUID = 1L; CourseService service = new CourseService();
CourseDao cdao=new CourseDao();
/**
* 方法选择
*/
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
String method = req.getParameter("method");
if ("add".equals(method)) {
add(req, resp);
} else if ("del".equals(method)) {
del(req, resp);
} else if ("update".equals(method)) {
update(req, resp);
} else if ("search".equals(method)) {
search(req, resp);
} else if ("getcoursebyid".equals(method)) {
getCourseById(req, resp);
} else if ("getcoursebyname".equals(method)) {
getCourseByName(req, resp);
} else if ("list".equals(method)) {
list(req, resp);
}
} /**
* 添加
* @param req
* @param resp
* @throws IOException
* @throws ServletException
*/
private void add(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
req.setCharacterEncoding("utf-8");
String name = req.getParameter("name");
String mf = req.getParameter("mf");
String model = req.getParameter("model");
String spec = req.getParameter("spec");
Course course = new Course(name, mf, model,spec); //添加后消息显示
if(cdao.add(course)) {
req.setAttribute("message", "添加成功");
req.getRequestDispatcher("add.jsp").forward(req,resp);
} else {
req.setAttribute("message", "添加失败,请重新录入");
req.getRequestDispatcher("add.jsp").forward(req,resp);
}
} /**
* 全部
* @param req
* @param resp
* @throws ServletException
*/
private void list(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
req.setCharacterEncoding("utf-8");
List<Course> courses = service.list();
req.setAttribute("courses", courses);
req.getRequestDispatcher("list.jsp").forward(req,resp);
} /**
* 通过ID得到Course
* @param req
* @param resp
* @throws ServletException
*/
private void getCourseById(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
req.setCharacterEncoding("utf-8");
int ID =Integer.parseInt( req.getParameter("ID"));
Course course = service.getCourseByID(ID);
req.setAttribute("course", course);
req.getRequestDispatcher("detail2.jsp").forward(req,resp);
} /**
* 通过名字查找
* 跳转至删除
* @param req
* @param resp
* @throws IOException
* @throws ServletException
*/
private void getCourseByName(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
req.setCharacterEncoding("utf-8");
String name = req.getParameter("name");
Course course = service.getCourseByName(name);
if(course == null) {
req.setAttribute("message", "查无此商品!");
req.getRequestDispatcher("del.jsp").forward(req,resp);
} else {
req.setAttribute("course", course);
req.getRequestDispatcher("detail.jsp").forward(req,resp);
}
} /**
* 删除
* @param req
* @param resp
* @throws IOException
* @throws ServletException
*/
private void del(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
req.setCharacterEncoding("utf-8");
int ID =Integer.parseInt( req.getParameter("ID"));
service.del(ID);
req.setAttribute("message", "删除成功!");
req.getRequestDispatcher("del.jsp").forward(req,resp);
} /**
* 修改
* @param req
* @param resp
* @throws IOException
* @throws ServletException
*/
private void update(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
req.setCharacterEncoding("utf-8");
int ID = Integer.parseInt(req.getParameter("ID"));
String name = req.getParameter("name");
String mf = req.getParameter("mf");
String model = req.getParameter("model");
String spec=req.getParameter("spec");
Course course = new Course( ID,name,mf, model, spec);
service.update(course);
req.setAttribute("message", "修改成功");
req.getRequestDispatcher("CourseServlet?method=list").forward(req,resp);
} /**
* 查找
* @param req
* @param resp
* @throws ServletException
*/
private void search(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
req.setCharacterEncoding("utf-8");
String name = req.getParameter("name");
String mf = req.getParameter("mf");
String model = req.getParameter("model");
String spec=req.getParameter("spec"); List<Course> courses = service.search(name, mf, model,spec);
req.setAttribute("courses", courses);
req.getRequestDispatcher("searchlist.jsp").forward(req,resp);
}
}

代码:add.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
.a{
margin-top: 20px;
}
.b{
font-size: 20px;
width: 160px;
color: white;
background-color: greenyellow;
}
</style>
</head>
<body>
<%
Object message = request.getAttribute("message");
if(message!=null && !"".equals(message)){ %>
<script type="text/javascript">
alert("<%=request.getAttribute("message")%>");
</script>
<%} %>
<div align="center">
<h1 style="color: red;">商品信息录入</h1>
<a href="index.jsp">返回主页</a>
<form action="CourseServlet?method=add" method="post" onsubmit="return check()">
<div class="a">
商品名称<input type="text" id="name" name="name"/>
</div>
<div class="a">
生产厂家<input type="text" id="mf" name="mf" />
</div>
<div class="a">
型号<input type="text" id="model" name="model" />
</div>
<div class="a">
规格<input type="text" id="spec" name="spec" />
</div>
<div class="a">
<button type="submit" class="b">保   存</button>
</div>
</form>
</div>
</body>
</html>

代码:del.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
.a{
margin-top: 20px;
}
.b{
font-size: 20px;
width: 160px;
color: white;
background-color: greenyellow;
}
</style>
</head>
<body>
<%
Object message = request.getAttribute("message");
if(message!=null && !"".equals(message)){ %>
<script type="text/javascript">
alert("<%=request.getAttribute("message")%>");
</script>
<%} %>
<div align="center">
<h1 style="color: red;">商品信息删除</h1>
<a href="index.jsp">返回主页</a>
<form action="CourseServlet?method=getcoursebyname" method="post" onsubmit="return check()">
<div class="a">
商品名称<input type="text" id="name" name="name"/>
</div>
<div class="a">
<button type="submit" class="b">查   找</button>
</div>
</form>
</div>
</body>
</html>

代码:detail.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
.a{
margin-top: 20px;
}
.b{
font-size: 20px;
width: 160px;
color: white;
background-color: greenyellow;
}
.tb, td {
border: 1px solid black;
font-size: 22px;
}
</style>
</head>
<body>
<div align="center">
<h1 style="color: red;">商品信息删除</h1>
<a href="index.jsp">返回主页</a>
<table class="tb">
<tr>
<td>商品名称</td>
<td>${course.name}</td>
</tr>
<tr>
<td>生产厂家</td>
<td>${course.mf}</td>
</tr>
<tr>
<td>商品型号</td>
<td>${course.model}</td>
</tr>
<tr>
<td>商品规格</td>
<td>${course.spec}</td>
</tr>
</table>
<div class="a">
<a onclick="return check()" href="CourseServlet?method=del&id=${course.ID}">删   除</a>
</div>
</div>
</body>
</html>

代码:detail2.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
.a{
margin-top: 20px;
}
.b{
font-size: 20px;
width: 160px;
color: white;
background-color: greenyellow;
}
</style>
</head>
<body>
<%
Object message = request.getAttribute("message");
if(message!=null && !"".equals(message)){ %>
<script type="text/javascript">
alert("<%=request.getAttribute("message")%>");
</script>
<%} %>
<div align="center">
<h1 style="color: red;">商品信息修改</h1>
<a href="index.jsp">返回主页</a>
<form action="CourseServlet?method=update" method="post" onsubmit="return check()">
<div class="a">
商品名称<input type="text" id="name" name="name" value="${course.name}"/>
</div>
<div class="a">
生产厂家<input type="text" id="mf" name="mf" value="${course.mf}"/>
</div>
<div class="a">
商品型号<input type="text" id="model" name="model" value="${course.model}"/>
</div>
<div class="a">
商品规格<input type="text" id="spec" name="spec" value="${course.spec}"/>
</div>
<input type="hidden" id="ID" name="ID" value="${course.ID}"/>
<div class="a">
<button type="submit" class="b">修   改</button>
</div>
</form>
</div> </body>
</html>

代码:index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>首页</title>
<style>
.a{
font-size: 26px;
margin-top: 20px;
}
</style>
</head>
<body>
<div align="center">
<h1 style="color: red;">商品基本信息管理系统</h1>
<div class="a">
<a href="add.jsp">商品信息录入</a>
</div>
<div class="a">
<a href="CourseServlet?method=list">商品信息修改</a>
</div>
<div class="a">
<a href="del.jsp">商品信息删除</a>
</div>
<div class="a">
<a href="search.jsp">商品信息查询</a>
</div>
</div>
</body>
</html>

代码:list.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
.a{
margin-top: 20px;
}
.b{
font-size: 20px;
width: 160px;
color: white;
background-color: greenyellow;
}
.tb, td {
border: 1px solid black;
font-size: 22px;
}
</style>
</head>
<body>
<%
Object message = request.getAttribute("message");
if(message!=null && !"".equals(message)){ %>
<script type="text/javascript">
alert("<%=request.getAttribute("message")%>");
</script>
<%} %>
<div align="center">
<h1 style="color: red;">商品信息列表</h1>
<a href="index.jsp">返回主页</a>
<table class="tb">
<tr>
<td>ID</td>
<td>商品名称</td>
<td>生产厂家</td>
<td>商品型号</td>
<td>商品规格</td>
<td align="center" colspan="2">操作</td>
</tr>
<c:forEach items="${courses}" var="item">
<tr>
<td>${item.ID}</td>
<td>${item.name}</td>
<td>${item.mf}</td>
<td>${item.model}</td>
<td>${item.spec}</td>
<td><a href="CourseServlet?method=getcoursebyid&id=${item.ID}">修改</a></td>
</tr>
</c:forEach>
</table>
</div>
</body>
</html>

代码:search.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
.a{
margin-top: 20px;
}
.b{
font-size: 20px;
width: 160px;
color: white;
background-color: greenyellow;
}
</style>
</head>
<body>
<div align="center">
<h1 style="color: red;">商品信息查询</h1>
<a href="index.jsp">返回主页</a>
<form action="CourseServlet?method=search" method="post" onsubmit="return check()">
<div class="a">
课程名称<input type="text" id="name" name="name"/>
</div>
<div class="a">
生产厂家<input type="text" id="mf" name="mf" />
</div>
<div class="a">
商品型号<input type="text" id="model" name="model" />
</div>
<div class="a">
商品规格<input type="text" id="spec" name="spec" />
</div>
<div class="a">
<button type="submit" class="b">查   询</button>
</div>
</form>
</div>
</body>
</html>

代码:searchlist.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
.a{
margin-top: 20px;
}
.b{
font-size: 20px;
width: 160px;
color: white;
background-color: greenyellow;
}
.tb, td {
border: 1px solid black;
font-size: 22px;
}
</style>
</head>
<body>
<div align="center">
<h1 style="color: red;">商品信息列表</h1>
<a href="index.jsp">返回主页</a>
<table class="tb">
<tr>
<td>ID</td>
<td>商品名称</td>
<td>生产厂家</td>
<td>生产型号</td>
<td>生产规格</td>
</tr>
<!-- forEach遍历出adminBeans -->
<c:forEach items="${courses}" var="item" varStatus="status">
<tr>
<td><a>${item.name}</a></td>
<td>${item.mf}</td>
<td>${item.model}</td>
<td>${item.spec}</td>
</tr>
</c:forEach>
</table>
</div>
</body>
</html>

代码:web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>dyjgj</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>CourseServlet </servlet-name>
<servlet-class>com.zh.servlet.CourseServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CourseServlet</servlet-name> <url-pattern>/CourseServlet</url-pattern>
</servlet-mapping> </web-app>

Servlet+jSP+java实现商品信息和流水的操作的更多相关文章

  1. servlet+jsp+java实现Web 应用

    servlet+jsp+java实现Web 应用 用java来构建一个web应用是特别容易的事情,jsp和php很像,可以嵌套在html中.程序的结构很简单,也很清楚,本文主要记录下大概的开发过程和环 ...

  2. servlet+jsp+java实现Web应用

    servlet+jsp+java实现Web应用 环境: 1,eclipse 2,tomcat3,eclipse tomcat 插件 开发过程: 1,建立一个Dynamic Web Project 2, ...

  3. Servlet & JSP - Java Web 访问资源的路径问题

    假设 Web 工程的目录结构如下图所示,并且 HelloServlet 配置为 @WebServlet(name = "helloServlet", urlPatterns = { ...

  4. 【Java Web】简易商品信息管理系统——首个Web项目

    正文之前 在学习了一段时间的Java Web的内容之后,当然需要有个项目来练练手,我相信大多数人的首选项目都是信息管理系统吧,所以我选择了商品信息管理系统 目前项目源码已全部上传至GitHub,欢迎大 ...

  5. Servlet作业2-将表单提交的商品信息输出到页面中

    1,表单页面 shangpin.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8&qu ...

  6. 从0开始学Java——JSP和Servlet——jsp转servlet出错的三个典型场景

    由于jsp终究是要转换为servlet的java文件,然后再编译为.class文件,最后才执行,那么在这过程的任何一个步骤都可能有问题,主要包括三个方面,下面逐一分析: 一.JSP转换为Servlet ...

  7. Java遇见HTML——JSP篇之商品浏览记录的实现

    一.项目总体介绍 使用Cookie实现商品浏览记录. 要实现这个程序采取的是Model1(Jsp+JavaBean)架构实现,具体步骤: 首先要有个数据库,商品表,操作数据库的一个类DBHelper类 ...

  8. 严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutputStream() has already been called

    错误: 严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutput ...

  9. 学生管理系统开发代码分析笔记:jsp+java bean+servlet技术

    1 序言 学习java web的时候很渴望有一份完整的项目给我阅读,而网上的大部分项目拿过来都无法直接用,好不容易找到了一个学生管理系统也是漏洞百出.在此,我将边修改边学习这份代码,并且加上完全的注释 ...

随机推荐

  1. jmeter使用指南:jmeter无脑式指南

    一:启动jmeter 二:添加线程组 三:添加 HTTP 请求 四:添加监听器 五:填写访问的域名,并保存 六:运行,查看结果 七:配置多线程.循环机制,进行压力测试

  2. JAVA生成(可执行)Jar包的全面详解说明 [打包][SpringBoot][Eclipse][IDEA][Maven][Gradle][分离][可执行]

    辛苦所得,转载还请注明: https://www.cnblogs.com/applerosa/p/9739007.html  得空整理了关于java 开发中,所有打包方式的 一个操作方法, 有基于ID ...

  3. laravel 控制器类DB类操作

    例子:TrGo表(trgo_chip): laravel框架建立:TrGoModel <?php namespace TrChaos\Model; class TrGoModel extends ...

  4. Publisher/Subscriber

    public interface IPublisher { void Publish<T>(T data); void Subscribe<T>(object subscrib ...

  5. 修改文件MD5值

    1.查看文件的MD5值 (1)下载MD5Checker http://getmd5checker.com/download.html 或者 链接: https://pan.baidu.com/s/1e ...

  6. 玩转PIL >>> 玩转photo

    前:1.使用图片放在文件最后,需要的请自行下载 2.运行环境win10家庭版,已经安装好pillow库 一.学习总结 PIL库支持图像的储存,显示和处理,几乎能处理所有的图片格式,可以完成对图像的缩放 ...

  7. vue Baidu Map --- vue百度地图插件

    vue Baidu Map 官网:https://dafrok.github.io/vue-baidu-map/#/zh/start/installation javascript 官网:http:/ ...

  8. mac OSx 安装 mysqlclient

    首先需要安装  按照提示操作 brew install mysql-connector-c 然后 修改mysql_config 执行mysql_config可以看到文件所在位置 我的目录放在 /usr ...

  9. python类与对象-如何创建可管理的对象属性

    如何创建可管理的对象属性 问题举例 在面向对象编程中, 我们把方法看作对象的接口, 直接访问对象的属性可能是不安全的,或设计上不够灵活. 但是使用调用方法在形式上不如访问属性简洁. circle.ge ...

  10. ES6,ES5,ES3,对比学习~

    在简书上看到一个博主写的文章,感觉很有用.留下:https://www.jianshu.com/p/287e0bb867ae  Excuse me?这个前端面试在搞事!https://zhuanlan ...