THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
- Sun JDK 6.0+ (J2SE 1.6)
- Eclipse IDE for Java EE Developers, which is platform specific
- Apache Geronimo Eclipse Plugin 2.1.x
- Apache Geronimo Server 2.1.x
Note |
---|
Geronimo version 2.1.x, Java 1.5 runtime, and Eclipse Ganymede are used is used in this tutorial but other versions can be used instead (e.g., Geronimo version 2.2, Java 1.6, Eclipse Europa) |
Details on installing eclipse are provided in the Development environment section. This tutorial is organized in the following sections:
Table of Contents | ||
---|---|---|
|
Creating a dynamic Web project using Eclipse
...
- Right-click on the project HelloWorld and create a new JSP as shown in the figure.
- Give the name as hello.jsp and select Next. Select Finish on the next screen
- Modify the code of
hello.jsp
as follows:Code Block title hello.jsp borderStyle solid <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Hello World</title> </head> <body> Hello World!! </body> </html>
Making hellp.jsp the welcome file
- Click WebContent -> WEB-INF and open
web.xml
. - Add
hello.jsp
as a welcome file under the <welcome-file-list> tag:Code Block title web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>HellowWorld</display-name> <welcome-file-list> <welcome-file>hello.jsp</welcome-file> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app>
Run and deploy
- Deploy the application on the server.
- launch the application using http://localhost:8080/HelloWorld/hello.jsp
- This will display HelloWorld!! on the browser window.