Insert Operation

Insert Operation

View Answers

September 30, 2008 at 4:38 PM

Hi friend,


As per your requirement code to solve your problem :

Some points remmeber :

1.Create a file "home.jsp" having a button "Add Employee"
2.After click on button pop up window "insertrecord.jsp".
3.On pop up window having a form if record insert successfully
prints a message "Record insert successfully".

"home.jsp"

<HTML>
<head>

</head>
<BODY BGCOLOR="LIGHTYELLOW">
<FORM NAME="form" METHOD="GET" ACTION="process.jsp">
<br><br>

<H3> <P ALIGN="CENTER"> <FONT SIZE=6> EMPLOYEE DETAILS </FONT> </P> </H3>
<BR>
<BR>
<TABLE CELLSPACING=5 CELLPADDING=5 BGCOLOR="LIGHTBLUE" COLSPAN=2 ROWSPAN=2 ALIGN="CENTER">
<TR>
<TD> <INPUT TYPE="button" NAME="s1" VALUE="Add Employee" onClick="window.open('insertrecord.jsp','mywindow','width=500,height=350,toolbar=no,resizable=yes,menubar=yes')">
</FONT> </TD>
</TR>
</TR> </FONT>

</FORM>
</BODY>
</HTML>

"insertrecord.jsp"

<%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<%
String employee_name="";
String email="";

if(request.getParameter("employee_name")!=null && request.getParameter("employee_name")!="")
{
employee_name = request.getParameter("employee_name").toString();
email = request.getParameter("email").toString();

Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "userdetails";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";

int sumcount=0;
Statement st;
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
String query = "insert into employee set employee_name='"+employee_name+"',email='"+email+"'";
st = conn.createStatement();
int i = st.executeUpdate(query);
if(i>0)
{
out.println("insert successfully");
}
}
catch (Exception e) {
e.printStackTrace();
}
}
%>
<form>
<table>
<tr><td>Name</td><td><input type="text" name="employee_name"></td></tr>
<tr><td>Email</td><td><input type="text" name="email"></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" name="submit" value="Submit"></td></tr>
</table>
</form>
</BODY>
</HTML>


For read more in details examples on "Pop Up Window" in jsp to visit....

http://www.roseindia.net/jsp/pop-window.shtml

http://www.roseindia.net/jsp/popup-window-using-ajax-in-jsp.shtml

Thanks





September 30, 2008 at 4:39 PM

"home.jsp"

<HTML>
<head>

</head>
<BODY BGCOLOR="LIGHTYELLOW">
<FORM NAME="form" METHOD="GET" ACTION="process.jsp">
<br><br>

<H3> <P ALIGN="CENTER"> <FONT SIZE=6> EMPLOYEE DETAILS </FONT> </P> </H3>
<BR>
<BR>
<TABLE CELLSPACING=5 CELLPADDING=5 BGCOLOR="LIGHTBLUE" COLSPAN=2 ROWSPAN=2 ALIGN="CENTER">
<TR>
<TD> <INPUT TYPE="button" NAME="s1" VALUE="Add Employee" onClick="window.open('insertrecord.jsp','mywindow','width=500,height=350,toolbar=no,resizable=yes,menubar=yes')">
</FONT> </TD>
</TR>
</TR> </FONT>

</FORM>
</BODY>
</HTML>

Thanks

September 30, 2008 at 4:47 PM

Replace " __LongTerm__" :
with
onClick="window.open('insertrecord.jsp','mywindow','width=500,height=350,toolbar=no,resizable=yes,menubar=yes')">

Thanks









Related Tutorials/Questions & Answers:
Insert Operation Error - WebSevices
Insert Operation Error  Hai, How i store my full resume in database[Mysql] using PHP. Any one Know the code..... Help me
Insert Operation - WebSevices
Insert Operation  Send the code for Insert Contact in pop up window... insert my contact details(Name,email and etc).So,send the code and solution... pop up window having a form if record insert successfully prints a message
Advertisements
insert
insert  insert data in database from servlet through JDBC   Ho Friend, Please visit the following:ADS_TO_REPLACE_1 Insert data into database Thanks
search operation - Java Beginners
search operation  how to retrive all the similar elements (search operation ) on xml document using regular expressions
Search operation in JSP page
Search operation in JSP page  How to perform search in jsp with MYSQL database plz help me
login/logout operation
login/logout operation  how to do log in/out operations in jsp plz kindly send the steps leing behind this operation  
Java code for buffer operation...!!!
Java code for buffer operation...!!!  Implement a buffer operation using character array, storing last 100 characters inserted by user. Make method to get and retrieve???   The given code accepts the characters from
login/logout operation
login/logout operation  how to do log in/out operations in jsp plz kindly send the steps leing behind this operation  
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project for the Dispatch section of my office. I have to search for letters that are dispatched on a particular date. Now there are thousands of letters dispatched on a particular
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project for the Dispatch section of my office. I have to search for letters that are dispatched on a particular date. Now there are thousands of letters dispatched on a particular
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project for the Dispatch section of my office. I have to search for letters that are dispatched on a particular date. Now there are thousands of letters dispatched on a particular
arithmetic operation on float number
arithmetic operation on float number  hi here is my code class divs { public static void main(String args[]) { double dub=14.2f,dou; int num; num=(int)dub; dou=dub-num
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project for the Dispatch section of my office. I have to search for letters that are dispatched on a particular date. Now there are thousands of letters dispatched on a particular
ModuleNotFoundError: No module named 'kser-operation'
ModuleNotFoundError: No module named 'kser-operation'  Hi, My... named 'kser-operation' How to remove the ModuleNotFoundError: No module named 'kser-operation' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Operation-Pluto'
ModuleNotFoundError: No module named 'Operation-Pluto'  Hi, My... named 'Operation-Pluto' How to remove the ModuleNotFoundError: No module named 'Operation-Pluto' error? Thanks   Hi, In your python
trigger after insert for deletion
trigger after insert for deletion   String query2 = "create TRIGGER trig after insert on "cart" + " FOR EACH ROW... = st1.executeUpdate( query2); i have to do the above trigger operation, but i'm stuck
DB Insert
DB Insert  How to insert XML data into a database column? Column data type is CLOB
jdbc insert
jdbc insert  Hi , i want to insert a declared integer variable into a mysql table through jdbc. how to insert that. help me with query... thanks... a table there. After creating a table in database, it insert a rows in the database
Mysql Time Operation
Mysql Time Operation       Mysql Time Operation performs the subtraction and addition of time... Time Operation. To understand an example from Time Operation , we use keyword
Mysql Insert
Mysql Insert       Mysql Insert is used to insert the records or rows to the table. Understand with ExampleADS_TO_REPLACE_1 The Tutorial illustrate an example from 'Mysql Insert
insert data
insert data  i've got a problem to insert my data to database.i can upload my multipart file but not text data.Please help me to solve this .Attached...("insert into images values(?,?,?,?,?)"); st.setString(2
insert code jsp to access
insert code jsp to access   insert code jsp to access
ModuleNotFoundError: No module named 'crawler_operation_for_youguowang'
ModuleNotFoundError: No module named 'crawler_operation_for_youguowang' ...: ModuleNotFoundError: No module named 'crawler_operation_for_youguowang' How to remove the ModuleNotFoundError: No module named 'crawler_operation_for_youguowang'
ModuleNotFoundError: No module named 'odoo13-addon-mass-operation-abstract'
ModuleNotFoundError: No module named 'odoo13-addon-mass-operation-abstract...: ModuleNotFoundError: No module named 'odoo13-addon-mass-operation-abstract' How to remove the ModuleNotFoundError: No module named 'odoo13-addon-mass-operation
ModuleNotFoundError: No module named 'odoo8-addon-stock-traceability-operation'
ModuleNotFoundError: No module named 'odoo8-addon-stock-traceability-operation...: ModuleNotFoundError: No module named 'odoo8-addon-stock-traceability-operation' How...-traceability-operation' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'odoo9-addon-account-operation-rule'
ModuleNotFoundError: No module named 'odoo9-addon-account-operation-rule' ...: ModuleNotFoundError: No module named 'odoo9-addon-account-operation-rule' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-account-operation-rule
ModuleNotFoundError: No module named 'pod-user-operation'
ModuleNotFoundError: No module named 'pod-user-operation'  Hi, My... named 'pod-user-operation' How to remove the ModuleNotFoundError: No module named 'pod-user-operation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'crawler_operation_for_youguowang'
ModuleNotFoundError: No module named 'crawler_operation_for_youguowang' ...: ModuleNotFoundError: No module named 'crawler_operation_for_youguowang' How to remove the ModuleNotFoundError: No module named 'crawler_operation_for_youguowang'
The INSERT INTO Statement, SQL Tutorial
The INSERT INTO Statement       The INSERT INTO statement is used to insert or add a record of data into the table. To insert records into a table, just write the key word
The INSERT INTO Statements in SQL?
The INSERT INTO Statements in SQL?  The INSERT INTO Statements in SQL?   Hi, The INSERT INTO statement is used to insert a new row or multiple rows into a table.ADS_TO_REPLACE_1 SQL INSERT INTO Syntax INSERT
insert images into a Mysql database
insert images into a Mysql database  How can I insert images into a Mysql database
how to insert image into server
how to insert image into server  how to insert an image into sql server and retrieve it using jSP
insert and delete a row programmatically
insert and delete a row programmatically  How to insert and delete a row programmatically ? (new feature in JDBC 2.0
how to insert check box
how to insert check box   how to insert check box into jtable row in swing
jtable insert row swing
jtable insert row swing  How to insert and refresh row in JTable?   Inserting Rows in a JTable example
single query to insert the data
single query to insert the data  How to insert data for all HTML fields in single MYSQL query
insert query in jsp
insert query in jsp  give me insert code in jsp at run time
insert multiple selection - Java
insert multiple selection - Java  how to insert multiple selection values from html into database using servlets
Push and Pop operation of stack.
Description: In this tutorial of data-structure you will see push and pop operation of stack. In the previous tutorial is clearly explained the push pop operation. The drawback of implementing stack is that the size of stack
The INSERT INTO Statement
The INSERT INTO Statement       The INSERT INTO statement is used to insert or add a record of data into the table. To insert records into a table, just write the key word
Create After Insert Trigger in SQL
Create After Insert Trigger in SQL   ... illustrate a example from 'Create After Insert Trigger in SQL'. In this Example..._id VARCHAR(15), description VARCHAR(100)); Create Trigger Stu_Insert
insert query in mysql
insert query in mysql  insert query in mysql not working   [INSERT INTO Birthdays(firstname, lastname, birthday, group) VALUES('Sam','Smith','June','Junior
insert and delete data in database
insert and delete data in database  insert and delete data in database from servlets through JDBC   Hi Friend, Please visit the following links:ADS_TO_REPLACE_1 Insert Data Delete Data ThanksADS_TO_REPLACE_2
insert image using hibernate
insert image using hibernate  Sir, Today I hadposted question regarding upload image, th answer you had given is using SQL, but I am using Hibernate to insert data in the same table where I want to insert image. Plz hlp me
hibernate insert image
hibernate insert image  Sir, Today I hadposted question regarding upload image, th answer you had given is using SQL, but I am using Hibernate to insert data in the same table where I want to insert image. Plz hlp me. Thanks
Html+jsp+database is enough to do the small operation
Html+jsp+database is enough to do the small operation  Hai , If u want to do simple insetion and data retrival operation throw jsp ?.you need... result = null; Statement stmt = null; String Query=" INSERT
Mysql Trigger After Insert
insert trigger'  fired the trigger after you performed a insert operation... Mysql Trigger After Insert       Mysql Trigger After Insert fired the trigger after you
Difference between Normal Insert and BLOB insert
Difference between Normal Insert and BLOB insert  I have sql database...), DisplayImage (image). Table has 2 rows for first row i have written insert into Image values(1,'Libraries\Pictures\Lotus.jpg') and 2nd row as INSERT INTO [dbo
Calendar Operation
Struts insert & retrieve
Struts insert & retrieve  Give a struts prg to insert and retrieve data from mysql db using the struts tags(no jsp scriplets and expressions) following mvc arch. i.e. model containing db connectivity, form containing get &

Ads