• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to run JSP page.

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Respected Friends,
I am facing problems with JSP, I dont know how to run a JSP page using tomcat web server, can any one please tell me how to run the JSP page using tomcat, where to save the JSP page inside tomcat and what command to type in browser to run it. I tryed to run one JSP page using the following procedure but was unable to run it successfully every time I get a 404-File Not Found error , the procedure I am following is as follows :

1) the name of my JSP page is Hello.jsp, I save this JSP page to the following path :

D:\TOMCAT\webapps\my\Hello.jsp

As you might have guessed that inside webapps I create a folder namely "my" and inside that folder I save my JSP page.
2) After saving the JSP page I enter the following command in the browser :

http://localhost:8080/my/Hello.jsp

But I get the 404-File not found error, can any one please tell what mistake I am making and also please check the source code present below.

//////////////////////////////////////////////////////////

<html>
<body>
Hello<%=new String("world!") %>
</body>
</html>

////////////////////////////////////////////////////////////

Please tell me that what mistake I am making,also please tell that is there any problem with the source code,please reply as soon as possible,this is really urgent for me.

Thanking You,
Salman Faraz.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are your example apps, which comes bundled with the Tomcat, running?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to tell Tomcat that "my" is a web application, either by supplying an (empty) web.xml file at startup time, or by deploying it manually in the manager web app.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All you need to do to let Tomcat know that "my" is a webapps is to create a WEB-INF directory inside the "my" directory.

WEB-INF must be typed exactly as you see it here; all caps.

Once you're done, you might need to restart Tomcat for it to deploy the 'my' application.
You can then see your jsp by typing http://localhost:8080/my/Hello.jsp
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the Tomcat forum.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic