第一步:引入标签库
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
第二步:使用jstl标签的demo,jsp页面内容如下:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="com.fz.bean.Student"%> <%@ page import="java.util.*"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Bootstrap 实例</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <h1 align="center"> <b>*******</b> </h1> <div class="container"> <div class="row clearfix"> <div class="col-md-12 column"> <table class="table"> <thead> <tr> <th>编号</th> <th>姓名</th> </tr> </thead> <tbody> <c:forEach items="${listStudent}" var="student"> <tr> <td>${student.id }</td> <td>${student.name }</td> </tr> </c:forEach> </tbody> </table> </div> </div> </div> </body> </html>
原文:http://www.cnblogs.com/jack1208-rose0203/p/6402567.html