Retrieve data by clicking a link

Retrieve data by clicking a link

In a page there are 5 links.Every link has a hidden value. According to that hidden value data should be retrieved from the database and data should be displayed in a new page.How to do it?Please help.

View Answers

May 24, 2011 at 12:32 PM

1)link.jsp:

<a href="display.jsp?id=1">Link1 </a><br>
<a href="display.jsp?id=2">Link2 </a><br>
<a href="display.jsp?id=3">Link3 </a><br>
<a href="display.jsp?id=4">Link4 </a><br>
<a href="display.jsp?id=5">Link5 </a>

2)display.jsp:

<%@page import="java.sql.*"%>
<table>
<%
String id=request.getParameter("id");
Class.forName("com.mysql.jdbc.Driver").newInstance();  
 Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");  
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("Select * from employee where id='"+id+"'");
if(rs.next()){
    %>
<tr><td>Name:</td><td><input type="text"  value="<%=rs.getString("name")%>"></td></tr>
<tr><td>Address:</td><td><input type="text"  value="<%=rs.getString("address")%>"></td></tr>
<tr><td>Contact No:</td><td><input type="text" value="<%=rs.getString("contactNo")%>"></td></tr>
<tr><td>Email:</td><td><input type="text" value="<%=rs.getString("email")%>"></td></tr>
<%
}
%>
</table>

May 24, 2011 at 12:32 PM

1)link.jsp:

<a href="display.jsp?id=1">Link1 </a><br>
<a href="display.jsp?id=2">Link2 </a><br>
<a href="display.jsp?id=3">Link3 </a><br>
<a href="display.jsp?id=4">Link4 </a><br>
<a href="display.jsp?id=5">Link5 </a>

2)display.jsp:

<%@page import="java.sql.*"%>
<table>
<%
String id=request.getParameter("id");
Class.forName("com.mysql.jdbc.Driver").newInstance();  
 Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");  
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("Select * from employee where id='"+id+"'");
if(rs.next()){
    %>
<tr><td>Name:</td><td><input type="text"  value="<%=rs.getString("name")%>"></td></tr>
<tr><td>Address:</td><td><input type="text"  value="<%=rs.getString("address")%>"></td></tr>
<tr><td>Contact No:</td><td><input type="text" value="<%=rs.getString("contactNo")%>"></td></tr>
<tr><td>Email:</td><td><input type="text" value="<%=rs.getString("email")%>"></td></tr>
<%
}
%>
</table>









Related Tutorials/Questions & Answers:
Retrieve data by clicking a link
Retrieve data by clicking a link  In a page there are 5 links.Every link has a hidden value. According to that hidden value data should be retrieved from the database and data should be displayed in a new page.How to do it?Please
retrieve the data to text fields from database on clicking the value of combo box
retrieve the data to text fields from database on clicking the value of combo box   retrieve the data to text fields from database on clicking... getting data into textarea from database table by clicking on the button
Advertisements
link in the field of table on clicking he link the full data will displayed
link in the field of table on clicking he link the full data will displayed   Hello... I am learning jsp and mysql. I am facing some problem. I am... that on clicking on any one of the name of the student, the whole data
how to retrieve link - JSP-Servlet
how to retrieve link  how to retrieve link of a web page and use it as input in the program
Display alert box on clicking link
Display alert box on clicking link In this tutorial, we will display alert box... a "a href" link. On clicking this link ,a alert box prompt message... in the block. The code given below is used to display alert box on clicking link
How to read and retrieve jtable row values into jtextfield on clicking at particular row ...
How to read and retrieve jtable row values into jtextfield on clicking at particular row ...  Hello Sir, I am developing a desktop application in which i have to display database records in jtable .now I want
store and retrieve data
store and retrieve data  sir,i want to store the entering data in a word file and retrieve it when i need.i am try to develop a video portal.in which... Write data into word file For this, poi-scratchpad-3.7-20101029.jar is needed
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
How to Retrieve Data from Facebook Using PHP
How to Retrieve Data from Facebook Using PHP  is this link has right content regards that?? http://techpdf.co.cc/blog/how-to-retrieve-data-from-facebook-using-php
How to Retrieve Data from Facebook Using PHP
How to Retrieve Data from Facebook Using PHP  is this link has right content regards that?? http://techpdf.co.cc/blog/how-to-retrieve-data-from-facebook-using-php
how to retrieve data from database
how to retrieve data from database  unable to retrieve data from database using mySQL by using jsp sessions and beans for editing
parse data from a link in java
parse data from a link in java  Hi, Here I want code for Extracting data from a link and the data a must be stored in mysql and then I need to display the data in a jsp page
how to store,retrieve,modify the data
how to store,retrieve,modify the data  hello sir ,how to store,retrieve,modify the data using the swing please help me
Retrieve The Data From MySql Datbase
Retrieve The Data From MySql Datbase   How to Retrieve The Data From MYSQL database TO Use Select the Emp_id Option.And Also Search Option
retrieve data from database with hyperlink
retrieve data from database with hyperlink  sir....i have one table called 'name' having two values i have to retrieve those data with a hyperlink... have values C C++ i have to retrieve and if i click C its sub categories should
Retrieve data using Criteria api
Retrieve data using Criteria api  import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Query; import... the following link: Hibernate Tutorials
how to use bean to retrieve data from database
how to use bean to retrieve data from database  how to use bean to retrieve data from database   poda sendru
retrieve data from mysql database
retrieve data from mysql database  hi am not familiar in php.....even... selected value on combobox which is to be retrieve the relevant data from mysql...;'; } ?&gt; finally the result is whole data is displayed where the data
retrieve data into textbox - Swing AWT
retrieve data into textbox  Hi! I am writing a program using java swing to create a front end in which a user enters his name and roll no. and gets... there is a table called student in which all records are kept..how can i retrieve
Data retrieve from mysql database
Data retrieve from mysql database  Hi sir, please give some example... from the dropdown, related data will get displayed on the textboxes. Here we have...("name").toString(); String data=""; Connection conn = null; String url = "jdbc
how to retrieve blob data - JSP-Servlet
how to retrieve blob data  How to retrieve the BLOB table having... as a table format?   Hi friend, I am sending you a link. I hope that, this link will help you. Please visit for more information. http
Retrieve multiple data from database into Table.....
Retrieve multiple data from database into Table.....   hi........... I want to Retrieve multiple data from database into Table but i am not able to.... i am only able to retrieve one value not more than that. means in my
retrieve data from database using jsf
retrieve data from database using jsf  Hello I want an example of source code to retrieve data from database i have a database (oracle) name as db1...),, name ,and city I want after enter value in textbox according idauthor i retrieve
JSP and XML .data store nd retrieve
JSP and XML .data store nd retrieve  I have made a form in jsp having emp id, projectname and emp name.I want to store data related to employee in xml file.How can i store data entered by user in XML file and later retrieve data
how to retrieve data from table with runtime values in sql?
how to retrieve data from table with runtime values in sql?  how to retrieve data from table with runtime values in sql? For example, I have table... to execute the command with the dates which I pass. I know how to retrieve a particular
link
link  hey frnds can anyone plz tell me how can i store my videos as link in my database and can retrive the video using servlet by clicking on to that link .it may be confusing sorry about that and if someone can than plz help me
I have to retrieve these data from the field table
I have to retrieve these data from the field table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from
MYSQL retrieve record from Data table
MYSQL retrieve record from Data table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field
Retrieve data from xml using servlets
Retrieve data from xml using servlets  Hi plz send me the code for retrieving the data from xml File using Servlets.   Hi, Do you want... File using ServletADS_TO_REPLACE_2 Thanks   Hi, Learn Get Data From
Possible ways to Retrieve Data - Development process
Possible ways to Retrieve Data   Hi Deepak, Can u explain me, how manys we can retrive data from database. am confused with ,1)using beans like set property and get property 2)using JSTL tags and apart frm
how to insert, retrieve data from,to db(code)....
how to insert, retrieve data from,to db(code)....  Hi..... i ve created login page n in that a registration form also.... my doubt is-when... that data will b stored in db(m using sybase). 2.also hw to retrieve the data from
retrieve data from mysql database and store it in a variable ?
retrieve data from mysql database and store it in a variable ?  sir , I am working on a project , in which I have to apply operation on input data... to store that data in int variable. how to do this ?   Here is an example
Retrieve data from databse using where in JSP
Retrieve data from databse using where in JSP  Hi, can somebody help me? I have a jsp page. in that i want to get data from the database where username is matched. i tried it. but can't get the output. here is the code. please
Retrieve data from database in swing application
Retrieve data from database in swing application  I want to retrive data(doctor name,specilization,date) from my sql database...(); ResultSet rs=st.executeQuery("select * from data where id=1"); while
how to insert, retrieve data from,to db(code)....
how to insert, retrieve data from,to db(code)....  Hi, i have created... register his details,(for ex,username,password,dob,gender) 1.how that data will b stored in db(m using sybase). 2.also hw to retrieve the data from db. cn u
How to retrieve data using combo box value in jsp? - JSP-Servlet
How to retrieve data using combo box value in jsp?  Hi freind, I already post this question. I need urgent help from u. pl response me... the following link: http://www.roseindia.net/jsp/comboSelect.shtml Hope
link
link  how can we give hyperlinks on data retrieved from the database... and details related to that link should be diaplay and stored in the database... which when clicked displays some data and "conference " is stored in another
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
link
the link the table is displayed and other links were hidden if i want to click the next link i have to refresh the page instead i want to do is when i click the link the table should display and again when i click the link the table should
LINK
LINK  Thank you friend.cant we use single click instead of double click and also for four link u has given the example but i have 14 links in that case wat i should do
link
to displays some data on click and post data using ajax. All these multiple
LINK
LINK  I have four links which link to a table,if i click one link... i want to ask is when i click the link the table is displayed and other links were hidden if i want to click the next link i have to refresh the page instead i
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  For example, In Employee.jsp form, When i click employee id value in combo box ,the related employee name will be displayed in text field
retrieve related data from database using jsp and mysql
retrieve related data from database using jsp and mysql  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  I am using a single jsp form.. i did not get from another form.. i do not use 2 jsp form.. all are satisfaction in this form.. What will i do. My code is following
Retrieve data from the database and write into ppt file
Java Retrieve data from the database & write into ppt file In this section, we are going to retrieve data from the database and write into the .ppt file... * from data"); String name = ""; String address = ""; while (rs.next
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  Hi Friends, When i click combobox value in jsp form page, it will diplay... the follwing link http://www.roseindia.net/jsp/comboSelect.shtml ull pointer

Ads