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

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

相关文章
|
1月前
|
前端开发 Java 数据库
springBoot:template engine&自定义一个mvc&后端给前端传数据&增删改查 (三)
本文介绍了如何自定义一个 MVC 框架,包括后端向前端传递数据、前后端代理配置、实现增删改查功能以及分页查询。详细展示了代码示例,从配置文件到控制器、服务层和数据访问层的实现,帮助开发者快速理解和应用。
|
2月前
|
存储 前端开发 Java
JavaWeb基础6——Request,Response,JSP&MVC
Request继承体系、获取请求头行体的方法、IDEA使用模板创建Servlet、请求参数中文乱码解决、请求转发、Respones重定向、Response响应字节字符数据、JSP、EL 表达式、JSTL标签、MVC模式和三层架构
JavaWeb基础6——Request,Response,JSP&MVC
|
3月前
|
存储 SQL 监控
ADBPG&Greenplum成本优化问题之ADB PG的数据库管控的定义如何解决
ADBPG&Greenplum成本优化问题之ADB PG的数据库管控的定义如何解决
45 2
|
3月前
|
供应链 前端开发 Java
服装库存管理系统 Mybatis+Layui+MVC+JSP【完整功能介绍+实现详情+源码】
该博客文章介绍了一个使用Mybatis、Layui、MVC和JSP技术栈开发的服装库存管理系统,包括注册登录、权限管理、用户和货号管理、库存管理等功能,并提供了源码下载链接。
服装库存管理系统 Mybatis+Layui+MVC+JSP【完整功能介绍+实现详情+源码】
|
3月前
|
JSON 前端开发 Java
Spring MVC返回JSON数据
综上所述,Spring MVC提供了灵活、强大的方式来支持返回JSON数据,从直接使用 `@ResponseBody`及 `@RestController`注解,到通过配置消息转换器和异常处理器,开发人员可以根据具体需求选择合适的实现方式。
166 4
|
3月前
|
SQL 数据处理 数据库
|
3月前
|
Cloud Native 关系型数据库 分布式数据库
云原生数据库2.0问题之DBStack的定义如何解决
云原生数据库2.0问题之DBStack的定义如何解决
|
4月前
|
数据采集 分布式计算 大数据
MaxCompute产品使用合集之数据集成中进行数据抽取时,是否可以定义使用和源数据库一样的字符集进行抽取
MaxCompute作为一款全面的大数据处理平台,广泛应用于各类大数据分析、数据挖掘、BI及机器学习场景。掌握其核心功能、熟练操作流程、遵循最佳实践,可以帮助用户高效、安全地管理和利用海量数据。以下是一个关于MaxCompute产品使用的合集,涵盖了其核心功能、应用场景、操作流程以及最佳实践等内容。
|
4月前
|
Oracle 关系型数据库 Java
实时计算 Flink版操作报错合集之cdc postgres数据库,当表行记录修改后报错,该如何修改
在使用实时计算Flink版过程中,可能会遇到各种错误,了解这些错误的原因及解决方法对于高效排错至关重要。针对具体问题,查看Flink的日志是关键,它们通常会提供更详细的错误信息和堆栈跟踪,有助于定位问题。此外,Flink社区文档和官方论坛也是寻求帮助的好去处。以下是一些常见的操作报错及其可能的原因与解决策略。
|
4月前
|
存储 监控 安全
安全规范问题之跟数据库交互涉及的敏感数据操作需要有哪些措施
安全规范问题之跟数据库交互涉及的敏感数据操作需要有哪些措施