Results 1 to 2 of 2
  1. #1
    kiz106 is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default Java code that connects one form to the other form.

    Am using the NetBeans IDE for my project.Can any one help me with that java statement(code) that forwards/calls upon the next form.I have two forms i.e Login(login.java) and Details(Details.java),what I want is to connect from Login.java to Details.java my next form.
    Have a Look at my code and advance me accordingly.
    Thanks In ADVANCE.

    private void btnSubmitActionPerformed(java.awt.event.ActionEven t evt) {

    try {

    String username = "username";
    String password = "password";


    if (rs.next()) {

    if (username.isEmpty() || password == null);
    {
    System.out.println("Write a Correct UserName and Password");
    }

    if ((!(username.equals("null")) && password.equals(rs.getString("password")))
    && (!(password.equals("null")) && username.equals(rs.getString("username")))) {
    System.out.println("Login Successful");

    String driver = "org.apache.derby.ClientDriver";
    String url = "jdbc:derby://localhost:1527/sample";
    String uName = "app";
    String uPass = "app";
    con = DriverManager.getConnection(url, username, password);
    con.close();
    rs.close();

    }
    }
    } catch (SQLException err) {
    System.out.println(err.getMessage());
    }
    response.sendRedirect("Details.java");

    }

  2. #2
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    First of your method declaration is wrong-- spaces with t
    --> where are you getting the user name and password from
    -->response.sendRedirect()-- does swing use it? i doubt
    --> if you developing a swing application then use child dialog
    Connecting Java with MS-Access - Inserting data in - JDBC (Java Database Connectivity) Source Code in Java
    -->if u r using web application, ...> confirm it. i will make a page for u

Similar Threads

  1. Replies: 1
    Last Post: 03-22-2010, 10:03 AM
  2. Replies: 0
    Last Post: 10-31-2009, 10:24 AM
  3. Dynamic fields in form using Form Bean
    By janu.c in forum Java Software
    Replies: 1
    Last Post: 09-23-2009, 05:26 AM
  4. Replies: 10
    Last Post: 08-12-2009, 05:02 PM
  5. Replies: 6
    Last Post: 11-28-2008, 07:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •