欢迎来到Jsp编程课时十二——今天实现的目标是。@1将数据库的数据发送到浏览器。@2利用浏览器实现对数据库的增删改查操作。@3理解MVC三层架构的定义。(三)

简介: 欢迎来到Jsp编程课时十二——今天实现的目标是。@1将数据库的数据发送到浏览器。@2利用浏览器实现对数据库的增删改查操作。@3理解MVC三层架构的定义。(三)

后端代码第三部分

package com.student.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.student.service.IStudentService;
import com.student.service.StudentServiceImp;
/**
 * Servlet implementation class AddStudentServlect
 */
@WebServlet("/AddStudentServlect")
public class AddStudentServlect extends HttpServlet {
  private static final long serialVersionUID = 1L;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AddStudentServlect() {
        super();
        // TODO Auto-generated constructor stub
    }
  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    response.getWriter().append("Served at: ").append(request.getContextPath());
  }
  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String name=request.getParameter("name");
    String age=request.getParameter("age");
    IStudentService service =new StudentServiceImp();
    int i=service.add(name,Integer.parseInt(age));
    if(i>0) {
      System.out.println("增加成功");
      response.sendRedirect("HomeServlet");
    }
  }
}
package com.student.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.student.service.IStudentService;
import com.student.service.StudentServiceImp;
/**
 * Servlet implementation class DeleteStudent
 */
@WebServlet("/DeleteStudent")
public class DeleteStudent extends HttpServlet {
  private static final long serialVersionUID = 1L;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DeleteStudent() {
        super();
        // TODO Auto-generated constructor stub
    }
  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
      String id=request.getParameter("id");
      IStudentService service =new StudentServiceImp();
    int i=  service.delete(Integer.parseInt(id));
    if(i>0) {
      response.sendRedirect("HomeServlet");
    }
  }
  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  }
}
package com.student.controller;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.student.service.IStudentService;
import com.student.service.StudentServiceImp;
/**
 * Servlet implementation class HomeServlet
 */
@WebServlet("/HomeServlet")
public class HomeServlet extends HttpServlet {
  private static final long serialVersionUID = 1L;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public HomeServlet() {
        super();
        // TODO Auto-generated constructor stub
    }
  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    //将浏览器的任务接收,发给业务逻辑层处理
    IStudentService service=new StudentServiceImp();
    List<Map<String, Object>> oList=service.getStudents();
    //
    HttpSession session =request.getSession();
    //将从数据库中查询出来的数据存储至request
    session.setAttribute("students", oList);
    //请求转发跳转页面
    request.getRequestDispatcher("index.jsp").forward(request, response); 
  }
  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    doGet(request, response);
  }
}
package com.student.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.student.service.IStudentService;
import com.student.service.StudentServiceImp;
/**
 * Servlet implementation class UpdateStudentServlet
 */
@WebServlet("/UpdateStudentServlet")
public class UpdateStudentServlet extends HttpServlet {
  private static final long serialVersionUID = 1L;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public UpdateStudentServlet() {
        super();
        // TODO Auto-generated constructor stub
    }
  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    response.getWriter().append("Served at: ").append(request.getContextPath());
  }
  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String id=request.getParameter("id");
    String name=request.getParameter("name");
    String age=request.getParameter("age");
    IStudentService service=new StudentServiceImp();
    int i=service.update(Integer.parseInt(id), name, Integer.parseInt(age));
    if (i>0) {
      //修改成功
      response.sendRedirect("HomeServlet");
    }
  }
}
package com.student.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.student.service.IStudentService;
import com.student.service.StudentServiceImp;
/**
 * Servlet implementation class UpdateStudentServlet
 */
@WebServlet("/UpdateStudentServlet")
public class UpdateStudentServlet extends HttpServlet {
  private static final long serialVersionUID = 1L;
    /**
     * @see HttpServlet#HttpServlet()
     */
    public UpdateStudentServlet() {
        super();
        // TODO Auto-generated constructor stub
    }
  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    response.getWriter().append("Served at: ").append(request.getContextPath());
  }
  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String id=request.getParameter("id");
    String name=request.getParameter("name");
    String age=request.getParameter("age");
    IStudentService service=new StudentServiceImp();
    int i=service.update(Integer.parseInt(id), name, Integer.parseInt(age));
    if (i>0) {
      //修改成功
      response.sendRedirect("HomeServlet");
    }
  }
}


package com.student.dao;
/**
 * 数据访问层操作学生表的接口
 * @author admin
 *
 */
import java.util.List;
import java.util.Map;
public interface IStudentDao {
  //接收业务逻辑层的任务,查询出所有学生信息
  List<Map<String, Object>> getStudents();
  //接收信息
  int add(String name,int age);
  //Dao修改操作
  int update(int id,String name,int age);
  //删除
  int delete(int id);
}
package com.student.dao;
/**
 * 数据访问层操作学生表的接口
 * @author admin
 *
 */
import java.util.List;
import java.util.Map;
public interface IStudentDao {
  //接收业务逻辑层的任务,查询出所有学生信息
  List<Map<String, Object>> getStudents();
  //接收信息
  int add(String name,int age);
  //Dao修改操作
  int update(int id,String name,int age);
  //删除
  int delete(int id);
}
package com.student.dao;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import com.student.utils.DBUtil;
/**
 * 数据访问操作学生表的实现类
 * @author admin
 *
 */
public class StudentDaoImp implements IStudentDao {
  @Override
  public List<Map<String, Object>> getStudents() {
    String sql="select * from tb_student2";
    return DBUtil.jt.queryForList(sql);
  }
  @Override
  public int add(String name, int age) {
    // TODO Auto-generated method stub
    String sql="insert into tb_student2(name,age) values (?,?)";
    return DBUtil.jt.update(sql,name,age);
  }
  //修改
  @Override
  public int update(int id, String name, int age) {
    String sql="update tb_student2 set name=?,age=? where id=?";
    return DBUtil.jt.update(sql,name,age,id);
  }
  @Override
  public int delete(int id) {
    // TODO Auto-generated method stub
    String sql="delete from tb_student2 where id=?";
    return DBUtil.jt.update(sql,id);
  }
  }
package com.student.dao;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import com.student.utils.DBUtil;
/**
 * 数据访问操作学生表的实现类
 * @author admin
 *
 */
public class StudentDaoImp implements IStudentDao {
  @Override
  public List<Map<String, Object>> getStudents() {
    String sql="select * from tb_student2";
    return DBUtil.jt.queryForList(sql);
  }
  @Override
  public int add(String name, int age) {
    // TODO Auto-generated method stub
    String sql="insert into tb_student2(name,age) values (?,?)";
    return DBUtil.jt.update(sql,name,age);
  }
  //修改
  @Override
  public int update(int id, String name, int age) {
    String sql="update tb_student2 set name=?,age=? where id=?";
    return DBUtil.jt.update(sql,name,age,id);
  }
  @Override
  public int delete(int id) {
    // TODO Auto-generated method stub
    String sql="delete from tb_student2 where id=?";
    return DBUtil.jt.update(sql,id);
  }
  }
package com.student.utils;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import com.alibaba.druid.pool.DruidDataSourceFactory;
/**
 * 连接数据库的工具类
 * @author admin
 *
 */
public class DBUtil {
  public static JdbcTemplate jt=null;
  //获得druid配置的数据库连接池
  static {
    //使用反射机制获得druid配置文件转换成输入流
    InputStream is= DBUtil.class.getClassLoader()
      .getResourceAsStream("com/student/utils/druid.properties");
    Properties properties=new Properties();
    try {
      //将输入流导入properties对象
      properties.load(is);
      //获得数据库连接池
      DataSource ds=DruidDataSourceFactory.createDataSource(properties);
      jt=new JdbcTemplate(ds);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
package com.util;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.entity.Book;
/**
 * 放图书的内容工具类
 * @author MZFAITHDREAM
 *2021/10/19
 */
public class BooksDBUtil {
  public static List<Book> getBooks(){
    Book book1 =new Book("java程序设计","自由", "39元","人民日报","");
    Book book2 =new Book("java网站设计","马玉", "89元","清华","");
    Book book3 =new Book("javascript程序设计","不变", "239元","人民日报","");
    Book book4 =new Book("jquery程序设计","胡毅", "189元","江西出版社","");
    Book book5=new Book("mysql程序设计","ok", "179元","北大","");
    Book book6 =new Book("Sping框架设计","胡三", "129元","人民日报","");
    Book book7 =new Book("java高级编程","呼万岁", "159元","河南出版社","");
    Book book8=new Book("ps设计","ok", "239元","西安出版社","");
    Book book9 =new Book("Sping框架设计","胡三", "129元","人民日报","");
    Book book10=new Book("Java程序设计", "马云", "78.0元", "人民邮电出版社", "");
    Book book11=new Book("Jsp网络编程", "马化腾", "118.0元", "清华大学出版社", "");
    Book book12=new Book("Python爬虫技术", "李彦宏", "65.0元", "电子工业出版社", "");
    Book book13=new Book("网页程序设计", "任正非", "38.0元", "江西出版社", "");
    Book book14=new Book("MySQL程序教程", "雷军", "59.0元", "吉林出版社", "");
    Book book15=new Book("Spring框架技术", "马小云", "46.0元", "人民邮电出版社", "");
    List <Book> oBooks=new ArrayList<Book>();
    oBooks.add(book1);
    oBooks.add(book2);
    oBooks.add(book3);
    oBooks.add(book4);
    oBooks.add(book5);
    oBooks.add(book6);
    oBooks.add(book7);
    oBooks.add(book8);
    oBooks.add(book9);
    oBooks.add(book10);
    oBooks.add(book11);
    oBooks.add(book12);
    oBooks.add(book13);
    oBooks.add(book14);
    oBooks.add(book15);
    return oBooks;
  }
  public static String getNowTime() {
    Date date=new Date();
    //2021年10月19日
    SimpleDateFormat sdf=new SimpleDateFormat ("YYYY年MM月DD日HH:mm:ss");
    //要求当前时间进行格式化
    String time=sdf.format(date);
    return time;
  }
}
package com.util;
import java.sql.Connection;
public class Time {
  public static int time=60*60*60;
  static Connection time() {
    while (time>0) {
      time--;
      try {
        Thread.sleep(1000);
        int hh=time/1/1%1;
        int mm=time/60%1;
        int ss=time%6;
        if(hh==0 &&mm==0 && ss==0) {
          break;
        }
        System.out.println("0小时"+hh+"Сʱ"+mm+"分钟"+ss+"秒");
      } catch (InterruptedException e) {
        // TODO: handle exception
    }finally {
      System.out.println("正在跳转页面哦 ServlectB");
      System.out.println(".......真在跳转页面 ");
    }
    }
    return null;
  }
  public static void main(String[] args) {
    // TODO Auto-generated method stub
    time();
  }
}
<?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" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>MVCImport</display-name>
  <welcome-file-list>
    <welcome-file>ZhuCe.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>ServlectOne</servlet-name>
    <servlet-class>com.Servlect.ServlectOne</servlet-class>
    <init-param>
      <param-name>SFZ</param-name>
      <param-value>360429100056781234</param-value>
    </init-param>
  </servlet>
  <context-param>
    <param-name>LQ</param-name>
    <param-value>篮球</param-value>
  </context-param>
  <servlet-mapping>
    <servlet-name>ServlectOne</servlet-name>
    <url-pattern>/ServlectOne</url-pattern>
  </servlet-mapping>
  <filter>
    <filter-name>MyFilter4</filter-name>
    <filter-class>com.Filter.MyFilter4</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>MyFilter4</filter-name>
    <url-pattern>/Servlect1</url-pattern>
  </filter-mapping>
  <listener>
    <listener-class>com.Listener.Listener</listener-class>
  </listener>
  <context-param>
    <param-name>USER</param-name>
    <param-value>ABC</param-value>
  </context-param>
  <context-param>
    <param-name>QQ</param-name>
    <param-value>123456</param-value>
  </context-param>
  <context-param>
    <param-name>PSD</param-name>
    <param-value>123456</param-value>
  </context-param>
  <context-param>
    <param-name>SJ</param-name>
    <param-value>18172928419</param-value>
  </context-param>
  <context-param>
    <param-name>HOME</param-name>
    <param-value>江西省</param-value>
  </context-param>
  <jsp-config>
    <taglib>
      <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
      <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
  </jsp-config>
</web-app>
<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
    version="2.0">
  <description>JSTL 1.1 core library</description>
  <display-name>JSTL core</display-name>
  <tlib-version>1.1</tlib-version>
  <short-name>c</short-name>
  <uri>http://java.sun.com/jsp/jstl/core</uri>
  <validator>
    <description>
        Provides core validation features for JSTL tags.
    </description>
    <validator-class>
        org.apache.taglibs.standard.tlv.JstlCoreTLV
    </validator-class>
  </validator>
  <tag>
    <description>
        Catches any Throwable that occurs in its body and optionally
        exposes it.
    </description>
    <name>catch</name>
    <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
Name of the exported scoped variable for the
exception thrown from a nested action. The type of the
scoped variable is the type of the exception thrown.
        </description>
        <name>var</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
  Simple conditional tag that establishes a context for
  mutually exclusive conditional operations, marked by
  &lt;when&gt; and &lt;otherwise&gt;
    </description>
    <name>choose</name>
    <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
    <body-content>JSP</body-content>
  </tag>
  <tag>
    <description>
  Simple conditional tag, which evalutes its body if the
  supplied condition is true and optionally exposes a Boolean
  scripting variable representing the evaluation of this condition
    </description>
    <name>if</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
The test condition that determines whether or
not the body content should be processed.
        </description>
        <name>test</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
  <type>boolean</type>
    </attribute>
    <attribute>
        <description>
Name of the exported scoped variable for the
resulting value of the test condition. The type
of the scoped variable is Boolean.        
        </description>
        <name>var</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Scope for var.
        </description>
        <name>scope</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
        Retrieves an absolute or relative URL and exposes its contents
        to either the page, a String in 'var', or a Reader in 'varReader'.
    </description>
    <name>import</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
    <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
The URL of the resource to import.
        </description>
        <name>url</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is String.
        </description>
        <name>var</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Scope for var.
        </description>
        <name>scope</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Name of the exported scoped variable for the
resource's content. The type of the scoped
variable is Reader.
        </description>
        <name>varReader</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Name of the context when accessing a relative
URL resource that belongs to a foreign
context.
        </description>
        <name>context</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Character encoding of the content at the input
resource.
        </description>
        <name>charEncoding</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
  The basic iteration tag, accepting many different
        collection types and supporting subsetting and other
        functionality
    </description>
    <name>forEach</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
    <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
Collection of items to iterate over.
        </description>
  <name>items</name>
  <required>false</required>
  <rtexprvalue>true</rtexprvalue>
  <type>java.lang.Object</type>
    </attribute>
    <attribute>
        <description>
If items specified:
Iteration begins at the item located at the
specified index. First item of the collection has
index 0.
If items not specified:
Iteration begins with index set at the value
specified.
        </description>
  <name>begin</name>
  <required>false</required>
  <rtexprvalue>true</rtexprvalue>
  <type>int</type>
    </attribute>
    <attribute>
        <description>
If items specified:
Iteration ends at the item located at the
specified index (inclusive).
If items not specified:
Iteration ends when index reaches the value
specified.
        </description>
  <name>end</name>
  <required>false</required>
  <rtexprvalue>true</rtexprvalue>
  <type>int</type>
    </attribute>
    <attribute>
        <description>
Iteration will only process every step items of
the collection, starting with the first one.
        </description>
  <name>step</name>
  <required>false</required>
  <rtexprvalue>true</rtexprvalue>
  <type>int</type>
    </attribute>
    <attribute>
        <description>
Name of the exported scoped variable for the
current item of the iteration. This scoped
variable has nested visibility. Its type depends
on the object of the underlying collection.
        </description>
  <name>var</name>
  <required>false</required>
  <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Name of the exported scoped variable for the
status of the iteration. Object exported is of type
javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
visibility.
        </description>
  <name>varStatus</name>
  <required>false</required>
  <rtexprvalue>false</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
  Iterates over tokens, separated by the supplied delimeters
    </description>
    <name>forTokens</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
String of tokens to iterate over.
        </description>
  <name>items</name>
  <required>true</required>
  <rtexprvalue>true</rtexprvalue>
  <type>java.lang.String</type>
    </attribute>
    <attribute>
        <description>
The set of delimiters (the characters that
separate the tokens in the string).
        </description>
  <name>delims</name>
  <required>true</required>
  <rtexprvalue>true</rtexprvalue>
  <type>java.lang.String</type>
    </attribute>
    <attribute>
        <description>
Iteration begins at the token located at the
specified index. First token has index 0.
        </description>
  <name>begin</name>
  <required>false</required>
  <rtexprvalue>true</rtexprvalue>
  <type>int</type>
    </attribute>
    <attribute>
        <description>
Iteration ends at the token located at the
specified index (inclusive).
        </description>
  <name>end</name>
  <required>false</required>
  <rtexprvalue>true</rtexprvalue>
  <type>int</type>
    </attribute>
    <attribute>
        <description>
Iteration will only process every step tokens
of the string, starting with the first one.
        </description>
  <name>step</name>
  <required>false</required>
  <rtexprvalue>true</rtexprvalue>
  <type>int</type>
    </attribute>
    <attribute>
        <description>
Name of the exported scoped variable for the
current item of the iteration. This scoped
variable has nested visibility.
        </description>
  <name>var</name>
  <required>false</required>
  <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Name of the exported scoped variable for the
status of the iteration. Object exported is of
type
javax.servlet.jsp.jstl.core.LoopTag
Status. This scoped variable has nested
visibility.
        </description>
  <name>varStatus</name>
  <required>false</required>
  <rtexprvalue>false</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
        Like &lt;%= ... &gt;, but for expressions.
    </description> 
    <name>out</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
Expression to be evaluated.
        </description>
        <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Default value if the resulting value is null.
        </description>
        <name>default</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Determines whether characters &lt;,&gt;,&amp;,'," in the
resulting string should be converted to their
corresponding character entity codes. Default value is
true.
        </description>
        <name>escapeXml</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
        Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
        and runs only if all of the prior conditions evaluated to
        'false'
    </description>
    <name>otherwise</name>
    <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
    <body-content>JSP</body-content>
  </tag>
  <tag>
    <description>
        Adds a parameter to a containing 'import' tag's URL.
    </description>
    <name>param</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
Name of the query string parameter.
        </description>
        <name>name</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Value of the parameter.
        </description>
        <name>value</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
        Redirects to a new URL.
    </description>
    <name>redirect</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
The URL of the resource to redirect to.
        </description>
        <name>url</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Name of the context when redirecting to a relative URL
resource that belongs to a foreign context.
        </description>
        <name>context</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
        Removes a scoped variable (from a particular scope, if specified).
    </description>
    <name>remove</name>
    <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
    <body-content>empty</body-content>
    <attribute>
        <description>
Name of the scoped variable to be removed.
        </description>
        <name>var</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Scope for var.
        </description>
        <name>scope</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
  </tag>
 <tag>
    <description>
        Sets the result of an expression evaluation in a 'scope'
    </description>
    <name>set</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
Name of the exported scoped variable to hold the value
specified in the action. The type of the scoped variable is
whatever type the value expression evaluates to.
        </description>
        <name>var</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Expression to be evaluated.
        </description>
        <name>value</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Target object whose property will be set. Must evaluate to
a JavaBeans object with setter property property, or to a
java.util.Map object.
        </description>
        <name>target</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Name of the property to be set in the target object.
        </description>
        <name>property</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Scope for var.
        </description>
        <name>scope</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
        Creates a URL with optional query parameters.
    </description>
    <name>url</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
Name of the exported scoped variable for the
processed url. The type of the scoped variable is
String.
        </description>
        <name>var</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Scope for var.
        </description>
        <name>scope</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
        <description>
URL to be processed.
        </description>
        <name>value</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <description>
Name of the context when specifying a relative URL
resource that belongs to a foreign context.
        </description>
        <name>context</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
  </tag>
  <tag>
    <description>
  Subtag of &lt;choose&gt; that includes its body if its
  condition evalutes to 'true'
    </description>
    <name>when</name>
    <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <description>
The test condition that determines whether or not the
body content should be processed.
        </description>
        <name>test</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
  <type>boolean</type>
    </attribute>
  </tag>
</taglib>

最完整的小项目完成了对数据的增删改查·。

相关文章
|
2月前
|
NoSQL 关系型数据库 MySQL
微服务架构下的数据库选择:MySQL、PostgreSQL 还是 NoSQL?
在微服务架构中,数据库的选择至关重要。不同类型的数据库适用于不同的需求和场景。在本文章中,我们将深入探讨传统的关系型数据库(如 MySQL 和 PostgreSQL)与现代 NoSQL 数据库的优劣势,并分析在微服务架构下的最佳实践。
|
2月前
|
消息中间件 缓存 监控
优化微服务架构中的数据库访问:策略与最佳实践
在微服务架构中,数据库访问的效率直接影响到系统的性能和可扩展性。本文探讨了优化微服务架构中数据库访问的策略与最佳实践,包括数据分片、缓存策略、异步处理和服务间通信优化。通过具体的技术方案和实例分析,提供了一系列实用的建议,以帮助开发团队提升微服务系统的响应速度和稳定性。
|
4天前
|
存储 SQL Apache
Apache Doris 开源最顶级基于MPP架构的高性能实时分析数据库
Apache Doris 是一个基于 MPP 架构的高性能实时分析数据库,以其极高的速度和易用性著称。它支持高并发点查询和复杂分析场景,适用于报表分析、即席查询、数据仓库和数据湖查询加速等。最新发布的 2.0.2 版本在性能、稳定性和多租户支持方面有显著提升。社区活跃,已广泛应用于电商、广告、用户行为分析等领域。
Apache Doris 开源最顶级基于MPP架构的高性能实时分析数据库
|
5天前
|
缓存 关系型数据库 MySQL
高并发架构系列:数据库主从同步的 3 种方案
本文详解高并发场景下数据库主从同步的三种解决方案:数据主从同步、数据库半同步复制、数据库中间件同步和缓存记录写key同步,旨在帮助解决数据一致性问题。关注【mikechen的互联网架构】,10年+BAT架构经验倾囊相授。
高并发架构系列:数据库主从同步的 3 种方案
|
23天前
|
Web App开发 SQL 数据库
使用 Python 解析火狐浏览器的 SQLite3 数据库
本文介绍如何使用 Python 解析火狐浏览器的 SQLite3 数据库,包括书签、历史记录和下载记录等。通过安装 Python 和 SQLite3,定位火狐数据库文件路径,编写 Python 脚本连接数据库并执行 SQL 查询,最终输出最近访问的网站历史记录。
|
2月前
|
Java 关系型数据库 MySQL
毕设项目&课程设计&毕设项目:springboot+jsp实现的房屋租租赁系统(含教程&源码&数据库数据)
本文介绍了一款基于Spring Boot和JSP技术的房屋租赁系统,旨在通过自动化和信息化手段提升房屋管理效率,优化租户体验。系统采用JDK 1.8、Maven 3.6、MySQL 8.0、JSP、Layui和Spring Boot 2.0等技术栈,实现了高效的房源管理和便捷的租户服务。通过该系统,房东可以轻松管理房源,租户可以快速找到合适的住所,双方都能享受数字化带来的便利。未来,系统将持续优化升级,提供更多完善的服务。
毕设项目&课程设计&毕设项目:springboot+jsp实现的房屋租租赁系统(含教程&源码&数据库数据)
|
14天前
|
NoSQL 前端开发 MongoDB
前端的全栈之路Meteor篇(三):运行在浏览器端的NoSQL数据库副本-MiniMongo介绍及其前后端数据实时同步示例
MiniMongo 是 Meteor 框架中的客户端数据库组件,模拟了 MongoDB 的核心功能,允许前端开发者使用类似 MongoDB 的 API 进行数据操作。通过 Meteor 的数据同步机制,MiniMongo 与服务器端的 MongoDB 实现实时数据同步,确保数据一致性,支持发布/订阅模型和响应式数据源,适用于实时聊天、项目管理和协作工具等应用场景。
|
27天前
|
前端开发 Java 数据库
springBoot:template engine&自定义一个mvc&后端给前端传数据&增删改查 (三)
本文介绍了如何自定义一个 MVC 框架,包括后端向前端传递数据、前后端代理配置、实现增删改查功能以及分页查询。详细展示了代码示例,从配置文件到控制器、服务层和数据访问层的实现,帮助开发者快速理解和应用。
|
2月前
|
消息中间件 缓存 监控
优化微服务架构中的数据库访问:策略与实践
随着微服务架构的普及,如何高效管理和优化数据库访问成为了关键挑战。本文探讨了在微服务环境中优化数据库访问的策略,包括数据库分片、缓存机制、异步处理等技术手段。通过深入分析实际案例和最佳实践,本文旨在为开发者提供实际可行的解决方案,以提升系统性能和可扩展性。
|
3月前
|
安全 Java 关系型数据库
毕设项目&课程设计&毕设项目:基于springboot+jsp实现的健身房管理系统(含教程&源码&数据库数据)
本文介绍了一款基于Spring Boot和JSP技术实现的健身房管理系统。随着健康生活观念的普及,健身房成为日常锻炼的重要场所,高效管理会员信息、课程安排等变得尤为重要。该系统旨在通过简洁的操作界面帮助管理者轻松处理日常运营挑战。技术栈包括:JDK 1.8、Maven 3.6、MySQL 8.0、JSP、Shiro、Spring Boot 2.0等。系统功能覆盖登录、会员管理(如会员列表、充值管理)、教练管理、课程管理、器材管理、物品遗失管理、商品管理及信息统计等多方面。