there is a simple code but i want when i click submit then ther should open google.com(like any web) in another tab and in the same page there should be one another page. How can i do this..
a sample code is..
<%@ page import = "java.sql.*" %>
<%
String firstName = request.getParameter("firstName");
String lastName = request.getParameter("lastName");
String userName = request.getParameter("userName");
String password = request.getParameter("password");
if(firstName != null && lastName != null && userName != null && password != null)
String sql = "insert into users values('"+firstName+"','"+lastName+"','"+userName+"','"+password+"')";
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(ClassNotFoundException ex)
{
ex.printStackTrace();
}
Connection con = null;
Statement stmt = null;
try
{
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system", "great123");
stmt = con.createStatement();
stmt.executeUpdate(sql);
}
catch(SQLException ex)
{
ex.printStackTrace();
}
finally
{
con.close();
stmt.close();
}
response.sendRedirect("regscs.jsp");
}
%>
<form>
First Name:
<input type = 'text' name = 'firstName'/></br>
Last Name:
<input type = 'text' name = 'lastName'/></br>
Username
<input type = 'text' name = 'userName'/></br>
Password:
<input type = 'password' name = 'password'/></br>
<input type = 'submit' value = 'View'/></br>
</form>