raul8 0 Light Poster

In the code below, the updates are performing successfully, but the page is not redirecting

Please Check:

out.println("<html>");
out.println("<head>");
out.println("<script>");

out.println("function redirect()");
out.println("{");
out.println("window.location='EmpForm.jsp'");
out.println("}");

out.println("</script>");

out.println("</head>");
			
Class.forName("org.gjt.mm.mysql.Driver");
con = DriverManager.getConnection("jdbc:mysql://192.168.101.98:5501/TestNJ", "testnj","testnj");
			
st=con.createStatement();
query="UPDATE emp1 SET E_Name='"+EName+"',E_Address='"+Add+"',E_Dept='"+Dept+"' WHERE E_ID='"+EID+"'";
st.executeUpdate(query);
			
out.println("<body onload='redirect()'>");
out.println("</body></html>");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.