-1

Jsp File Jsp file

Browser page

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

Tom
  • 11
  • 3

1 Answers1

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