sending through values with href
Hi,
i have generated a table to display rows of records (with individual LotID's) from my DB.
I have made the LotID a html link to a new page which i intend to display all the info for the record of that particular LotID. The link works fine but how do i go about sending that 'LotID' value through to the page when clicking its link. baring in mind that there may be 10 different LotID links on the first page in which you may click either one.
while (rs.next())
{
%>
<tr>
<td><a href="auctionView.jsp"><%= rs.getString("LotID")%></a></td>
<td><%= rs.getString("Title")%></td>
<td><%= rs.getString("ProductCode")%></td>
<td></td>
</tr>
}
many thanks
[788 byte] By [
haggard17a] at [2007-11-27 10:13:39]

You could have the link point to a servlet, and pass the value in as a parameter, then the servlet redirects to the JSP
Or the link could be in a form, and the form's action could invoke the servlet etc....
> hmmmn im ony a novice at java programming so i would
> probably get stuck into a deeper hole. is there no
> simple way of passing through the parameter?
They are simple ways, relatively. Programming isn't easy, get used to it. Passing values around a web-app is probably something you're going to do a lot, you need to learn how to do it properly
> i completely level with you on that one tho this is
> only a very basic program intended.
You could always stick the values into the application context
I'm not sure if this is what you want but why don't you pass the id in a query string
while (rs.next())
{
%>
<tr>
<td><a href="auctionView.jsp?lotId=<%= rs.getString("LotID")%>"><%= rs.getString("LotID")%></a></td>
<td><%= rs.getString("Title")%></td>
<td><%= rs.getString("ProductCode")%></td>
<td></td>
</tr>
}