retrieving of data from one jsp to another jsp

retrieving of data from one jsp to another jsp

using jsp i m displaying a table ,in table i m displaying a radio button then values like id,name etc ,if i click on an radio button i have to get a corresponding id value that is used for different jsp please help me sir...
thanks in advance
View Answers

April 15, 2010 at 5:38 PM

Hi Friend,

Try the following code:

1)Home.jsp:

<%@ page import="java.sql.*"%>
<script>
function transfer(id){
var f = document.form;
f.method = "POST";
f.action = "main.jsp?id="+id;
f.submit();
}
</script>

<form name="form">
<table border=1>
<%
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root","root";);
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from data");


while(rs.next()){
%>
<tr><td><input type="radio" name="radio" value="<%=rs.getString("id")%>" onclick="transfer(<%=rs.getString(1)%>);"></td><td><%=rs.getString("id")%></td><td><%=rs.getString("name")%></td></tr>
<%

}
}
catch(Exception e){}
%>
</table>
</form>

2) main.jsp:

<%
String id=request.getParameter("id");
out.println("id = "+id);
%>

Thanks









Related Tutorials/Questions & Answers:
retrieving of data from one jsp to another jsp - JSP-Servlet
retrieving of data from one jsp to another jsp  using jsp i m displaying a table ,in table i m displaying a radio button then values like id,name etc... that is used for different jsp please help me sir... thanks in advance   Hi
calling one jsp from another jsp page
calling one jsp from another jsp page  need coding for calling one jsp from another jsp including the xml file.Its urgent
Advertisements
how to pass arraylist data from one jsp to another jsp - JSP-Servlet
how to pass arraylist data from one jsp to another jsp  hi to all iam... the following >XXX/ ? is required to send a value from one jsp to another... to receive all employee id's that are retrived from the database in the first jsp
how to pass an array from one jsp to another jsp - JSP-Servlet
how to pass an array from one jsp to another jsp  hi friedns, can any One tell me how to send an array from one jsp to another jsp,pls any one send the code for this.also porvid the code how to retrive the arry in another jsp
How to forward the control from one jsp to another?
How to forward the control from one jsp to another?  Hi! This is Prasad Jandrajupalli. I have the 3 JSP's, but I want communicate with each... is not communicate with the Third JSP. I want forward the control from first jsp to second
calling one jsp from another jsp - JSP-Servlet
calling one jsp from another jsp  Hi All, In my web application I have two jsp files(one.jsp and two.jsp). I have written a seperate method in two.jsp by using jsp declarative tag. Now from one.jsp file I want to call
Retrieving data from data base using jsp combo box
Retrieving data from data base using jsp combo box  Hi guys please help me , i have on GUI page int that Server type(like apache,jboss,weblogic) one combo box is there and another filed is version of the server(like 1.0,2.0) like
calling one jap page from another jsp page
calling one jap page from another jsp page  i created a button in one jsp page i need to call another jsp page as an action to that button. so how can i call.. plz any one explain. its urgent
how to use one form out of multiple form from one jsp to another jsp
how to use one form out of multiple form from one jsp to another jsp  ... a .jsp( say abc.jsp) file which contains multiple Action form.I am required to add one form from abc.jsp as it is to another .jsp(say def.jsp).Your advise
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>"> common.jsp <%String attr=request.getAttribute("param"); out.print(attr
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>"> common.jsp <%String attr=request.getAttribute("param"); out.print(attr
retrieving from db - JSP-Servlet
retrieving from db  hello' I am trying to write my first application...; Hi Retrive value from database Retrive data from...: Exception in JSP: /jsp1/mydb.jsp:25 22: if(request.getParameter("action
retrieving data from database to the textbox depending upon the id in jsp
retrieving data from database to the textbox depending upon the id in jsp  Hi, our project involves fetching of data from database into textbox depending upon another textbox value which is productid.First the id entered by us
Passing a 2 Dimentional Array From one Jsp to Another Jsp file and Retreving it
Passing a 2 Dimentional Array From one Jsp to Another Jsp file and Retreving... are dynamically stored into it in one jsp file .I passed this array into another Jsp File and when i tried to retrieve the data in the 2 Dimensional array
how to change password into one jsp to another jsp
how to change password into one jsp to another jsp  i have two jsps in one jsp i give one password and confirm password, in another jsp i want change my password compare with 1st jsp how to write code please give me answer?  
how to insert the bulk data into the data base from the table of jsp page to another jsp page
how to insert the bulk data into the data base from the table of jsp page to another jsp page  pls help i'm doing the project called centralized... to insert the marks details into the data base i have retrive the rollno and name
to bring checked data from one page to another
to bring checked data from one page to another  thanks for your help... fetching data from the database on second jsp page with checkbox corresponding each... there is one jsp page , on it there is a link, on click of which it is opening second
passing from 1 jsp to another - JSP-Servlet
passing from 1 jsp to another  Hi Sir, What are the ways and means of passing from 1 jsp page to another page.what are the different types of methods?  Hi Friend, You can use tag,sedRedirect() method
program to enter values from one jsp page and then do calculation on some formula and that results is displayed in another jsp
program to enter values from one jsp page and then do calculation on some formula and that results is displayed in another jsp  <%@ page language="java" import="java.util.*;"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
copying data from one table to another
copying data from one table to another  i need to copy data from one table to another table.. i.e the 1st eid of employee table must be copied... and so on... i need these querys to use in my JSP code
Loading a jsp page (with record from database) from another jsp page
Loading a jsp page (with record from database) from another jsp page  Suppose I have two jsp pages Search.jsp and Getdata.jsp. There are two fields in Search.jsp say Serial no,year and a button VIEW DATA. I want, when I click
retrieving values from dynamically added textboxes in jsp - JSP-Servlet
retrieving values from dynamically added textboxes in jsp  hai friends, iam new to this site ,please help me in this senario in jsp how to retrieve values from dynamically added textbox like we can see in naukri.com
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending... this message to all the employees when i upload a file then it fetch a data from that excel sheet i.e this matter will take a para meter values from the excel
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending... this message to all the employees when i upload a file then it fetch a data from that excel sheet i.e this matter will take a para meter values from the excel
passing data from one jframe to another
passing data from one jframe to another  I have two JFrame,built by using the GUI Editor netbeans 6.9.i have to pass a data from a Jtextfield in the first Jframe to another JLabel in the other JFrame.Can you please help me,how
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending a code now i am getting a particular column value i.e EmailId column for snding a massmails,now i have to get a particular column values i.e Name(A),EL(B
Data fetching from JSP or HTML - JSP-Servlet
Data fetching from JSP or HTML  Hi Deepak, Can u pls help me as i have a problem with jsp/html frameset. my question is how can i fetch the data from frameset which is in html format.pls help me. Thanks
Connecting to MySQL database and retrieving and displaying data in JSP page
Connecting to MySQL database and retrieving and displaying data in JSP page...; This tutorial shows you how to connect to MySQL database and retrieve the data from the database. In this example we will use tomcat version 4.0.3 to run our
retrieving newly added records from mssql database and display in a jsp
retrieving newly added records from mssql database and display in a jsp ... these 10 records from the jsp and retrieve the next recently added 10 records from the table and display in jsp and so on.This should be done forever(here we
read excel data from jsp - JSP-Servlet
read excel data from jsp  Hi how to read excel file from jsp? Excel file is created manually entered data having many sheets? and read the entire sheet and also edit with jsp? pls suggest me?   Hi Friend, 1
how to set the tables one is left and another one is right - JSP-Servlet
how to set the tables one is left and another one is right  Here two tables are combined.i need to set the one table is left another one is right and ineed to gap between the two tables Document document=new Document
problem in sending data from one ip to another ip in JAVA
problem in sending data from one ip to another ip in JAVA  Hi guys . this is naveen kumar...i need a help. i want to connect one ip to another ip (like ping),after that i want send the data with my system(Ip) to another ip
take data from one table and insert same in another
take data from one table and insert same in another  I want to know when a new field update in table and the same data has to update in another table
How to fetch entries/values from database to a jsp page one by one?
How to fetch entries/values from database to a jsp page one by one?  I have a table in Microsoft SQL server Management Studio with two columns title and data and each column has 10 enteries. I have a jsp page on which i want
data are not display in JSP from database - JSP-Servlet
data are not display in JSP from database   i want to finding some data through a SQL query from SQL server database to a JSP page based on some... of this jsp page. like.. School Result and three request parameters 'class', 'from
retrieving image files - JSP-Servlet
retrieving image files  How to retrieve multiple images at a time from mysql database using JSP
how can we pass parameters from jsp href to another servlet
how can we pass parameters from jsp href to another servlet  how can we pass parameters from jsp href to another servlet
Retrieving images from the oracle database using jsp and create that rretrieved image as hyperlink
Retrieving images from the oracle database using jsp and create that rretrieved... want to retrieve images using jsp and I want to display on the browser.The... to another page.Can you send code for this   Please visit the following link
retrive data from oracle to jsp
retrive data from oracle to jsp  i am a beginer in jsp so please help... cost and manager name and storing it in the data base. in search proj fiel if user enters any one of the feild such as id name cost and manager the full details
Copy data from one JTextField to another JTextField
Copy data from one JTextField to another JTextField..., you will learn how to copy the data from one JTextField into another... data into first JTextfield and select the entered text, right click, copy
jsp one to one mapping
jsp one to one mapping  how to perform one to one mapping in jsp....code of one to one mapping with .xml file
Storing and retrieving data alongwith image in mysql db using jsp
Storing and retrieving data alongwith image in mysql db using jsp  I...; <% //to get the content type information from JSP Request Header... are checking the content type is not equal to Null and //as well as the passed data from
retrieving from oracle database using jsp combo box
retrieving from oracle database using jsp combo box  hi this is my... name of the server has to display in the process name field from the oracle...){ fld.style.background = '#F0F0F0'; error = "Please Select one application to edit \n\n
how to display data from database in jsp
how to display data from database in jsp  how to display data from database in jsp
How To Pass data from one GUI to another in java swing
How To Pass data from one GUI to another in java swing  I'm new to java and part of our assignment is to build a GUI and display a result set from data input. I'm stuck at how to get the user's input from JTextFields and combobox
Data Conversion from int to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from int primitive type to another data type like String, boolean and char etc
Data Conversion from String to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from String primitive type to another data type like int, boolean and char etc
Data Conversion from short to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from short primitive type to another data type like String, boolean and char etc
Data Conversion from byte to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from byte primitive type to another data type like String, boolean and char etc
Data Conversion from float to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from float primitive type to another data type like String, boolean and char etc

Ads