Java-Business-Application/C2/Creating-a-Java-web-project/English-timed

From Script | Spoken-Tutorial
Revision as of 21:09, 13 June 2015 by Sandhya.np14 (Talk | contribs)

Jump to: navigation, search
Time Narration
00:00 Welcome to the spoken-tutorial on Creating a Java Web Project.
00:06 In this tutorial, we will learn:
00:09 * to create a Java Web Project
00:12 * About Deployment Descriptor
00:15 * About web.xml file.
00:19 Here we are using:
00:20 Ubuntu Version 12.04
00:23 Netbeans IDE 7.3
00:26 JDK 1.7
00:28 Firefox web-browser 21.0
00:32 You can use any web-browser of your choice.
00:35 To follow this tutorial, you must have knowledge of:
00:39 Core Java using Netbeans IDE and
00:42 HTML.
00:44 If not, for relevant tutorials please visit our website.
00:50 Now, let us see how to create a simple Java Web Project using Netbeans IDE.
00:56 For this, we will switch to Netbeans IDE.
01:01 On the top left corner of the IDE, Click on File and click on New Project.
01:08 A New Project window opens up.
01:12 From the Categories, choose Java Web and from the Projects choose Web Application.
01:18 Then click on Next.
01:20 On the next window that opens
01:23 type the Project Name as MyFirstProject.
01:27 Leave the Project location and project folder as it is.
01:31 Then, click on Next.
01:35 Select GlassFish server as the Server.
01:39 Note that Context Path here is MyFirstProject, this is the same name as our Project.
01:47 We will learn about this in detail.
01:50 Now, click on Next and then click on Finish.
01:55 Click on the Projects tab.
01:58 We can see there are several nodes here and a web application named My First Project has been created.
02:08 Now, We are not concerned about all of these nodes right now.
02:11 But let me click and show you, what it contains.
02:16 Now let us learn about what is known as Deployment Descriptor.
02:21 A web application’s deployment descriptor describes
02:25 the classes, resources and configuration of the application and
02:31 how the web server uses them to serve web requests.
02:37 The web server receives a request for the application.
02:42 It uses deployment descriptor to map the URL of the request.
02:48 It maps the URL to the code that has to handle the request.
02:52 The deployment descriptor is a file named web.xml.
02:57 Now let us come back to the IDE.
03:00 We are not able to find the web.xml file from the nodes available here.
03:07 To locate it, at the top left of the IDE, click on File, and then click on New File.
03:16 From the Categories, choose Web.
03:19 And from the File Types, choose Standard Deployment Descriptor(web.xml).
03:25 Then click on Next.
03:27 And click on Finish.
03:30 Click on the Files tab on the left hand side of the IDE.
03:34 Note that web.xml is visible under the WEB-INFfolder of the Web node.
03:42 You can see the source code now.
03:46 We have an xml header here.
03:50 We also have a web-app node.
03:53 Now, we shall try running the application.
03:57 To do so, right click on MyFirstProject.
04:02 Click on Clean and Build.
04:04 This will delete any previously compiled files and other build outputs.
04:10 It will also recompile the application.
04:14 Again, right click on MyFirstProject and then click on Run.
04:20 So the server is up and running and it has deploy My first Project.
04:27 A browser window opens up and displays Hello World .
04:32 This is because when we run the project, the web application renders the page shown.
04:39 Now, let’s have a look at the URL here that rendered the page.
04:44 It is localhost colon 8080 slash MyFirstProject.
04:49 So, when we run MyFirstProject by default we get a JSP page that says HelloWorld!
04:57 Now, let us come back to our IDE.
05:00 We can see that under the WEB-INF folder there is index.jsp.
05:07 Double click on index.jsp.
05:10 We can see the source code here.
05:12 It is a simple JSP page with HTML tags only.
05:17 It has the title JSP Page and it has the heading Hello World.
05:24 The server provides index.jsp by default when we run the web application.
05:30 Recall that we had come across something called ContextPath earlier.
05:36 We had set the ContextPath as MyFirstProject itself.
05:41 Now, come back to the browser.
05:44 Type the URL as localhost colon 8080. and press Enter.
05:50 We see that the home page of Glassfish server is displayed.
05:56 Here, 8080 is the default course at which the server runs on the machine.
06:01 This Glassfish server instance may have many applications running on it.
06:08 To access a particular application, type that application name in the URL.
06:15 So, we must type the specific application that has been deployed on that instance.
06:21 So we will type slash MyFirstProject .
06:26 And Press Enter.
06:27 So we see Hello World displayed.
06:31 Let us summarize.
06:32 In this tutorial we have learnt:
06:35 * To create a simple Java Web project
06:38 * Execute the web project
06:41 * and about the web.xml file.
06:44 To know more about this spoken tutorial project,
06:46 watch the video available at the following link.
06:50 It summarizes the Spoken Tutorial project.
06:54 If you do not have good bandwidth, you can download and watch it.
06:58 The Spoken Tutorial Project Team:
07:00 Conducts workshops using spoken tutorials
07:04 Gives certificates for those who pass an online test.
07:07 For more details, please write to: contact at spoken hyphen tutorial dot org.
07:13 Spoken Tutorial Project is a part of the "Talk to a Teacher project".
07:17 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
07:23 More information on this mission is available at-
07:27 http://spoken-tutorial.org/NMEICT- Intro
07:34 The Library Management System has been contributed by a leading software MNC, through their Corporate Social Responsibility program.
07:44 They have also validated the content for this spoken tutorial.
07:48 This is Arya Ratish from IIT Bombay, signing off.

Thank you for joining.

Contributors and Content Editors

PoojaMoolya, Pratik kamble, Sandhya.np14