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



Home Answers Viewqa WebSevices Insert Operation
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Venkat
Insert Operation
3 Answer(s)      6 years and 2 months ago
Posted in : WebSevices



Advertisement
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: Insert data into database Thanks
Search operation in JSP page
Search operation in JSP page  How to perform search in jsp with MYSQL database plz help me
search operation - Java Beginners
search operation  how to retrive all the similar elements (search operation ) on xml document using regular expressions
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  
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
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
Mysql Time Operation
Mysql Time Operation       Mysql Time Operation performs the subtraction and addition of time. Understand with Example The Tutorial illustrate an example from Mysql Time Operation
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
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
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
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
Using JOINING Operation in JDBC
Using JOINING Operation in JDBC    Whenever we need to select data from two or more tables, we have to perform a join operation. Tables in a database can be related to each other with keys
how to do CRUDE operation in iphone?-RV
how to do CRUDE operation in iphone?-RV  .h file #import <... = "insert into photo_table(photo_name,photo_date) Values...); if (success == SQLITE_ERROR) { NSAssert1(0, @"Error: failed to insert
Mysql Insert
Mysql Insert       Mysql Insert is used to insert the records or rows to the table. Understand with Example The Tutorial illustrate an example from 'Mysql Insert'.To grasp
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
java.sql.SQLException: Operation not allowed after ResultSet closed
java.sql.SQLException: Operation not allowed after ResultSet closed  package processing; import java.io.; import java.math.BigDecimal; import java.sql.; import java.util.*; public class Processing { public static void
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
Join tables with the NATURAL RIGHT JOIN operation
Join tables with the NATURAL RIGHT JOIN operation... the NATURAL RIGHT JOIN operation of table in a specific database. This operation join... the tables through the NATURAL RIGHT JOIN operation. See detail information given
Join tables with the NATURAL LEFT JOIN operation
Join tables with the NATURAL LEFT JOIN operation  ... operation and how to retrieve data through it. In this operation we are going... JOIN: In this operation both tables are merged to each other according to common
insert code jsp to access
insert code jsp to access   insert code jsp to access
Setting the close button operation for the frame in Java
Setting the close button operation for the frame in Java       Introduction In this section, you... automatically. The close button of the frame has to be set for the desired operation (i.e.
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
 

 

 

DMCA.com