I want to pass the value j.getJob_id() to servlet page ,ie if there are two rows in the page if i press on the first row apply button , i want the id of the first row to be passed to the servlet
Asked
Active
Viewed 17 times
1 Answers
0
You could just pass it as a query parameter in your link. I believe embedding a scriplet like that is possible.
<a href="/JobPortal/AppliedJob?<% out.println(j.getJob_id()); %>" type="button"...
However, you should really consider to not use scriptlets for what you are doing here. This is much cleaner / easier if you do it with jstl.
e.g.
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:forEach items="${alist}" var="job">
<tr>
<td>${j.getJob_id()}</td>
<td>${j.getCompany_name()}</td>
...
<td><a href="/JobPortal/AppliedJob?${j.getJob_id()}" ...></a></td>
</tr>
</c:forEach>
Arwez
- 94
- 1
- 2
- 8
-
So ,how do I access it in the servlet – Tom May 15 '22 at 10:05
-
np. feel free to mark the answer as correct ;) – Arwez May 15 '22 at 15:10