• JavaWeb——库存管理系统(1)jsp部分---18.12.13


    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;
       160px;
      color: white;
      
     }
    </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="place" name="place" />
       </div>
       <div class="a">
        生产规格<input type="text" id="guige" name="guige" />
       </div>
       <div class="a">
        生产型号<input type="text" id="number" name="number" />
       </div>
       <div class="a">
        <button type="submit" class="b">保&nbsp;&nbsp;&nbsp;存</button>
       </div>
      </form>
     </div>
     <script type="text/javascript">
      function check() {
       var name = document.getElementById("name");;
       var place = document.getElementById("place");
       var guige = document.getElementById("guige");
       var number = document.getElementById("number");
       
       //非空
       if(name.value == '111')
       {
        alert('填写错误');
        name.focus();
        return false;
       }
       
       if(place.value == '')
       {
        alert('生产厂家为空');
        place.focus();
        return false;
       }
       
       if(guige.value == '')
       {
        alert('生产规格为空');
        guige.focus();
        return false;
       }
       
       if(number.value == '')
       {
        alert('生产型号为空');
        guige.focus();
        return false;
       }
    }
      
     </script>
    </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;
       160px;
      color: white;
      
     }
    </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">查&nbsp;&nbsp;&nbsp;找</button>
       </div>
      </form>
     </div>
     <script type="text/javascript">
      function check()
      {
       var name = document.getElementById("name");
       
       //非空
       if(name.value == '')
       {
        alert('物资名称为空');
        name.focus();
        return false;
       }
      }
     </script>
    </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;
       160px;
      color: white;
      
     }
     .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.place}</td>
       </tr>
       <tr>
        <td>生产规格</td>
        <td>${course.guige}</td>
       </tr>
       <tr>
        <td>生产型号</td>
        <td>${course.number}</td>
       </tr>
      </table>
      <div class="a">
       <a onclick="return check()" href="CourseServlet?method=del&id=${course.id}">删&nbsp;&nbsp;&nbsp;除</a>
      </div>
     </div>
     <script type="text/javascript">
      function check() {
       if (confirm("真的要删除吗?"))
       {
        return true;
       }
       else
       {
        return false;
       }
      }
     </script>
    </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;
       160px;
      color: white;
      
     }
    </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="place" name="place" value="${course.place}"/>
       </div>
       <div class="a">
        生产规格<input type="text" id="guige" name="guige" value="${course.guige}"/>
       </div>
       <div class="a">
        生产型号<input type="text" id="number" name="number" value="${course.number}"/>
       </div>
       <input type="hidden" id="id" name="id" value="${course.id}"/>
       <div class="a">
        <button type="submit" class="b">修&nbsp;&nbsp;&nbsp;改</button>
       </div>
      </form>
     </div>
     <script type="text/javascript">
      function check()
      {
       var name = document.getElementById("name");;
       var place = document.getElementById("place");
       var guige = document.getElementById("guige");
       var number = document.getElementById("number");
       
       //非空
       if(name.value == '')
       {
        alert('物资名称为空');
        name.focus();
        return false;
       }
       
       if(place.value == '')
       {
        alert('生产厂家为空');
        place.focus();
        return false;
       }
       
       if(guige.value == '')
       {
        alert('生产规格为空');
        guige.focus();
        return false;
       }
       
       if(number.value == '')
       {
        alert('生产型号为空');
        guige.focus();
        return false;
       }
       
      }
     </script>
    </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;
       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.place}</td>
         <td>${item.guige}</td>
         <td>${item.number}</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;
       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="place" name="place" />
       </div>
       <div class="a">
        生产规格<input type="text" id="guige" name="guige" />
       </div>
       <div class="a">
        生产型号<input type="text" id="number" name="number" />
       </div>
       <div class="a">
        <button type="submit" class="b">查&nbsp;&nbsp;&nbsp;询</button>
       </div>
      </form>
     </div>
     <script type="text/javascript">
      function check()
      {
       var name = document.getElementById("name");;
       var place = document.getElementById("place");
       var guige = document.getElementById("guige");
       var number = document.getElementById("number");
       
       //非空
       if(name.value == '' && place.value == '' && guige.value == ''&& number.value == '')
       {
        alert('请填写一个条件');
        return false;
       }
      }
     </script>
    </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;
       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>${item.id}</td>
         <td><a>${item.name}</a></td>
         <td>${item.place}</td>
         <td>${item.guige}</td>
         <td>${item.number}</td>
        </tr>
       </c:forEach>
      </table>
     </div>
    </body>
    </html>
     
    OK,这里的这些是jsp的东西,就是一个增删改查~
  • 相关阅读:
    [转载]如何让企业网站发挥出应用的功能?
    [转载]创业流程
    velocity foreach跳出循环
    【转】cgi技术
    webx3 日志系统级别问题
    ibatis主键自增用法
    【转】java内部类总结
    java初始化顺序
    一点一点学习Ubuntu
    jboss 的端口修改
  • 原文地址:https://www.cnblogs.com/mitang0-0/p/10308289.html
Copyright © 2020-2023  润新知