JSP Populate

JSP Populate

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?)
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
ModuleNotFoundError: No module named 'populate'
ModuleNotFoundError: No module named 'populate'  Hi, My Python... 'populate' How to remove the ModuleNotFoundError: No module named 'populate... to install padas library. You can install populate python with following
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
ModuleNotFoundError: No module named 'satellite_populate'
ModuleNotFoundError: No module named 'satellite_populate'  Hi, My... named 'satellite_populate' How to remove the ModuleNotFoundError: No module named 'satellite_populate' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-populate'
ModuleNotFoundError: No module named 'django-populate'  Hi, My... named 'django-populate' How to remove the ModuleNotFoundError: No module named 'django-populate' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'foreman-populate'
ModuleNotFoundError: No module named 'foreman-populate'  Hi, My... named 'foreman-populate' How to remove the ModuleNotFoundError: No module named 'foreman-populate' error? Thanks   Hi, In your
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
ModuleNotFoundError: No module named 'odoo10-addon-users-ldap-populate'
ModuleNotFoundError: No module named 'odoo10-addon-users-ldap-populate' ...: ModuleNotFoundError: No module named 'odoo10-addon-users-ldap-populate' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-users-ldap-populate'
ModuleNotFoundError: No module named 'odoo10-addon-users-ldap-populate'
ModuleNotFoundError: No module named 'odoo10-addon-users-ldap-populate' ...: ModuleNotFoundError: No module named 'odoo10-addon-users-ldap-populate' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-users-ldap-populate'
ModuleNotFoundError: No module named 'odoo12-addon-users-ldap-populate'
ModuleNotFoundError: No module named 'odoo12-addon-users-ldap-populate' ...: ModuleNotFoundError: No module named 'odoo12-addon-users-ldap-populate' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-users-ldap-populate'
ModuleNotFoundError: No module named 'odoo8-addon-users-ldap-populate'
ModuleNotFoundError: No module named 'odoo8-addon-users-ldap-populate' ...: ModuleNotFoundError: No module named 'odoo8-addon-users-ldap-populate' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-users-ldap-populate' error
ModuleNotFoundError: No module named 'odoo9-addon-users-ldap-populate'
ModuleNotFoundError: No module named 'odoo9-addon-users-ldap-populate' ...: ModuleNotFoundError: No module named 'odoo9-addon-users-ldap-populate' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-users-ldap-populate' error
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
jsp
jsp  how jsp translated into servlets
JSP
JSP  How to run jsp program in eclipse
jsp
jsp  how to create jsp page
Jsp
Jsp  Can I implement interface in jsp
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  how to include two jsp page
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  how to create a table in oracle using jsp and the table name is entered in text feild of jsp page
jsp
jsp  write a code for jsp file generator to generate a jsp page automatically taking html page as input
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 pass jsp variable to an html page
JSP
JSP  relevant difference between servlet and jsp in 1 line
jsp
jsp  how to include google map in our jsp page
JSP
JSP   How to create CAPTCHA creation by using JSP? I need an code for CAPTCHA creation by using JSP...   You can create a captcha validation using jsp. Have a look at the following tutorial: Captcha Creation
jsp
jsp  how to write a servlet and jsp program for user login form
jsp
jsp  how to write a servlet and jsp program for user login form
jsp
jsp  why jsp is translated into servlet?pls describe precisly
jsp
jsp  code for jsp automatic genration using html
jsp
jsp  how to write hindi in jsp and store in database as unicode
JSP
JSP  FILE UPLOAD-DOWNLOAD code USING JSP
jsp
jsp  how to delete data from database using jsp
jsp
jsp  I Want complete note on JSP servlet
jsp
jsp  how to upload image through csv format in jsp
JSP
What are JSP directives, page directives and include directives?  what are jsp directives? and what are page directives? and what are include directives? can you explain taglib directives?   JSP directives JSP
JSP
Can you explain jsp page life cycle what is el how does el search for an attribute in JSP  Can you explain jsp page life cycle what is el how does el...://www.roseindia.net/jsp/simple-jsp-example/LifeCycleOfJspPage.shtml http
JSP
JSP  what are the different scopes an object can have in a jsp page   JSP Scope Variables: Page scope-It makes the data available... the following links: http://www.roseindia.net/jsp/simple-jsp-example
jsp
jsp  how to connect the database with jsp using mysql   Hi Friend, Please visit the following links:ADS_TO_REPLACE_1 http://www.roseindia.net/jsp/connectjspwith_mysql.shtml http://www.roseindia.net/jsp

Ads