大数据方向《JavaEE》项目案例【一定要收藏】

一、项目的需求

  1. 点击全选/全不选,选中或者全部不选中
  2. 部门名称为下拉框,动态加载,金额在数量和单价输入后自动生成,非空验证姓名不能重复,年龄必须是数字, 否则不能提交,电影状态如果是未上映,后面有一个上映的选项。
  3. 添加成功,跳转到查询所有
  4. 如果没有选中一条数据,点击批量删除提示“至少选择一条数据”
  5. 选中多条数据或者全部选中,点击批量删除提示“确认删除吗”,如果确认就去后台删除,点击取消不删除批量删除后展示所有
  6. 搜索  对姓名,大于电影起始时间,小于结束时间,  部门 实现 搜索,分页不丢失数据
  7. 编辑点击编辑跳转到修改界面,回显成功,  点击提交修改成功    

 二、设计技术点:

     基于SpringMVC + Spring + MyBatis + jQuery + JqueryEasyUI+ Mysql数据库完成查询、JQuery验证分页等功能。

三.实现的效果

大数据方向《JavaEE》项目案例【一定要收藏】

建表建库:

use   q1;

create   table   dept8(
 did  int primary key ,
  name  varchar(20)



)
drop   table  emp8
create   table   emp8  (
  eid  int primary key  auto_increment,
  name  varchar(20),
  esex  varchar(20),
  eage  int ,
  eimgurl varchar(255),
  ebirth  date,
  did  int,
  ehobby  varchar(20),
  shu  int,
  price int,
  zong  int,
  flag  int,
  foreign key (did)  references dept8 (did)

)

insert into dept8 (did, name)
values

       (1,'产品部'),
       (2,'客服部'),
       (3,'市场部');

insert into emp8 (eid, name, esex, eage, eimgurl, ebirth, did, ehobby, shu, price, zong,flag)
values
       (1,'张三','男',21,'','2020-10-10',1,'学习,看小说',20,2,null,1),
       (2,'李四','男',21,'','2000-10-10',2,'学习,看小说',10,2,null,0),
       (3,'王五','男',21,'','2010-10-10',3,'学习,运动',13,2,null,0),
       (4,'赵六','女',21,'','2020-10-10',2,'学习,看小说',20,2,null,1),
       (5,'周七','男',21,'','1980-10-10',1,'学习,看小说',60,2,null,0),
       (6,'周七','男',21,'','1980-10-10',1,'学习,看小说',60,2,null,1);

select  e.*, d.name dname from emp8 e,dept8 d where e.did=d.did ;

select* from emp8
select   e.*, d.name dname   from emp8 e,dept8 d where e.did=d.did  group by  d.did

 打开开发工具:

搭建ssm环境以及配置
 

大数据方向《JavaEE》项目案例【一定要收藏】

controller:代码:

package com.jiyun.ssm.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jiyun.ssm.pojo.De;
import com.jiyun.ssm.pojo.Em;
import com.jiyun.ssm.service.DeService;
import com.jiyun.ssm.service.EmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;

@Controller
public class servlet {
    @Autowired
    private DeService d;
    @Autowired
    private EmService b;
//展示所有
    @RequestMapping("/show")
    public String show(Model mo, @RequestParam(value = "pageNum",required =false,defaultValue = "1")Integer pageNum) {
        PageHelper.startPage (pageNum,2);
       int qian=0;
       int shu1=0;
        List<Em> list = b.show ();
        for (Em em : list) {
            qian=em.getShu ()*em.getPrice ()+qian;
            shu1=em.getShu ()+shu1;

        }
        mo.addAttribute ("qian",qian );
        mo.addAttribute ("shu1",shu1 );

        PageInfo<Em> p = new PageInfo<> (list);
        mo.addAttribute ("p", p);
        mo.addAttribute ("a1", "a1");
        return "show";


    }
    //修改的回显
    @RequestMapping("/xiu")
    public String xiu(Model mo,Em s,String eid) {
Em a = b.getid(eid);

        List<De> list = d.show ();
        mo.addAttribute ("list", list);
        mo.addAttribute ("a", a);
        return "up";


    }


//电影的状态
    @RequestMapping("/xiu2")
    public String xiu2(Model mo,Em s,String eid,String flag) {
      b.getid1(eid,flag);

        return "redirect:show";


    }
    //统计部门的个数
    @RequestMapping("/ji")
    public String ji(Model mo,Em s) {
        List<Em> list = b.coun();


        mo.addAttribute ("list", list);


        return "fan";


    }
//模糊查询
    @RequestMapping("/like")
    public String like(Model mo,String  name,String start,String end,String esex,Integer  did,@RequestParam(value ="pageNum",required = false,defaultValue = "1")Integer pageNum) {
        PageHelper.startPage (pageNum,2);
        List<Em> list = b.like(name,start,end,esex,did);
        PageInfo<Em> p = new PageInfo<> (list);
        List<De> list1 = d.show ();
        mo.addAttribute ("p", p);
        mo.addAttribute ("list1",list1);
        mo.addAttribute ("a2", "a2");
        return "show";
    }
    @RequestMapping("/like1")
    public String like1(Model mo,String  name,@RequestParam(value ="pageNum",required = false,defaultValue = "1")Integer pageNum) {
        PageHelper.startPage (pageNum,2);
        List<Em> list = b.like1(name);
        PageInfo<Em> p = new PageInfo<> (list);
        List<De> list1 = d.show ();
        mo.addAttribute ("p", p);
        mo.addAttribute ("list1",list1);
        mo.addAttribute ("a2", "a2");
        return "show";
    }
//部门下拉框
    @RequestMapping("/add")
    public String add(Model mo) {
        List<De> list = d.show ();
        mo.addAttribute ("list",list);
        return "add";


    }
    //ajax 验证
  @RequestMapping("/aj")
    @ResponseBody
    public String aj(String name) {

long  c=b.coiui(name);
if(c>0){
    return   "true";
}else {
    return  "false";
}

    }
//    多选删除
    @RequestMapping("/de")
    public String de(Model mo,String ids) {
        String[] id = ids.split (",");
b.shan(id);
        return "redirect:show";

    }
//    单选删除
    @RequestMapping("/shan1")
    public String shan1(Model mo,String eid) {
b.shan1(eid);
        return "redirect:show";

    }
//    添加图片
    @RequestMapping("/add1")
    public String add(Model mo, MultipartFile img, Em a, HttpServletRequest request) throws IOException {
        if (img.getSize () > 0) {
            String s = Arrays.toString (request.getParameterValues ("ehobby"));
            a.setEhobby (s);
            String filename = img.getOriginalFilename ();
            String realPath = request.getSession ().getServletContext ().getRealPath ("/");
            img.transferTo (new File (realPath, filename));
            a.setEimgurl (filename);
        }
        b.add (a);
        return "redirect:show";


    }
//    修改回显后的添加
    @RequestMapping("/set1")
    public String set1(Model mo, MultipartFile img, Em a, HttpServletRequest request) throws IOException {
        if (img.getSize () > 0) {

            String filename = img.getOriginalFilename ();
            String realPath = request.getSession ().getServletContext ().getRealPath ("/");
            img.transferTo (new File (realPath, filename));
            a.setEimgurl (filename);
        }
        b.set1 (a);
        return "redirect:show";


    }


}

servuce:

package com.jiyun.ssm.service;

import com.jiyun.ssm.pojo.Em;

import java.util.List;

public interface EmService {

    List<Em>  show();
    void   add (Em a);
    void   set1 (Em a);

    void shan(String[] id);

    List<Em> like(String name, String start, String end, String esex, Integer did);

    long coiui(String name);

    Em getid(String eid);

    void shan1(String eid);

    List<Em> coun();


    void getid1(String eid, String flag);


    List<Em> like1(String name);


}
package com.jiyun.ssm.service.Impl;

import com.jiyun.ssm.dao.EmDao;
import com.jiyun.ssm.pojo.Em;
import com.jiyun.ssm.service.EmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmServiceIMpl   implements EmService {
    @Autowired
    private EmDao b;
    @Override
    public List<Em> show() {
        return b.show ();
    }
    @Override
    public void add(Em a) {
b.add (a);
    }
    @Override
    public void set1(Em a) {
b.set1 (a);
    }
    @Override
    public void shan(String[] id) {

        for (String eid : id) {
            b.shan(eid);
        }
    }
    @Override
    public List<Em> like(String name, String start, String end, String esex, Integer did) {
        return b.like(name,start,end,esex,did);
    }
    @Override
    public long coiui(String name) {
        return b.oui(name);
    }
    @Override
    public Em getid(String eid) {
        return b.get(eid);
    }
    @Override
    public void shan1(String eid) {
        b.shan12(eid);
    }

    @Override
    public List<Em> coun() {
        return b.ouyc();
    }

    @Override
    public void getid1(String eid, String flag) {
        b.getid(eid,flag);
    }

    @Override
    public List<Em> like1(String name) {
        return b.like1(name);
    }
}

 dao层接口:

package com.jiyun.ssm.dao;

import com.jiyun.ssm.pojo.Em;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface EmDao {
    List<Em> show();
    void   add (Em a);
    void   set1 (Em a);
@Delete ("delete   from emp8   where eid=#{eid}")
    void shan(@Param ("eid") String eid);

    List<Em> like(@Param ("name") String name,@Param ("start") String start,@Param ("end") String end,   @Param ("esex")String esex, @Param ("did")Integer did);
@Select ("select   count(*) from  emp8  where name=#{name}")
    long oui(@Param ("name") String name);
@Select ("select *  from  emp8  where eid=#{eid} ")

    Em get(@Param ("eid") String eid);
    @Delete ("delete   from emp8   where eid=#{eid}")
    void shan12(@Param ("eid") String eid);
    @Select ("select d.name dname  ,count(e.eid) count1  from emp8 e,dept8 d where e.did=d.did  group by  d.did")
    List<Em> ouyc();
@Update (" update  emp8  set  flag=1    where eid=#{eid} ")
    void getid( @Param ("eid") String eid, @Param ("flag")String flag);

    List<Em> like1(@Param ("name") String name);


}

xml代码:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--表示这个mapper中可以写那个接口中方法的sql语句-->
<mapper namespace="com.jiyun.ssm.dao.EmDao">
    <!--id必须和接口中的某个方法名一样
    resultType id属性对应的方法的返回值
    -->

    <select id="show" resultType="Em" >
select e.*,d.name  dname from emp8 e,dept8 d where e.did=d.did
    </select>
    <select id="like1" resultType="Em" >
select e.*,d.name  dname from emp8 e,dept8 d where e.did=d.did   and e.name like '%${name}%'
    </select>
    <select id="like" resultType="Em" >
select e.*,d.name dname from emp8 e,dept8 d where e.did=d.did
<if test="name!=null  and name!=''">
    and e.name like '%${name}%'
</if>
        <if test="start!=null and start!=''">
            and   e.ebirth  &gt;=#{start}
        </if>
        <if test="end!=null and end!=''">
            and   e.ebirth  &lt;=#{end}
        </if>
        <if test="esex!=null  and esex!=''">
            and   e.esex   = '${esex}'
        </if>
        <if test="did!=null">
            and   d.did=#{did}
        </if>
    </select>
    <insert id="add" parameterType="Em">
insert into emp8 ( name, esex, eage, eimgurl, ebirth, did, ehobby, shu, price, zong ,flag)
values  (#{name},#{esex},#{eage},#{eimgurl},#{ebirth},#{did},#{ehobby},#{shu},#{price},#{zong},#{flag})
    </insert>

    <update id="set1" parameterType="Em">
  update emp8 set name=  #{name}, esex=#{esex}, eage=#{eage}, eimgurl=#{eimgurl}, ebirth=#{ebirth},
  did=#{did}, ehobby=#{ehobby}, shu=#{shu}, price=#{price}, zong=#{zong},flag=#{flag} where eid=#{eid}
    </update>

</mapper>

前端展示所有:

<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/9/18
  Time: 21:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <script src="/js/jquery-1.9.1.min.js"></script>
    <script>
        <%--多选删除--%>

        $(function () {

                    $(".e").click(function () {
                        if($(".q:checked").length<1){
                            alert("至少选中一条")
                        }else {
                            var  str="";
                            $(".q:checked").each(function () {
                                var id=$(this).val();
                                str+=id+","
                            })
                            if(confirm('是否删除?')){
                                location.href=("/de?ids"+str)

                            }


                }
            })
        })

    </script>
</head>

<h1  align="center" ><font color="aqua">综合案例</font></h1>
<body>

<hr  color="red">
<form  action="/like" method="post" placeholder="根据名字查询">
  姓名  <input type="text" name="name">
   电影开始时间:<input type="text" name="start"  placeholder="yyyy-MM-dd">
   电影结束时间<input type="text" name="end" placeholder="yyyy-MM-dd">

    <%--<input type="text"  name="esex">--%>
 性别   <select name="esex">
        <option  value="">-请选择--</option>
            <option value="男">男</option>
            <option value="女">女</option>

    </select>


    <select name="did">
        <option  value="">-请选择--</option>
        <c:forEach var="y" items="${list1}">
            <option value="${y.did}">${y.name}</option>
        </c:forEach>
    </select>



    <input type="submit" value="搜索">
</form>

<hr  color="red">

<form action="/like1"   method="post">

    <input type="text"  name="name"   placeholder="根据名字查询">
    <input type="submit"  value="搜索">

</form>

<hr  color="bule">
<input type="button"  value="删除" class="e">
<input type="button"  value="统计" onclick="e3()">
<input type="button"  value="增加" onclick="w2()">
总金额为:${qian}  总票数:${shu1}
<table cellpadding="0" border="1" width="800" height="300">

    <tr>
<td><input type="checkbox" onclick="fan(this)"></td>
        <td>编号</td>
        <td>姓名</td>
        <td>性别</td>
        <td>年龄</td>
        <td>头像</td>
        <td>生日</td>
        <td>部门</td>
        <td>爱好</td>
        <td>票数</td>
        <td>单价</td>
        <td>总价</td>
        <td>状态</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${p.list}" var="a">
        <tr>
            <td><input type="checkbox"    class="q"  value="${a.eid}"></td>
            <td>${a.eid}</td>
            <td>${a.name}</td>
            <td>${a.esex}</td>
            <td>${a.eage}</td>
            <td><img src="/${a.eimgurl}" alt="" width="50" height="50"></td>
            <td><fmt:formatDate value="${a.ebirth}" pattern="yyyy-MM-dd"/> </td>
            <td>${a.dname}</td>
            <td>${a.ehobby}</td>
            <td>${a.shu}</td>
            <td>${a.price}</td>
            <td>${a.shu*a.price}</td>
            <td>
                <c:if test="${a.flag==0}">
                    未上映
                </c:if>
                <c:if test="${a.flag==1}">
                    已上映
                </c:if>
            </td>
            <td>
                <c:if test="${a.flag==0}">
                    <a href="/xiu2?eid=${a.eid}&flag=1">已上映</a>
                </c:if>

                <a href="/xiu?eid=${a.eid}">修改</a>
           <a href="/shan1?eid=${a.eid}">删除</a></td>
        </tr>

    </c:forEach>


</table>

<%--查询所有--%>
<c:if test="${a1=='a1'}">
    <a href="/show?pageNum=${p.firstPage}">首页</a>
    <c:if test="${p.isFirstPage==false}">
        <a href="${pageContext.request.contextPath}/show?pageNum=${p.prePage}">上一页</a>
    </c:if>
    <c:forEach items="${p.navigatepageNums}" var="i">
        <c:choose>
            <c:when test="${p.pageNum==i}">
                <span style="color: red;">${i}</span>
            </c:when>
            <c:otherwise>
                <a href="${pageContext.request.contextPath}/show?pageNum=${i}">${i}</a>
            </c:otherwise>
        </c:choose>
    </c:forEach>
    <c:if test="${p.isLastPage==false}">
        <a href="${pageContext.request.contextPath}/show?pageNum=${p.nextPage}">下一页</a>
    </c:if>

    <a href="${pageContext.request.contextPath}/show?pageNum=${p.lastPage}">尾页</a>
    第${p.pageNum}页/共${p.lastPage}页 共${p.total}条
</c:if>
<%--模糊查询--%>
<c:if test="${a2=='a2'}">
<a href="/like?pageNum=${p.firstPage}">首页</a>
<c:if test="${p.isFirstPage==false}">
    <a href="${pageContext.request.contextPath}/like?pageNum=${p.prePage}">上一页</a>
</c:if>
<c:forEach items="${p.navigatepageNums}" var="i">
    <c:choose>
        <c:when test="${p.pageNum==i}">
            <span style="color: red;">${i}</span>
        </c:when>
        <c:otherwise>
            <a href="${pageContext.request.contextPath}/like?pageNum=${i}">${i}</a>
        </c:otherwise>
    </c:choose>
</c:forEach>
<c:if test="${p.isLastPage==false}">
    <a href="${pageContext.request.contextPath}/like?pageNum=${p.nextPage}">下一页</a>
</c:if>
<a href="${pageContext.request.contextPath}/like?pageNum=${p.lastPage}">尾页</a>
第${p.pageNum}页/共${p.lastPage}页 共${p.total}条
</c:if>


</body>


<script>
<%--统计--%>
    function e3() {
        location.href="/ji"
    }
    //全选全不选
    function fan(w) {
        $(".q").prop("checked",w.checked)

    }
    //增加
    function w2() {
    location.href="/add"
    }

</script>

</html>

add的添加:

<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/9/18
  Time: 22:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <script src="/js/jquery-1.9.1.min.js"></script>
    <script>

    </script>
</head>
<body>

<form action="/add1" method="post"  enctype="multipart/form-data" onsubmit="return go()">
   姓名 <input type="text" name="name"  class="e" onblur="w2()"><span class="t"></span> <br>
   性别 <input type="radio" name="esex" value="男"> 男
<input type="radio" name="esex" value="女">女 <br>
   年龄 <input type="text" name="eage"  class="h"  onblur="w10()" > <span class="z"></span><br>
   头像 <input type="file" name="img"> <br>
   生日 <input type="text" name="ebirth"> <br>
   部门
    <select name="did">
        <option>-请选择--</option>
        <c:forEach var="y" items="${list}">
            <option value="${y.did}">${y.name}</option>
        </c:forEach>
    </select> <br>



   爱好

    <input type="checkbox" name="ehobby"  value="学习"> 学习
    <input type="checkbox" name="ehobby"  value="看电影"> 看电影
    <input type="checkbox" name="ehobby"  value="运动"> 运动
    <input type="checkbox" name="ehobby"  value="看小说"> 看小说

    <br>
   票数 <input type="text" name="shu"  id="e5"> <br>
   单价 <input type="text" name="price" id="e6" onblur="w9()"> <br>
   总价 <input type="text" name="zong" id="e7"> <br>
    <input type="radio"  name="flag"  value="0"> 未上映
    <input type="radio"  name="flag"  value="1">  已上映 <br>
    <input type="submit" value="增加"> <br>
</form>


</body>


<script>
    var  f=false;

    function w10() {
        var d=$(".h").val();
        var rep=/^[0-9]*$/;
        if(rep.test(d)){
            $(".z").html("")
        }else {
            $(".z").html("必须为数字")
            $(".z").css("color","red");
            f=true
        }
    }
    function w2() {
        var n=$(".e").val();
        if(n==""|| n==null){
            $(".t").html("名字不能为空");
            $(".t").css("color","red");
            f=true;
        }else {
            $.post("aj",{"name":n},function (data) {
                if(data=="true"){
                    $(".t").html("名字不能重复");
                    $(".t").css("color","red");
                    f=true;
                }else {
                    $(".t").html("名字可用");
                    $(".t").css("color","red");
                    f=false;
                }
            },"text")


        }
    }
    function go() {
       if(f==true){
           return false;
       } else {
           return  true;
       }
    }

    function w9() {
        var e5=$("#e5").val();
        var e6=$("#e6").val();
        $("#e7").val(e5*e6);
    }

</script>

</html>

修改的回显

<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/9/18
  Time: 22:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <script src="/js/jquery-1.9.1.min.js"></script>
    <script>

    </script>
</head>
<body>

<form action="/set1" method="post"  enctype="multipart/form-data" onsubmit="return go()">

    <input type="hidden"  name="eid" value="${a.eid}">
   姓名 <input type="text" name="name"   value="${a.name}" class="e" onblur="w2()"><span class="t"></span> <br>
    性别 <input type="radio" name="esex" value="男" <c:if test="${a.esex=='男'}">checked</c:if>> 男
<input type="radio" name="esex" value="女" <c:if test="${a.esex=='女'}">checked</c:if>>女 <br>
   年龄 <input type="text" name="eage"  value="${a.eage}" class="h"  onblur="w10()" > <span class="z"></span><br>
   头像 <input type="hidden" name="eimgurl" value="${a.eimgurl}"> <br>
    <img src="/${a.eimgurl}" alt="" width="50" height="50"> <br>
   头像 <input type="file" name="img" > <br>
   生日 <input type="text" name="ebirth" value="<fmt:formatDate value='${a.ebirth}' pattern='yyyy-MM-dd'/> "> <br>
   部门
    <select name="did">
        <option>-请选择--</option>
        <c:forEach var="y" items="${list}">
            <option value="${y.did}"<c:if test="${a.did==y.did}">selected</c:if>>${y.name}</option>
        </c:forEach>
    </select> <br>



   爱好

    <input type="checkbox" name="ehobby"  value="学习"
    <c:if test="${fn:contains(a.ehobby, '学习')}">checked</c:if>
    > 学习
    <input type="checkbox" name="ehobby"  value="看电影"
           <c:if test="${fn:contains(a.ehobby, '看电影')}">checked</c:if>
    > 看电影
    <input type="checkbox" name="ehobby"  value="运动"
           <c:if test="${fn:contains(a.ehobby, '运动')}">checked</c:if>
    > 运动
    <input type="checkbox" name="ehobby"  value="看小说"
           <c:if test="${fn:contains(a.ehobby, '看小说')}">checked</c:if>
    > 看小说

    <br>
   票数 <input type="text" name="shu"  id="e5"  value="${a.shu}"> <br>
   单价 <input type="text" name="price" id="e6"  value="${a.price}" onblur="w9()"> <br>
   总价 <input type="text" name="zong" id="e7" value="${a.zong}"> <br>
    <input type="radio"  name="flag"  value="0" <c:if test="${a.flag==0}">checked</c:if>> 未上映
    <input type="radio"  name="flag"  value="1"<c:if test="${a.flag==1}">checked</c:if>>  已上映  <br>
    <input type="submit" value="增加"> <br>



</form>


</body>


<script>
    var  f=false;

    function w10() {
        var d=$(".h").val();
        var rep=/^[0-9]*$/;
        if(rep.test(d)){
            $(".z").html("")
        }else {
            $(".z").html("必须为数字")
            $(".z").css("color","red");
            f=true
        }
    }
    function w2() {
        var n=$(".e").val();
        if(n==""|| n==null){
            $(".t").html("名字不能为空");
            $(".t").css("color","red");
            f=true;
        }else {
            $.post("aj",{"name":n},function (data) {
                if(data=="true"){
                    $(".t").html("名字不能重复");
                    $(".t").css("color","red");
                    f=true;
                }else {
                    $(".t").html("名字可用");
                    $(".t").css("color","red");
                    f=false;
                }
            },"text")


        }
    }
    function go() {
       if(f==true){
           return false;
       } else {
           return  true;
       }
    }

    function w9() {
        var e5=$("#e5").val();
        var e6=$("#e6").val();
        $("#e7").val(e5*e6);
    }

</script>

</html>

统计:

<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/9/19
  Time: 0:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <script>

    </script>
</head>
<body>

<table cellpadding="0" border="1" width="600" height="300">

    <tr>
        <td>部门</td>
        <td>个数</td>
    </tr>
    <c:forEach items="${list}" var="a">
        <tr>
            <td>${a.dname}</td>
            <td>${a.count1}</td>
        </tr>

    </c:forEach>


</table>

</body>


<script>

</script>

</html>

增加效果:

大数据方向《JavaEE》项目案例【一定要收藏】

修改回显 

大数据方向《JavaEE》项目案例【一定要收藏】

如果我的博客对你有帮助,也是你所喜欢的内容,请“点赞”   “评论”  “收藏”   一键三连,就是对我最大的支持!

上一篇:怎么用PS给侦探柯南穿上红绿花棉袄?


下一篇:PS调处漂亮梦幻的水下照片效果