Implement pagination using JSTL

Source: Internet
Author: User

JSTL (JSP Standard Tag Library, JSP Standard Tag Library) is a continuously improved open-source JSP Tag Library maintained by the apache jakarta team. JSTL can only run on containers that support JSP1.2 and Servlet2.3 specifications, such as tomcat 4.x. JSP 2.0 is also supported as a standard.
The following describes simple paging implemented using jstl. Conn. jsp files use jstl to connect to database files. According to the MVC idea, JSP serves as the View layer and is only used to display operations. Therefore, JSTL database labels are not recommended in large-scale project development.

Development Environment: Myeclipse10, sqlservler2005, and tomcat7.0.40

<% @ Page language = "java" import = "java. util. * "pageEncoding =" UTF-8 "%> <% @ taglib prefix =" c "uri =" http://java.sun.com/jsp/jstl/core "%> <% @ taglib prefix =" SQL "uri =" http://java.sun.com/jsp/jstl/ SQL "%> <% @ taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt" %> <% @ taglib prefix = "fn" uri = "http://java.sun.com/jsp/jstl/functions" %> <% @ include file =" conn. jsp "%> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN"> 

The JSTL tag connects to the database conn. jsp file:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Exported database script:

  ANSI_NULLS  QUOTED_IDENTIFIER  ANSI_PADDING   . ()   ()          (PAD_INDEX   , STATISTICS_NORECOMPUTE   , IGNORE_DUP_KEY  , ALLOW_ROW_LOCKS   , ALLOW_PAGE_LOCKS   )    ANSI_PADDING 

The page-based implementation result is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.