Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ask
JSP Populate
1 Answer(s)      4 years and 8 months ago
Posted in : JSP-Servlet


Hi,
I want to call a XYZ jsp via URL with some parameters and at the same time want to use that parameter to populate the same XYZ jsp from database. How do I populate this XYZ jsp after hitting that URL (it needs to call java/servelt to populate that jsp.. my question is how?)

Advertisement
View Answers

February 6, 2010 at 4:29 PM


Hi Friend,

Try the following code:

<%@page import="java.sql.*"%>
<script>
function funct(){
var id=document.form.id.value;
window.location.replace("http://localhost:8080/examples/jsp/save.jsp?id="+id);
}
</script>


<form name="form">
Enter Id: <input type="text" name="id" onkeyup="funct();">

</form>
<%
String ide=request.getParameter("id");
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root";, "root");
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("Select * from person1 where id='"+ide+"'");
String name="";
String address="";
while(rs.next()){
name=rs.getString("name");
address=rs.getString("address");
}
rs.close();
st.close();
conn.close();
%>
<table>
<tr><td>Name:</td><td><input type="text" value="<%=name%>"></td></tr>
<tr><td>Address:</td><td><input type="text" value="<%=address%>"></td></tr>
</table>


Thanks


Related Tutorials/Questions & Answers:
JSP Populate - JSP-Servlet
parameters and at the same time want to use that parameter to populate the same XYZ jsp from database. How do I populate this XYZ jsp after hitting that URL (it needs to call java/servelt to populate that jsp.. my question is how?)  Hi
Populate dropdown menu from database using jsp and servlet
Populate dropdown menu from database using jsp and servlet  please i need code to populate dropdown menu from mysql database using jsp and servlet. thanks
Advertisements
populate Combo Box dynamically
populate Combo Box dynamically  Hi, How to populate the Combo Box dynamically using Flex with Jsp's
populate dropdown box
populate dropdown box  hi, Is there any ways in which i can populate my dropdown menu with values from 1 to n (n = the value stored in database)using java script or jsp, either is fine? Ex: If value corresponding to selected
pre-populate form
pre-populate form  how to pre populate form in php   what do you mean by pre populate
Populate value into HTML page
Populate value into HTML page  Hi, How to populate values from one html page table to another html page..? Thanks
JTable populate with resultset.
JTable populate with resultset.  How to diplay data of resultset using JTable?   JTable is component of java swing toolkit. JTable class...) JTable(Vector data, Vector columneNames) Here is a JTable populate with resultset
Populate Menus In Tree View - Struts
Populate Menus In Tree View  Hi all, i am writing one simple application using struts framework. In this application i thought to bring the different menus of my application in a tree view.Like what we have in window
How to populate text fields using php code?
How to populate text fields using php code?  How could I use php to populate text fields by selecting a name of a business from dropdown list? Those text fields that will be populated by information in regards its company name
How to populate collection like map with annotation in mybatis?
How to populate collection like map with annotation in mybatis?   <collection property="participantCas" column="agmtsID" javaType="java.util.ArrayList" ofType="com.Client"> <id property="partyId" column
Populate a combo box using data from a database
Populate a combo box using data from a database  Hi Guys, In need... to populate the first one, and then how to send the data off to a servlet and preform... to the client using ajax, and then populate the combo box, I must'nt reload
I want to Populate ComBobox value from database that combox is Itemrenderer of DataGrid.
I want to Populate ComBobox value from database that combox is Itemrenderer of DataGrid.  I want to Populate ComBobox value from database that combox is Itemrenderer of DataGrid
How to populate an HTML table using jstl code - Spring
How to populate an HTML table using jstl code  Hi I want to populate an HTML table using jstl code.I am using Hasp map.For 1 column its okay it works fine.But if I am suppose to populate 2 or 3 columns from the database than
Populate listbox according to selection value from another selectbox
Populate listbox according to selection value from another selectbox  ... for campus and another for course. When i select campus i want to populate... but in that solution page will refreshed and then it will populate the course
JSP - JSP-Servlet
JSP   am working with JSP I have one list box which is populated from the database. On selecting the value from the list box I want to populate the text box with the corresponding values of the previously selected value
JSP with java/servlet - JSP-Servlet
JSP with java/servlet  Thanks Deepak for your answere to my previous question. With reference to my previous question about JSP populate, actually I wanted to use jsp to only present the data and wanted to have another object
jsp
jsp  how to include two jsp page
JSP
what is JSP forward tag for  what is JSP forward tag for   It forwards the current request to another JSP page. Below is the syntax for the same:- <jsp:forward page="...url..." /> We can also forward parameter
Jsp
Jsp  Can I implement interface in jsp
jsp
jsp  how to create jsp page
JSP
JSP  How to run jsp program in eclipse
jsp
jsp  how jsp translated into servlets
jsp
jsp  write a code for jsp file generator to generate a jsp page automatically taking html page as input
jsp
jsp  how to create a table in oracle using jsp and the table name is entered in text feild of jsp page
JSP
JSP  Hi, What is JSP? What is the use of JSP? Thanks   Hi, JSP Stands for Java Server Pages. It is Java technology for developing web applications. JSP is very easy to learn and it allows the developers to use Java
jsp
jsp   what is the basic necessities reguired for running jsp using JDBC bridge?? and how to write a jsp code to access the detail present in microsoft access pls send link regarding above
jsp
jsp  how to connect the database with jsp using mysql   Hi Friend, Please visit the following links: http://www.roseindia.net/jsp/connectjspwith_mysql.shtml http://www.roseindia.net/jsp/Accessingdatabase-fromJSP.shtml
jsp
jsp  how to upload image through csv format in jsp
jsp
jsp  I Want complete note on JSP servlet
jsp
jsp  how to delete data from database using jsp
JSP
JSP  FILE UPLOAD-DOWNLOAD code USING JSP
 

 

 

DMCA.com