1.form.html
<html> <form method="post" action="http://localhost:8080/examples/jsp/insert.jsp"> <table> <tr><td>Name:</td><td><input type="text" name="name"></td></tr> <tr><td>Address:</td><td><input type="text" name="address"></td></tr> <tr><td></td><td><input type="submit" value="Submit"></td></tr> </table> </form> </html>
see how to store file in xampp http://thenewcreator.blogspot.in/2013/04/how-to-run-jsp-program-in-xampp.html?q=xampp
2)insert.jsp:<%@page import="java.sql.*"%><% String name=request.getParameter("name"); String address=request.getParameter("address"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:student"); Statement st=con.createStatement(); int i=st.executeUpdate("insert into user(name,address) values('"+name+"','"+address+"')"); out.println("Data is inserted successfully"); %>
------------------------------------------------------------------------------
explanation
("jdbc:odbc:student") here student is DSN
<br>
insert into user(name,address) values('"+name+"','"+address+"') here user is table
<br>
name,address is attribute