我試圖從表中選擇一個特定的領域,從一個JSP傳遞值another.My第一個JSP文件如下想知道如果我的JSP格式正確
的List.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form method="POST" action="/Spring/deletedpage.jsp">
<table BORDER="1">
<tr>
<TH width="50">Id</TH>
<TH width="150">First Name</TH>
<TH width="150">Last Name</TH>
<TH width="100">Money</TH>
<TH width="50">Currency</TH>
</tr>
<c:forEach items="${userList}" var="person">
<tr>
<td><input type="checkbox" name ="id" value="${person.id}"> <c:out
value="${person.id}" /></td>
<td><c:out value="${person.name}" /></td>
<td><c:out value="${person.password}" /></td>
<td><c:out value="${person.gender}" /></td>
<td><c:out value="${person.country}" /></td>
</tr>
</c:forEach>
</table>
<input type="submit">
</form>
<input type="submit" value="edit"/>
</body>
</html>
我正在從表中選擇一個ID並將它傳遞給另一個JSP命名deletedpage.jsp這是如下
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String id1=request.getParameter(id);
int id2=Integer.parseInt(id1);
System.out.println(id1);
%>
<form method="POST" action="<%=request.getContextPath()%>/deletedpage/delete">
<P>Are you sure you want to delete this user??</P>
<input type="submit" value="Yes" />
</form>
<p> <a href="frm4.jsp">No</a></p>
</body>
</html>
,但我得到的錯誤在下面的行
String id1=request.getParameter(id);
爲
id cannot be resolved
你應該在引號之間加上id,例如String id1 = request.getParameter(「id」);此外爲什麼scriplets – mprabhat