1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

URGENT JAVA HELP NEEDED A question to all you Java coders

Discussion in 'Other Languages' started by kelso, Mar 24, 2015.

Tags:
  1. kelso

    kelso Regular Member

    Joined:
    Nov 30, 2009
    Messages:
    477
    Likes Received:
    276
    A friend needs some java help and as he is not a member of BHW and does not know anything about it so I reckoned I?d try to help him by sourcing some advice from here.

    So the task in hand is (so I?ve been told) pretty simple:

    There?s a mySql database with 2 columns: cars and pictures.
    In netbeans we have a class connector with which we are making a connection to the database.
    He?s made a simple GUI (JFrame) with 2 buttons.
    He wants 1 of the buttons to fetch car1 with picture1 and the other to fetch all cars with their appropriate pictures.

    So the question is: what code should he add to those buttons so that they would fetch and display that data?
     
  2. bartosimpsonio

    bartosimpsonio Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 21, 2013
    Messages:
    12,476
    Likes Received:
    11,180
    Occupation:
    CHEAP
    Location:
    DATASETS
    Home Page:
  3. kelso

    kelso Regular Member

    Joined:
    Nov 30, 2009
    Messages:
    477
    Likes Received:
    276
    So my friend managed to get to a point where he wanted. Thanks bartosimpsonio for the try, and thanks to the others that contacted me and chimed in to help (not in the thread apparently).

    So now I have another question on his behalf:

    How to deploy an application in a web server?
    He made an application in netbeans which reads from a database and shows the result in UI. When he secelts to deploy the project in a glassfish server what happens next is that localhost:8080/myapp opens but it only says "TODO write content".

    In the project he has a file index.html with the following contents:

    <html>
    <head>
    <title>TODO supply a title</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
    <div>TODO write content</div>
    </body>
    </html>

    And apparently his browser displays only this: <div>TODO write content</div>

    So the question now is: How to upload the whole application on the server?

    I hope I've paraphrased him correctly but I think that someone who understands thiss will know what I mean. Is it something that needs to be added to that index.html so that it connects to the application or what idk...

    He wrote a lot of code to make this app - that shows users and pics. Now he needs to display it in a browser and for that purpose he needs to deploy it on a server. BUT when he opts to deploy it it only shows that body part from that html and the program is nowhere to be seen...
     
  4. spurge0n

    spurge0n Junior Member

    Joined:
    Mar 27, 2014
    Messages:
    162
    Likes Received:
    43
    Gender:
    Male
    Need to assemble it into a war file. I use eclipse not net beans so I can't help you much more.
     
    • Thanks Thanks x 1
  5. kelso

    kelso Regular Member

    Joined:
    Nov 30, 2009
    Messages:
    477
    Likes Received:
    276
    Thanks a lot for the input! Also could you shed some light and details about the war file necessity? Thanks again!

    Anyone else?
     
    Last edited: Apr 6, 2015