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>

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>
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.