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: