• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sending a value using hyperlink to another form

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

i am trying to crate a table and make one field of table(say NAME) as hyperlink. whenever we click it the value must pass onto another page. but value on another page is null. what is the reason? here is the code ...

<%@ page language="java" import="java.sql.*"%>
<%
String n;
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/j002","root","sr");
PreparedStatement st=con.prepareStatement("select * from pro");
ResultSet rs=st.executeQuery();%>
<html>
<body>
<form>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width=50%>
<%
while(rs.next())
{%>

<tr>
<td>
<a href="new.jsp"?n=<%= rs.getString("name")%>><%= rs.getString("name")%></a>
</td>
<td>
<%= rs.getString("no")%>
</td></tr>
<%}%>
</table>
</form>
</body></html>
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sachin,
Can U shwow-up ur code of "new.jsp" ?
it seems tobe okay from this page .
 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Naveen Mishra:
Hi Sachin,
Can U shwow-up ur code of "new.jsp" ?
it seems tobe okay from this page .



<%@ page language="java" import="java.sql.*"%>
<%
session.setAttribute("x",n);
String a=(String)session.getAttribute("x");
out.println(a);
%>

or if even without session if i use
String a=request.getParameter("n")
itz not workin.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like your quoting is off:


Try:
reply
    Bookmark Topic Watch Topic
  • New Topic