<jsp:include file="include/data.jsp" />
을 indexq.jsp에 표시하면 데이터가 표시되지 않지만 <%@ include file="include/data.jsp" %>
을 사용하면 예상대로 작동하지 않습니다. 나는 그것의 범위 또는 표현 언어 이슈인지 확실하지 않다. 또한 아래의 코드 포함 :jsp : JSP 태그에서 JSP/서블릿 범위 문제
TaxiController.java을
public class TaxiController extends HttpServlet {
// codes...
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// codes...
req.setAttribute("taxi_list", taxiDao.getAll());
req.getRequestDispatcher("/indexq.jsp").forward(req, resp);
}
}
는 indexq.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="js/jquery-1.10.1.min.js" ></script>
<title>Taxi List</title>
</head>
<body>
<%@ include file="include/form.jsp" %>
<br />
<jsp:include page="include/data.jsp" />
<%-- <%@ include file="include/data.jsp" %> --%>
</body>
</html>
은/data.jsp
<table>
<thead>
<tr><th colspan="5">Data</th></tr>
<tr>
<th>Date</th>
<th>Taxi Name</th>
<th>Plate number</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<c:forEach var="taxi" items="${taxi_list }" >
<tr>
<td>${taxi.date } </td>
<td>${taxi.taxiName }</td>
<td>${taxi.plateNum }</td>
<td>${taxi.amount }</td>
</tr>
</c:forEach>
</tbody>
</table>
포함3210
감사합니다.
감사합니다. fmodos! 지금 당장은 분명해, 나는 단지 내 코드에 include 지시어를 사용할 것이다. 감사! – jzarsuelo
@ cRane01 환영합니다. 기꺼이 도와 드리겠습니다. – fmodos