kullanan URL parametresini erişen.Ben JSTL için yeni ve ben de bir veritabanından alınan nesnelerin, ötelemeli listeden EL işaretlemesini içeren jsp bir url-string parametresi için yardıma ihtiyacın JSTL
Ben bir servlet sesleniyorum: Aşağıdaki kod satırı ben burada
<a href="create-course-summary?spid="${param.spid}>add</a>
${param.spid}:
için soruyorum gerçek sayı ile doldurur, böylece birisi nasıl aşağıdaki kodu düzeltmek gösterebilir misin arka plan aşağıdaki url kalıbı:
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String spidString = req.getParameter("spid");
Long spid = new Long(spidString);
List<CourseSummary> coursesummaries = new CourseSummaryDAO().findAllCS(spid);
req.setAttribute("coursesummaries", coursesummaries);
jsp.forward(req, resp);
}
:
view-course-summaries?spid=1
Bu bir sunucu uygulaması aşağıdaki doGet
yöntemini çağıran
Ve aşağıdaki jsp verir:
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ include file="admintop.inc" %>
<table>
<tr>
<td>Name of School (Course Provider):</td>
<td>will go here</td>
</tr>
<tr><td colspan=2>
<a href="create-course-summary?spid="${param.spid}>add</a>
</td>
</tr>
<tr>
<td colspan=2>
<table>
<tr>
<th>Type</th>
<th>Number</th>
<th>id</th>
</tr>
<c:forEach varStatus="loopCounter" items="${coursesummaries}" var="coursesummary">
<tr>
<td>
<c:out value="${coursesummary.coursetype}" />
</td>
<td>
<c:out value="${coursesummary.numunits}" />
</td>
<td>
<c:out value="${coursesummary.id}" />
</td>
</tr>
</c:forEach>
</table>
</td>
</tr>
</table>
<%@ include file="adminbottom.inc" %>
Teşekkür deneyin. Ben tırnak benim yerleşimi de, sorunun bir parçası olduğunu düşünüyorum. +1 ve kabul edilen cevap için kredi. Güzel yanıt zamanı. – CodeMed