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

设计过程:先对商品的属性进行创建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. Log4j的入门和使用

    Log4j(log for java)是Apache的一个开源项目,通过使用Log4j,我们可以控制日志信息输送的目的地是控制台.文件.GUI组件,甚至是套接口服务器.NT的事件记录器.UNIX Sy ...

  2. 解决国内NPM安装依赖速度慢问题

      版权声明:本文为博主原创文章,转载请注明原文地址. http://blog.csdn.net/rongbo_j/article/details/52106580 不知道各位是否遇到这种情况,使用N ...

  3. python3 load Iris.data数据集出现报错key words: b'Iris-setosa'

    通过搜索原因,发现有可能是在对文件读取是编译出现了问题,并且Keyword中提示b'Iris-setosa',而我们的string转float函数中没有字母b,很奇怪.所以尝试将转换函数所有的stri ...

  4. 输入正整数n,求各位数字和

    import java.util.Scanner; /** * @author:(LiberHome) * @date:Created in 2019/3/5 10:24 * @description ...

  5. Lecture5_1&5_2.随机变量的数字特征(数学期望、方差、协方差)

    一.数学期望 1.离散型随机变量的数学期望 设X为离散随机变量,其概率分布为:P(X=xk)=pk 若无穷级数$\sum_{k=1}^{+\infty}x_kp_k$绝对收敛 (即满足$\sum_{k ...

  6. 使用Eclipse+jlink调试STM32

    使用Eclipse+JLINK调试STM32 安装eclipse + CDT. 安装交叉编译工具(工具链ARM CROSS GCC--GUN ARM http://gnuarmeclipse.sour ...

  7. 安装Office2010出现MSXML版本6.10.1129.0错误

      在键盘上按“win+R”组合键出现图图示界面后,输入“regsvr32 /u msxml6.dll”,点击“确定”. 出现图示显示后,点击“确定”,并同时去试试office是否能够安装了. 如果上 ...

  8. ubuntu下安装PyCharm的两种方式

    PyCharm一个是Python集成开发环境,它既提供收费的专业版,也提供免费的社区版本.PyCharm带有一整套可以帮助用户在使用Python语言开发时提高其效率的工具,比如调试.语法高亮.Proj ...

  9. Building gRPC Client iOS Swift Note Taking App

    gRPC is an universal remote procedure call framework developed by Google that has been gaining inter ...

  10. 召回率(Recall),精确率(Precision),平均正确率

    https://blog.csdn.net/yanhx1204/article/details/81017134 摘要 在训练YOLO v2的过程中,系统会显示出一些评价训练效果的值,如Recall, ...