Difference between revisions of "Java-Business-Application/C2/Creating-a-Java-web-project/English-timed"
From Script | Spoken-Tutorial
PoojaMoolya (Talk | contribs) |
|||
(12 intermediate revisions by one other user not shown) | |||
Line 5: | Line 5: | ||
|- | |- | ||
| 00:00 | | 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''' | + | |About '''Deployment Descriptor''' |
|- | |- | ||
− | | | + | |00:15 |
− | | | + | |About '''web.xml''' file. |
|- | |- | ||
| 00:19 | | 00:19 | ||
− | | Here we are using | + | | Here we are using:'''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. | |
− | + | ||
− | + | ||
− | + | ||
− | |You can use any web-browser of your choice | + | |
|- | |- | ||
| 00:35 | | 00:35 | ||
− | | To follow this tutorial you must have knowledge of | + | |To follow this tutorial, you must have knowledge of: |
|- | |- | ||
− | | | + | |00:39 |
− | | '''Core Java''' using '''Netbeans IDE''' and | + | |'''Core Java''' using '''Netbeans IDE''' and |
|- | |- | ||
− | | | + | |00:42 |
− | | '''HTML''' | + | |'''HTML'''. |
|- | |- | ||
− | | | + | | 00:44 |
| If not, for relevant tutorials please visit our website. | | 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 | | 00:56 | ||
− | | For this we will switch to ''' | + | | For this, we will switch to '''NetBeans IDE'''. |
|- | |- | ||
| 01:01 | | 01:01 | ||
− | | On the top left corner of the IDE, | + | | On the top left corner of the IDE, click on '''File '''and click on '''New Project.''' |
|- | |- | ||
Line 81: | Line 77: | ||
|- | |- | ||
|01:12 | |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 | + | | On the next '''window''' that opens, |
|- | |- | ||
|01:23 | |01:23 | ||
− | | | + | | type the '''Project Name '''as '''MyFirstProject.''' |
|- | |- | ||
| 01:27 | | 01:27 | ||
− | | Leave the '''Project location''' and ''' | + | | 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. | | 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 '''node'''s here and a '''web application''' named '''My First Project''' has been created. |
|- | |- | ||
− | | | + | |02:08 |
− | | | + | |Now, we are not concerned about all of these '''node'''s 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.''' | + | |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'''. | | The '''deployment descriptor''' is a file named '''web.xml'''. | ||
|- | |- | ||
− | | | + | | 02:57 |
− | |Now let us come back to the '''IDE.''' | + | |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 | | 03:07 | ||
− | | | + | | To locate it, at the top left of the '''IDE''', click on '''File''' and then click on '''New File'''. |
|- | |- | ||
| 03:16 | | 03:16 | ||
− | | | + | | From the '''Categories''', choose '''Web.''' |
|- | |- | ||
| 03:19 | | 03:19 | ||
− | | | + | | And from the '''File Types, ''' choose '''Standard Deployment Descriptor (web.xml).''' |
|- | |- | ||
− | | | + | | 03:25 |
− | | | + | | Then click on '''Next''' |
|- | |- | ||
| 03:27 | | 03:27 | ||
− | | | + | | and click on '''Finish.''' |
|- | |- | ||
Line 201: | Line 197: | ||
|- | |- | ||
| 03:34 | | 03:34 | ||
− | | Note that '''web.xml '''is visible under the '''WEB-INF'''folder of the '''Web''' | + | | Note that '''web.xml '''is visible under the '''WEB-INF''' folder of the ''''Web' node'''. |
|- | |- | ||
| 03:42 | | 03:42 | ||
− | | You can see the ''' | + | | You can see the '''source-code''' now. |
|- | |- | ||
| 03:46 | | 03:46 | ||
− | | | + | | We have an '''xml''' '''header''' here. |
|- | |- | ||
| 03:50 | | 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 | | 04:02 | ||
− | | | + | | Click on '''Clean and Build.''' |
|- | |- | ||
− | | | + | | 04:04 |
− | | This will delete any previously compiled files and other build outputs. | + | | This will delete any previously compiled files and other '''build outputs'''. |
|- | |- | ||
| 04:10 | | 04:10 | ||
− | | It will also recompile the application. | + | | It will also recompile the '''application'''. |
|- | |- | ||
Line 241: | Line 237: | ||
|- | |- | ||
|04:20 | |04:20 | ||
− | | So the server is up and running and it has | + | | So, the server is up and running and it has deployed '''My first Project'''. |
|- | |- | ||
|04:27 | |04:27 | ||
− | | A browser | + | | 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 | | 05:07 | ||
− | | | + | | Double click on '''index.jsp'''. |
|- | |- | ||
− | | | + | | 05:10 |
− | | | + | | We can see the '''source code''' here. |
|- | |- | ||
Line 285: | Line 281: | ||
|- | |- | ||
| 05:17 | | 05:17 | ||
− | | It has the title ''' JSP Page | + | | It has the '''title''' "JSP Page" and it has the heading "Hello World". |
|- | |- | ||
| 05:24 | | 05:24 | ||
− | | The server provides '''index.jsp '''by default when we run the web application. | + | | The server provides '''index.jsp '''by default when we '''run''' the '''web application'''. |
|- | |- | ||
Line 301: | Line 297: | ||
|- | |- | ||
| 05:41 | | 05:41 | ||
− | |Now, come back to the browser | + | |Now, come back to the browser. |
|- | |- | ||
| 05:44 | | 05:44 | ||
− | | Type the ''' URL ''' as '''localhost''''' colon '''''8080 | + | | Type the ''' URL ''' as '''localhost''' ''colon'' '''8080''' and press '''Enter'''. |
|- | |- | ||
| 05:50 | | 05:50 | ||
− | | We see | + | | We see the '''Home page''' of '''Glassfish Server '''is displayed. |
|- | |- | ||
| 05:56 | | 05:56 | ||
− | |Here '''8080''' is the default | + | |Here, '''8080''' is the default port at which the server runs on the machine. |
|- | |- | ||
| 06:01 | | 06:01 | ||
− | | This '''Glassfish | + | | This '''Glassfish Server''' '''instance''' may have many '''applications''' '''run'''ning on it. |
|- | |- | ||
| 06:08 | | 06:08 | ||
− | | To access a particular application type that application name in the '''URL'''. | + | | To access a particular '''application''', type that application-name in the '''URL'''. |
|- | |- | ||
| 06:15 | | 06:15 | ||
− | | So,we must type the specific application that has been deployed on that instance. | + | | So, we must type the specific '''application''' that has been deployed on that '''instance'''. |
|- | |- | ||
| 06:21 | | 06:21 | ||
− | | So we will type ''' slash MyFirstProject '''. | + | | So, we will type ''' slash MyFirstProject '''. |
|- | |- | ||
| 06:26 | | 06:26 | ||
− | | And | + | | And press '''Enter.''' So, we see '''Hello World!''' displayed. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | | | + | | 06:31 |
− | | In this tutorial we have learnt | + | | Let us summarize.In this tutorial we have learnt: |
|- | |- | ||
− | | | + | | 06:35 |
− | | | + | | To create a simple '''Java Web project''' |
|- | |- | ||
− | | | + | |06:38 |
− | | Execute the '''web''' project | + | |Execute the '''web''' project |
|- | |- | ||
− | | | + | |06:41 |
− | | | + | |and about the '''web.xml''' file. |
|- | |- | ||
| 06:44 | | 06:44 | ||
− | | To know more about this spoken tutorial project | + | | To know more about this '''spoken tutorial''' project, |
|- | |- | ||
| 06:46 | | 06:46 | ||
− | | | + | |watch the video available at the following link. |
|- | |- | ||
| 06:50 | | 06:50 | ||
− | | It summarizes the Spoken Tutorial project | + | | It summarizes the Spoken Tutorial project. |
|- | |- | ||
− | | | + | | 06:54 |
− | | If you do not have good bandwidth, you can download and watch it | + | | If you do not have good bandwidth, you can download and watch it. |
|- | |- | ||
|06:58 | |06:58 | ||
− | | The Spoken Tutorial Project Team | + | | The Spoken Tutorial Project Team: |
|- | |- | ||
− | | | + | |07:00 |
− | | Conducts workshops using spoken tutorials | + | | 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 | + | | For more details, please write to: contact at spoken hyphen tutorial dot org. |
|- | |- | ||
|07:13 | |07:13 | ||
− | | Spoken Tutorial Project is a part of the Talk to a Teacher project | + | |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 | + | |07:34 |
− | | The '''Library Management System''' has been contributed by a leading software '''MNC''', through their '''Corporate Social Responsibility''' program. | + | |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. | + | |They have also validated the content for this spoken tutorial. |
|- | |- | ||
− | | | + | |07:48 |
− | | This is Arya Ratish from IIT Bombay signing off. | + | |This is Arya Ratish from IIT Bombay, signing off. |
Thank you for joining. | Thank you for joining. | ||
|} | |} |
Latest revision as of 16:23, 9 March 2017
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: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-INF folder 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 deployed 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 the Home page of Glassfish Server is displayed. |
05:56 | Here, 8080 is the default port 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. So, we see Hello World! displayed. |
06:31 | Let us summarize.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. |