Difference between revisions of "Java-Business-Application/C2/Creating-a-Java-web-project/English"
Arya Ratish (Talk | contribs) (Created page with ''''Title of script''': Creating a Java Web Project '''Author: arya ''' '''Keywords: deployment descriptor, web project, context, video tutorial''' {| style="border-spacing:0…') |
(No difference)
|
Latest revision as of 17:19, 1 July 2013
Title of script: Creating a Java Web Project
Author: arya
Keywords: deployment descriptor, web project, context, video tutorial
| |
|
| Slide 1 | Welcome to the spoken-tutorial on Creating a Java Web Project. |
| Slide 2 | In this tutorial we will learn :
|
| Slide 3
Software Requirements |
Here we are using
|
| Slide 4
Prerequisites |
To follow this tutorial you must have knowledge of
If not, for relevant tutorials please visit our website. |
| Switch to Netbeans IDE | Now, let us see how to create a simple Java Web Project using Netbeans IDE.
|
| Click on File -> New Project | Click on File and then click on New Project. |
| A New Project window opens. | A New Project window opens up. |
| Select Java Web among categories and Web Application among Projects. | From the categories, choose Java Web and from Projects choose Web Application. |
| Click on Next. | Then click on Next. |
| A New Web Application window opens. | New Web Application window opens. |
| Type the Project Name as MyFirstProject. | We will type the Project Name as MyFirstProject. |
| The Project Location will remain as it is. | Let us keep the default Project Location, which is NetbeansProjects. |
| The Project Folder will remain same as it is. | We will keep the Project Folder also as the default one. |
| The rest of the fields will be set their default values. | All the remaining fields will be set at their default values. |
| Click on Next. | Click on Next. |
| Select GlassFish server as the Web Server. | Select GlassFish server as the Web Server. |
| Highlight the Context Path. | Note that Context Path is MyFirstProject, which is the same name as our Project.
|
| Click on Next and then click on Finish. | Click on Next and then click on Finish. |
| In the Projects tab, a web application named MyFirstProject has been created. | |
| Click on the arrow pointing towards MyFirstProject. | Click on the arrow pointing towards MyFirstProject. |
| Scroll through all the nodes. | We can see several nodes here. |
| We are not concerned about all of these nodes right now. | |
| First, we will learn about what is known as a Deployment Descriptor. | |
| Slide 5 | A web application’s deployment descriptor describes:
|
| Slide 6 | * The web server receives a request for the application.
The deployment descriptor is a file named web.xml. |
| Scroll through the nodes. | We are not able to find the web.xml file from the nodes available here. |
| Go to New -> File | To locate it, at the top left of the IDE, click on File, and then on New File. |
| Click on Web. | From the Categories, select Web. |
| Click on Standard Deployment Descriptor(web.xml). | From the File Types, select Standard Deployment Descriptor(web.xml). |
| Click on Next. | Then click on Next. |
| Click on Finish. | Click on Finish. |
| Click on the Files tab on the left side of the IDE. | Click on the Files tab on the left side of the IDE. |
| Highlight Web Pages, WEB-INF and web.xml. | Note that web.xml is visible under the WEB-INF folder of the Web Pages node. |
| Click on the Source tab at the top. | Click on the Source tab at the top of the Editor window. |
| Highlight the web.xml file. | We can see the source code now. |
| Highlight the web.xml header. | We have an xml header here. |
| Highlight web-app. | We also have a web-app node. |
| Now, we shall try running the web-application. | |
| Right click on MyFirstProject. | To do so, right click on MyFirstProject. |
| Click on Clean and Build. | Click on Clean and Build.
|
| Right click on MyFirstProject and click on Run. | Again, right click on MyFirstProject and then click on Run. |
| Hover your mouse over the browser window and highlight HelloWorld! | We see that a browser window opens up and displays the message Hello World! |
| This is because when we run the project, the web application renders the page shown. | |
| Highlight the URL. | Now, let’s have a look at the URL that rendered the page. |
| It is localhost colon 8080 slash MyFirstProject. | |
| Switch to Netbeans and show index.jsp. | It is the index.jsp that was rendered. |
| Hover your mouse over the browser window. | So when we run MyFirstProject by default we get a JSP page that says HelloWorld! |
| Switch to Netbeans IDE. | Let us come back to our IDE. |
| Highlight index.jsp. | We can see that under the WEB-INF folder there is index dot jsp. |
| Double click on index.jsp | Double click on index.jsp. |
| Hover your mouse over the source code. | We can see the source code here.
|
| The server provides index.jsp by default when we run the web application. | |
| Recall that we had come across something called ContextPath earlier.
| |
| Type localhost:8080 | Now, in the URL type localhost colon 8080. |
| Hover your mouse over the home page. | We see that the home page of Glassfish server is displayed. |
| This Glassfish server instance may have many applications running on it. | |
| To access a particular application type that application name in the URL. | |
| So,we must type the specific application that has been deployed on that instance. | |
| Type MyFirstProject in the URL. | So we will type MyFirstProject here.
|
| Press Enter. | Press Enter. |
| Show the index.jsp page. | We can see that the index.jsp gets displayed on the browser.
<PAUSE> |
| Slide 6
Summary |
Let us summarize.
In this tutorial we have learnt
|
| Slide 6
|
* Watch the video available at the following link
|
| Slide 7
About slide |
The Spoken Tutorial Project Team
|
| Slide 8
Acknowledgement |
Spoken Tutorial Project is a part of the Talk to a Teacher project
|
| Slide 9
Contributor slide |
The Library Management System has been contributed by a leading software MNC, through their Corporate Social Responsibility programme.
|