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]
# 1

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....

georgemca at 2007-7-28 15:28:11 > top of Java-index,Java Essentials,Java Programming...
# 2

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?

haggard17a at 2007-7-28 15:28:11 > top of Java-index,Java Essentials,Java Programming...
# 3

> 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

georgemca at 2007-7-28 15:28:11 > top of Java-index,Java Essentials,Java Programming...
# 4

i completely level with you on that one tho this is only a very basic program intended.

haggard17a at 2007-7-28 15:28:11 > top of Java-index,Java Essentials,Java Programming...
# 5

> 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

georgemca at 2007-7-28 15:28:11 > top of Java-index,Java Essentials,Java Programming...
# 6

any hints on that one. just googled it but there doesnt seem to be many examples. bare with me as im pretty new to this

haggard17a at 2007-7-28 15:28:11 > top of Java-index,Java Essentials,Java Programming...
# 7

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>

}

manuel.leiriaa at 2007-7-28 15:28:11 > top of Java-index,Java Essentials,Java Programming...
# 8

PERFECT manuel.

haggard17a at 2007-7-28 15:28:11 > top of Java-index,Java Essentials,Java Programming...
# 9

glad to help.

regards,

MAnuel Leiria

manuel.leiriaa at 2007-7-28 15:28:11 > top of Java-index,Java Essentials,Java Programming...