-1

How can i compile and run jsp pages using tomcat. Where should i place my jsp page. In which folder i have to placed it.

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
neha soni
  • 65
  • 1
  • 6
  • 11

1 Answers1

5

A simple example of JSP can be like this

<html>
<head>
<title>Hello World JSP</title>
</head>
<body>
<% out.println("Hello World"); %>
</body>
</html>   

To run this JSP page
Save the file in c:\Program Files\Tomcat\tomcat-5.5.9\jsp-examples\ as HelloWorld.jsp
Start the TomCat Server.
Type the following URL in the address bar of your web browser.
http://localhost:8080/jsp-examples/helloworld.jsp
The JSP page will be displayed in the web browser.


A JSP page is converted to a servlet internally by the JSP Engine.And the source file for that servlet can be found at \work directory in TomCat.


For more information on how JSP works and how it is different from Servlet take a look at this

What is the difference between JSF, Servlet and JSP?

Also Take a look at
Hidden features of JSP/Servlet

Community
  • 1
  • 1
Alpine
  • 3,838
  • 1
  • 25
  • 18