
How to auto increment primary key in mysql... and one more thing i need to get auto increment value in front end each time for inserting the value[JSP].....

<%@page import="java.sql.*"%>
<%
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
Statement st = conn.createStatement();
ResultSet rs=st.executeQuery("SELECT id FROM user");
int id=0;
if(rs.last()){
id=rs.getInt("id")+1;
}
st.executeUpdate("insert into user(id,name,address) values("+id+",'rose','delhi')");
out.println("Data is inserted successfully");
}
catch(Exception e){}
%>

hello, this code by useing selvlet !! can you wite it in simple jsp ??! i try to writ it but there i couldn't !!!1
all the best,

i u using jsp you have to put code inside delimeters <% code %>