November 7, 2008 at 3:32 PM
This is Action code.
package javacode;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class InsertDataAction extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)throws
ServletException, IOException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
System.out.println("Insert data Example!");
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:
mysql://192.168.10.211:3306/";;
String db = "amar";
String userName = "amar";
String password = "amar123";
Connection con = null;
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);
try{
Statement st = con.createStatement();
String empname=request.getParameter("empname");
String midname =request.getParameter("midname");
String lastname =request.getParameter("lastname");
String address=request.getParameter("address");
String email =request.getParameter("email");
int val = st.executeUpdate("insert into empDetail(empname,midname,lastname,address,email) values('"+empname+"','"+midname+"','"+lastname+"','"+address+"','"+email+"')");
con.close();
out.println("success data insert into database");
}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}
}
}
---------------------
Related Tutorials/Questions & Answers:
Advertisements
how we can create website through javahow we can
create website through java Dear actually i wanna ask query about creation of
website through java then
how we can
create web site through java plz help me..........i have already a web site ....specially for premium
Create dynamic page through JSP how to
create
dynamic page. This code shows one by one record of student from...
Create dynamic page through
JSP..., application fetch next
record from database.
Create a database :
Before
Create Dynamic Table using HubernateCreate Dynamic Table using Hubernate Thank's for reading my Post. I...:
How to
create seperate table for all users they sign up for my web app. i need... files but i done
create and update for a single table. i dono
how to automate
How to Upload a Website? to design their own
website, to upload a
website for the internet audience is a matter... a self designed
website and upload it on the internet may sound simple but there are many aspects that you must know as for better performance of your
website Dynamic Website DesigningDynamic Website Designing
The
Dynamic sites differ from the static in terms... and appears when it is asked to access.
Dynamic website is quicker in uploading... of the pages.
We at Roseindia Tech. have a vast experience of
dynamic website designing
how to host a websitehow to host a website what are the steps to host a
website?????plz reply iam in need of it... r else tell me the
website address where i can get the idea
how to build a websitehow to build a website i hv developed i
dynamic web project using eclipse,now i want to convert this project into an one touch executable software .is it possible to do the same.?if anyone knows it plz help me out
how to insert value in dynamic tablehow to insert value in
dynamic table i am creating a project in Training and Placement.i have a created a company register part where i
create a
dynamic table for every company.but whenever i'm inserting values to the company
How to include website in google search?How to include
website in google search? Does anyone has idea about
how to include a
website into Google Search?
Visit the given Google
website link on
how to oiptimize or submit your
website to Google.
http
websitewebsite
How to paste data directly on any
website' text box
How to add dynamic table in javaHow to add
dynamic table in java
How to add
dynamic table in java
import java.awt.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.table.*;
public class
How to add nofollow in website link?How to add nofollow in
website link? Hi,
I want to add nofollow in my outgoing links. What is the code?
Thanks
Hi,
Here is the code:
<a rel="nofollow" href="http://">Click Here to visit</a>
how to create array in rhow to
create array in r Hi,
In R Programming
how array is created?
how to
create array in r?
Explain me the process of array creation using....
You can
create an array with the help of array keyword. Following is an example
websitewebsite i have uploaded
website .
website is woking properly in chrome & firefox but not in IE
websitewebsite design and coding of first page of any forum
website in jsp
HOW TO DO WEBSITE INTERFACE FOR JAVA MODULEHOW TO DO
WEBSITE INTERFACE FOR JAVA MODULE Hi , Greetings.
I... information etc. All these modules work fine in browser. I use JCreator.
How to place these modules into
website with selection button where when home button
how to store a dynamic values - JSP-Servlethow to store a
dynamic values Dear sir,
i have a ArrayList in that i have stored a values from a excel sheet specified column values and i have one string that is as follows
Dear ~2 ,
Your cl is ~3 ,el is ~4
How to embed a Javascript in your wordpress website?How to embed a Javascript in your wordpress
website? Hi, I own a wordpress
website that offers a wide range of premium accounts of allmajor File..., Megaupload, etc. And now I want to insert a javascript into my wordpress
website