Hello World JSP Example
Before deploying JSP on your environment, ensure that the
JAVA_HOME environment variable is set. Also, download Apache Tomcat from the Apache site and set the
TOMCAT_HOME environment variable. Make sure that the
CLASSPATH environment variables are also set.
Steps to Create Your First Web Application
- Create a
HelloWorldfolder with the following structure: The
HelloWorldroot folder should have the following structure:
- Create a
first.jspfile that prints the “Hello, World!” code to the console. Type the code into Notepad and save it as
first.jsp. Place this file in the
HelloWorldroot folder of your web application.
Deploying the HelloWorld Web App to Tomcat
To deploy the web app to Tomcat, copy the
HelloWorldapp to the Tomcat installed directory, i.e.,
webapps, and start the Tomcat server. The start script is located under
Accessing the JSP file: To run the
first.jspfile, open a browser and navigate to the address:
http://localhost:8080/first.jsp. This will display the executed JSP file.
so you are ready with learning with your first JSP page creation.