Hello World Jsp Example

Before setting up deploying JSP on your environment, make sure that the JAVA_HOME environment is set. and also download tomcat from the apache site and should set TOMCAT_HOME environment is set. Please make sure that PATH and CLASSPATH environment variables are set.

Steps to create a first web application

  • Create a HelloWorld folder and the folder structure looks like the following structure The HelloWorld root folder contains the following structure.
java web Application folder structure

Create a first.jsp which prints the hello world code to the console type the above

code in the notepad and name it as ‘first.jsp’. please this file into the HelloWorld root folder of your web application.

Deploying HelloWorld web app to Tomcat application

  • to deploy the first web app to tomcat, simply copy the HelloWorld app to the tomcat installed directory i.e web apps, and start the tomcat server. The start script is located under TOMCAT_HOME\bin\startTomcat.bat for windows.

  • Accessing the jsp file. For example, to run the first.jsp” file, open a browser to the address: http://localhost:8080/first.jsp This will show you the executed JSP file.

so you are ready with learning with your first JSP page creation.