欢迎来到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>

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

相关文章
|
3月前
|
存储 JSON 关系型数据库
【干货满满】解密 API 数据解析:从 JSON 到数据库存储的完整流程
本文详解电商API开发中JSON数据解析与数据库存储的全流程,涵盖数据提取、清洗、转换及优化策略,结合Python实战代码与主流数据库方案,助开发者构建高效、可靠的数据处理管道。
|
17天前
|
数据采集 数据可视化 数据挖掘
阿里云瑶池数据库 Data Agent,数据安全,分析准确,让数据更有价值!
Data Agent 是阿里云瑶池数据库推出的智能数据体产品,融合 Data+AI 与 Agentic AI 技术,覆盖数据全生命周期。支持多源数据接入,可自主规划分析任务、生成代码并输出可视化洞察报告,让业务人员零门槛获取专业级分析结果,助力企业高效实现数据驱动决策。
|
1月前
|
人工智能 Java 关系型数据库
使用数据连接池进行数据库操作
使用数据连接池进行数据库操作
67 11
|
2月前
|
存储 数据管理 数据库
数据字典是什么?和数据库、数据仓库有什么关系?
在数据处理中,你是否常困惑于字段含义、指标计算或数据来源?数据字典正是解答这些问题的关键工具,它清晰定义数据的名称、类型、来源、计算方式等,服务于开发者、分析师和数据管理者。本文详解数据字典的定义、组成及其与数据库、数据仓库的关系,助你夯实数据基础。
数据字典是什么?和数据库、数据仓库有什么关系?
|
2月前
|
存储 关系型数据库 数据库
【赵渝强老师】PostgreSQL数据库的WAL日志与数据写入的过程
PostgreSQL中的WAL(预写日志)是保证数据完整性的关键技术。在数据修改前,系统会先将日志写入WAL,确保宕机时可通过日志恢复数据。它减少了磁盘I/O,提升了性能,并支持手动切换日志文件。WAL文件默认存储在pg_wal目录下,采用16进制命名规则。此外,PostgreSQL提供pg_waldump工具解析日志内容。
190 0
|
4月前
|
存储 SQL Java
数据存储使用文件还是数据库,哪个更合适?
数据库和文件系统各有优劣:数据库读写性能较低、结构 rigid,但具备计算能力和数据一致性保障;文件系统灵活易管理、读写高效,但缺乏计算能力且无法保证一致性。针对仅需高效存储与灵活管理的场景,文件系统更优,但其计算短板可通过开源工具 SPL(Structured Process Language)弥补。SPL 提供独立计算语法及高性能文件格式(如集文件、组表),支持复杂计算与多源混合查询,甚至可替代数据仓库。此外,SPL 易集成、支持热切换,大幅提升开发运维效率,是后数据库时代文件存储的理想补充方案。
|
6月前
|
人工智能 关系型数据库 分布式数据库
让数据与AI贴得更近,阿里云瑶池数据库系列产品焕新升级
4月9日阿里云AI势能大会上,阿里云瑶池数据库发布重磅新品及一系列产品能力升级。「推理加速服务」Tair KVCache全新上线,实现KVCache动态分层存储,显著提高内存资源利用率,为大模型推理降本提速。
|
开发框架 前端开发 .NET
ASP.NET CORE 3.1 MVC“指定的网络名不再可用\企图在不存在的网络连接上进行操作”的问题解决过程
ASP.NET CORE 3.1 MVC“指定的网络名不再可用\企图在不存在的网络连接上进行操作”的问题解决过程
390 0
|
开发框架 前端开发 .NET
ASP.NET MVC WebApi 接口返回 JOSN 日期格式化 date format
ASP.NET MVC WebApi 接口返回 JOSN 日期格式化 date format
170 0
下一篇
日志分析软件