0

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>
2
Contributors
1
Reply
10
Views
3 Years
Discussion Span
Last Post by cool_zephyr
0

I hope this helps :

<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' onClick='f();'/></br>
</form>

<script>
    function f() {
        window.open('www.google.com','_blank');
        return true;
    }
</script>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.