This post will be followed by some other posts to integrate this simple project with the most important frameworks and technologies in use on Java EE programming.
Let's start with the project.
First of all I create a new Dynamic Web project from eclipse:
In the next popup window I set the project name "SampleProject", the Application Server jBoss 5.0 and leave the other configuration with default values. I don't include the Web Project in an Ear for the moment, so I don't check the checkbox.
1. Our source folder will be the src folder and the build path build/classes;
2. The context root is our project root folder and the content directory will be the WebContent;
3. We allow eclipse to create the web.xml project descriptor for us.
Let's now modify the web.xml to indicate which will be our welcome-file from the list it gives us and choose a name to call our project from the web browser:
In the next picture we can see the web.xml with the display-name tag that is the name we use to call our application from the web browser ( http://localhost/SampleProject ) and the welcome-page.
As you can see I choose index.jsp as welcome page; I create a folder named pages under the WebContent folder of my project in which I put my index.jsp page:
Now we create a welcome page that is the first page a user will see in our application:
I only set the title of the page and a greeting in the body of the page:Now our web project is ready to be deployed in our application server, so I show you how to add the project in the application server from eclipse: right click on our server and choose "Add and remove" from the menu:
We can now see another window that shows us the projects that could be deployed into our application server, in our case only the SampleProject project. Select it, press the Add button in the center of the window and then press Finish:
Now our application server will deploy the project for us and we can call it from the web browser:
That's all for now, in the next post I will integrate Struts 2 to control the flow of our web application.
No comments:
Post a Comment