Thursday, April 12, 2012

Session 0 - JDBC (Java Database Connectivity)

Now the web application is ready, lets create a database in MySQL and lets connect the database in Netbeans.

-> Click on the Services Tab, if you do not find it , click on windows and then click on services.
i have created a database named student into MySQL database, now lets see how to connect that into Netbeans.

->Right click on Databases,
->Click on New Connection,
->Choose Filed Entry from Data Input Mode,
->Choose Drivers from Driver Name Drop Down, (MySQL Connector/J Driver)
->Type host name in Host filed (localhost)
->Type port number on which MySQL service is running, (Generally it is 3306)
->Type the name of the database which you created in MySQL database (student in our case)
->Provide the username of the MySQL database server (Generally it is root)
->Provide the password which you entered while installing MySQL database (Generally it is root)
->Click on OK.




Session 0 - File Structure of a Web Application in Netbeans

->Web Pages
In the project windows, you will see the web pages directory where all the web pages are stored.
Inside the Web Pages, there is a folder named WEB-INF which contained web.xml file (Deployment Descriptor of the project).

->Source Packages
All the java files, servlets are stored in Source packages.

->Test Packages
All the java files which are used for testing purpose are stored in Test Packages Folder.

->Libraries
All the libraries are stored in the libraries folder, like JDK library, GlassFish library, MySQL connector library, etc.

->Test Libraries
All the test libraries like JUnit library, GlassFish test library are stored in Test Library Folder.

->Configuration Files
This is last folder which is created when you create the web project, this generally contains MANIFEST file and web.xml (Deployment Descriptor of the application)


Session 0 - Starting With Netbeans

Here we go for the first web application in Netbeans.
->Click on File
->New Project
->Choose Java Web from the category
->Choose Web Application from Projects Window
->Next
->Type the name of the Project in Project Name Windows
->Browse the location where you want to store the project in Project Location Windows
->Next
->Choose the Server on which you want to deploy the project (Generally Glassfish is already there when you install Netbeans)
->Choose the version of Java from Java EE Version drop down.
->Next
->Right now we will not choose any of the frameworks because it is a basic application.
->Finish.