首先一定要引入包
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
我的jsp部分代码,其中也包括直接<%=%>的方式取值,也包括<c:foreach><c:out></c:out></c:foreach>嵌套的输出List<String>结构的数据
<%@ page import="java.util.List" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
String title = (String)request.getAttribute("title");
String date = (String)request.getAttribute("date");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="<%=basePath%>">
<title>!!!</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/casedetail.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"><div class="container-fluid"></div></nav>
<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar"></div>//侧边导航栏
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">案例信息</div>
<div class="panel-body">
<h1 class="artitle"><%=title %></h1>
<p class="postmeta">
<span class="posttime"><%=date %></span>
</p>
<div class="infobox" style="padding-left: 7%;">
<div class="panel-group">
<div class="col-md-9">
<table>
<c:forEach var="i" items="${secondary}">
<tr>
<td><p style="float: left;"><c:out value="${i}"></c:out></p></td>
</tr>
</c:forEach>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div><!--/.row-->
</div><!--/.main-->
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>