File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Pass values using href in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Pass values using href in JSP" Watch "Pass values using href in JSP" New topic
Author

Pass values using href in JSP

Mehak Daani
Greenhorn

Joined: Oct 08, 2003
Posts: 16
Hi...
I have this code where my callid is a hyper link ..... to another jsp ..... the values of the callid comes from the database .... like calls.getInt("callid)"; ...................
Now my quest is that suppose there are 5 callid ... like 1 2 3 4 5 ... when i click on the 5th callid ... i want the hyperlink to pass the value 5 to another jsp ... where i'll be executing a query based on the 5th callid .... ...
So i have 2 questions:
1. How do i pass the dynamic value through hyper link ...
2. How do i retreive that value in another Jsp.
Please help me out on this one...!!!
Thanx
:roll:
Currently my code for the callid looks like this:
<td width="8%"><a href="somepage.jsp"><%=calls.getInt("callid")%></a></font>


A.A.
Kevin Jones
Author
Ranch Hand

Joined: Oct 29, 2003
Posts: 39
In the first JSP use
<td width="8%"><a href="somepage.jsp?id=<%=calls.getInt("callid")%>"><%=calls.getInt("callid")%></a></font>
this should give you
<a href="http://someserver/somepage.jsp?id=5>5</a>
then in somepage.jsp use
<% request.getParamater("id"); %>


Kevin Jones<br />Author: <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0321136497/jranch-20" target="_blank" rel="nofollow">Servlets and JSP: The J2EE Web Tier</a>
Mehak Daani
Greenhorn

Joined: Oct 08, 2003
Posts: 16
THANKSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSA AAAAAAAAAAAAAAAA LOOOOOOOOTTTTTTTT
IT WORKED ...!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

Welcome to the Ranch Mehak!
As you have seen, you'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Thanks!
bear
JSP Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pass values using href in JSP