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




Have Programming Question? Ask it here!
 
 
 


ask
JSP Populate
1 Answer(s)      4 years and 6 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 jsp translated into servlets
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  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  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   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 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
jsp
jsp  how to write hindi in jsp and store in database as unicode
jsp
jsp  code for jsp automatic genration using html
jsp
jsp  why jsp is translated into servlet?pls describe precisly
JSP
JSP  relevant difference between servlet and jsp in 1 line
jsp
jsp  how to pass jsp variable to an html page
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   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 include google map in our jsp page
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
what is jstl in JSP   what is jstl   JSTL is also called as JSP tag libraries. They are collection of custom actions which canbe accessed as JSP tags. For more information, visit the following link: JSTL Tutorials
JSP
access application data stored in JavaBeans components. The jsp expression...). Before JSP 2.0, we could use only a scriptlet, JSP expression, or a custom tag to include server state in the jsp page output. For more information, visit
JSP
JSP public opinion poll   Develop a JSP for a news channel to conduct public opinion poll on any topic. Users will respond through yes or no options. Later display the result in percentage
jsp
jsp  sir i want to jsp code for online examination like as bank po,,,,,,plz help me sir
jsp
jsp  how to edit only one row from multiple row from single jsp page dynamically
JSP
JSP  How to include the same jsp page dynamically to a number of times automatically
jsp
jsp  Hi in my dao class some exception is there then how can i display in jsp page
Advertisements
 

 

 

DMCA.com