Professional Documents
Culture Documents
Lab1- Servlet
Objective
The purpose of this lab is to learn implementing a client-server application using Java servlets
Description
Task 1: deploying a static web page on the server
Today, your task is deploying a static Web page on GlassFish. For this purpose, do the following
steps:
1. Install Netbeans, if you already have not installed it. Click on the following link and then
select Java bundle
http://www.netbeans.org/downloads/
2. Run the netbeans and create a new project: File> New Project
3. Select Java Web category and Web Application project.
4. Define a name for your project, such as FirstServlet, then click on Next button.
Here, you should be able to see the server which is GlassFish. Context path is also
specified here as well.
5. Click on Finish.
6. Run it. You will see the index.jsp in the web browser in the following address.
http://localhost:8080/FirstServlet/
Now, run the project. You will see hello.html instead of index.jsp as a welcome page.
Note: Servlets are used to create the dynamic Web pages. Since, hello.html is a static web page,
you do not need to develop a servlets application.
c. Add some html tags to the servlet. And run the application.
2. The next step is to edit web.xml. To do this, double-click on web.xml. Select Servlets
tab and change the URL pattern to hello2.html.
Notes
Deliverables
When your program is complete, submit and show it to your instructor.