Today you are going to learn simple update query in jsp page
Using Query in jsp page needs certain modifications See the simple code below you can able to update the values in jsp page.Here i have assigned the values to be updated next tutorial we can update using parameter.
<%@ page import="java.sql.*"%>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/way2start","root","root");
Statement st=con.createStatement();
Statement st1=con.createStatement();
String two="sample3";
st.executeUpdate("update one set name='"+two+"' where (name='sample1')");
ResultSet rs=st1.executeQuery("select * from one");
while(rs.next())
{
out.println("<html>");
out.println("<body>");
out.println("<table bgcolor='green'>");
out.println("<tr>");
out.println("<td>");
out.println(rs.getString(1));
out.println("</td>");
out.println("</tr>");
out.println("</table>");
out.println("</body>");
out.println("</html>");
}
%>
Tutorial Provided by In order to view links, you must have to reply to this thread. Visit for More Tutorials
Any doubt ask us.
Happy coding