wood burning stoves*
The moose likes Tomcat and the fly likes Not able to run and view the jsp file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Not able to run and view the jsp file" Watch "Not able to run and view the jsp file" New topic
Author

Not able to run and view the jsp file

Koorosh Sadeghi
Greenhorn

Joined: Sep 21, 2012
Posts: 4

Dear friend
I am a totally new comer to java and just started jsp.
Using XAMPP, i can run and view its jsp examples.
I've saved my file in C:\xampp\tomcat\webapps\ROOT\hello\hello.jsp and try to load it but
I only view the java code I've entered as :
<% String visitor = request.getParameter("name"); if (visitor == null) visitor = "World"; %> Hello, <%= visitor %>!

the code is as follows :

<HTML>
<BODY>
<% String visitor = request.getParameter("name");
if (visitor == null) visitor = "World"; %>
Hello, <%= visitor %>!
</BODY>
</HTML>

Does my code have problems or I'm wrong running it (should I compile it maybe)?

Sincerely yours,
Koorosh
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61229
    
  66

XAMPP is not a servlet container. It cannot interpret JSPs. You've put the file in a Tomcat file hierarchy, why aren't you running Tomcat?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Koorosh Sadeghi
Greenhorn

Joined: Sep 21, 2012
Posts: 4

Well my XAMPP includes TOMCAT also and I have run it
and as I said the j2ee samples work
should I install a seperate Tomcat ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61229
    
  66

XAMPPP most certainly does not include Tomcat. If you have a Tomcat instance it came from somewhere other than XAMPP. See the XAMPP distribution page for the list of what's included. Tomcat is nowhere to be found.
Koorosh Sadeghi
Greenhorn

Joined: Sep 21, 2012
Posts: 4

Dearest friend
thank you a lot for paying attention to my problem
but
Tomcat 7.0.28 (with mod_proxy_ajp as connector) is included within Xampp 1.8.0 :

http://www.apachefriends.org/en/xampp-windows.html

(derivative of the very page you have forwarded me)
it had a bug previously by which I had to start tomcat manually from its folder and it seems
it's been fixed by now. As I said the examples work. I must be wrong doing something else.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61229
    
  66

Odd that they hide that info.

OK, so now that we've established that you are using Tomcat 7: is Tomcat running?

And why are you putting files in Tomcat's ROOT web app rather than creating your own?

Koorosh Sadeghi
Greenhorn

Joined: Sep 21, 2012
Posts: 4

omg should I place'em somewhere else?
like where?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61229
    
  66

You should create your own web application structure under webapps.

Grab a servlets book or tutorial, or look in the Tomcat docs to find out how. You can't just drop files anywhere and expect them to work: web apps need a very precise and defined folder structure to operate correctly.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Not able to run and view the jsp file