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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


rodmel
saving data
1 Answer(s)      6 years and 2 months ago
Posted in : JSP-Interview Questions



Advertisement
View Answers

October 30, 2008 at 5:16 PM


Hi friend,

I am sending you data store code into the database.

<html>
<head>
<title>Insert into database</title>
</head>

<body>

<table border="1" width="50%" bgcolor="lightgreen">
<tr>
<td width="100%">
<form method="POST" action="insertAction.jsp">

<h2 align="center">Insert Data page</h2>
<table border="1" width="100%">
<tr>
<td width="50%"><b>Course Name:</b></td>
<td width="50%"><input type="text" name="coursename" size="20"/> </td>
</tr>
<tr>
<td width="50%"><b>Courese Fee:</b></td>
<td width="50%"><input type="text" name="couresefee" size="20"/> </td>
</tr>
<tr>
<td width="50%"><b>Faculty Name:</b></td>
<td width="50%"><input type="text" name="facultyname" size="50"/> </td>
</tr>

</table>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>

</form>
</td>
</tr>
</table>

</body>

</html>
---------------------------


<%@ page language="java" import="java.sql.*" %>

<%
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="root" ;
String password="root";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);
try{
Statement st = con.createStatement();
String empname=request.getParameter("coursename");
String position=request.getParameter("couresefee");
String facultyname = request.getParameter("facultyname");

int val = st.executeUpdate("insert student values(id,'"+empname+"','"+position+"','"+facultyname+"')");

con.close();

out.println("successfully insert data into database!");

}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}

%>

-------------------------------------

Please visit for more information.

http://www.roseindia.net/jsp/implement-javascript-with-jsp.shtml

Thanks.


Related Tutorials/Questions & Answers:
saving data in xml
saving data in xml  Hi, I have an xml file with spring map, in that i have parent child nodes. I have jsp form in that i have put same parent child elements. when i submit jsp form I want to append same data into xml file
Saving data in database
Saving data in database  hello i m facing a strange problem if i am submitting data form database then i can see it in database but if am submitting from app then it is not showing in to database but when i fetching form
Advertisements
saving data - JSP-Interview Questions
saving data  Dear Sir/Madam, Please teach me step by step how to save the data in JSP and using crimson editor? Thank u very much. rodmel  Hi friend, I am sending you data store code into the database
saving files
saving files  i want to create a program that would allows me to save my file and attach data
File saving and Writing
File saving and Writing   Hello Rose india..... I have a doubt for you plzzz kindly Help me... I have an "Arraylist" which includes some table... a "file create option" it will be ".csv" file and i want to write the data from
preview and saving an application form
preview and saving an application form   i have developed an application form, which is to be filled by the user.That application form is big in size so i have splitted that application form in 6 different forms ie, in first jsp
preview and saving an application form
preview and saving an application form   i have developed an application form, which is to be filled by the user.That application form is big in size so i have splitted that application form in 6 different forms ie, in first jsp
saving the changes in Microsoft sql sever - SQL
saving the changes in Microsoft sql sever  How do we commit the changes in Microsoft sql server
Saving URL in local disk - Java Beginners
Saving URL in local disk  Hi Friend, How can i Save URL like "www.jagran.com " on local disk throgh java Statement. Thanks ,in advance
Saving image and text in mysql db using spring?
Saving image and text in mysql db using spring?  Hii, My requirement is to save the employee details(including image) into mysql db.i want to save the image location in db .And actual image(binary formate) should save
saving form bean with Array of objects (collection) - Struts
saving form bean with Array of objects (collection)  Hi all... and captures data with checkbox. DisplayAction.java class populate my form bean... page. This page not only displays the Order's but also captures data from user
storing images in directory,saving path in db2
storing images in directory,saving path in db2  i am working in a web portal that makes a simple networking site. i want to store the profiles images in a folder and its path(relative/absolute) in my DB2 database. and when
Error in laodin and saving the image . - Swing AWT
Error in laodin and saving the image .  I am a student who had to submit their projects......so i am working on the Photo Editor Project. But i am facing problem while laoding and saving the image with help of JFileChooser class
java image loadin and saving problem - Swing AWT
java image loadin and saving problem  hey in this code i am trying to load a picture and save it.........but image is only visible whn we maximize the frame savin is nt done plzz help me with this code......... import
Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same
Java code for Saving Marathi (Indian local language ) in Mysql and retrieving... going to save the marathi data into mysql and trying to retrieving the same from java using eclipse but after saving it shows " ???? " in place of marathi words
how to upload multiple files in jsp and saving the path in database and the file in folder
how to upload multiple files in jsp and saving the path in database and the file in folder  how to upload multiple files in jsp and saving the path in database and the file in folder I have created a form for the upload of files
How to add save as dialoguebox to export into excel instead of directly saving..
How to add save as dialoguebox to export into excel instead of directly saving..  Hello Sir, i followed ur tutorial to export into excel from database and generated excel file at particular directory of my system
data
data  Handling data
data
data  data Handling AOP
data
data  Handling data in AOP
data
data handling examples in AOP Model  data handling examples in AOP Model
Servlet question of saving song from database to user's hard disk. - JSP-Servlet
Servlet question of saving song from database to user's hard disk.  I have a form with a list box containing list of songs i.e list of mp3 files.There is also a "Download" button in the form. When I click on that button a servlet
Develop user registration form
page and saving the data into the database. To store the data in the database... registration form which will insert  the entered  data into the database successfully with the help of a servlet. When submit button is clicked the data
importing data and edit that data
importing data and edit that data   hello sir i have data in excel sheet which contain 2 rows and i want to import that data to ms access and edit that data like adding new columns and new rows and creating new tables
Java file
Java file       Saving and loading data to the file is one of the important feature of many applications which requires the programmer to learn how to read from and write
User Registration Action Class and DAO code
(saving data into database). Developing Action Class The Action Class...;case of form submit Add/Update the data   ...;//Add the data   springHibernateDAO.addUser(pojoObj);  
Struts validation for j-query tabs data
Struts validation for j-query tabs data  Hi, I want apply struts validation for J-query tabs data while saving into database, can any body tell please
insert data
insert data  i've got a problem to insert my data to database.i can... and as well as the passed data from mulitpart/form-data is greater than or equal to 0...(request.getInputStream()); //we are taking the length of Content type data int formDataLength
data processing is
data processing is   data processing is   Data processing is associated with commercial work. Data processing is also referred as Information System. Data processing is basically used for analyzing, processing
data tyape
data tyape   please give me data type of Date
Advertisements
 

 

 

DMCA.com