#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    19
    Rep Power
    0

    Connection to server using another jsp page


    Currently, i have hardcoded the server connection in every page and is very tedious if there are any changes to it.

    Therefore, i need to know how to connect to the server by calling up a page that contains the server information.

    The coding i have now is:

    String connectionURL = "jdbc:mysql://servername/databaseName?user=username to enter the server & password=password to enter the server";
    Connection connection = null;
    Statement statement = null;
    ResultSet rs = null;

    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    connection = DriverManager.getConnection(connectionURL, "", "");
    statement = connection.createStatement();



    pls help....
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Posts
    16
    Rep Power
    0
    You can use the <%@ include file="" %> tag to include a file into your jsp's. Take whatever code you have duplicated in many jsp files, put it in a single file, and then replace the code in your pages with the include tag.
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    19
    Rep Power
    0

    Thanks


    Thanks preaney for ur help....
    i have another question, it is to display retrieved data in certain number of rows.

    if possible, pls help....

IMN logo majestic logo threadwatch logo seochat tools logo