Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to run and view the jsp file

 
Koorosh Sadeghi
Greenhorn
Posts: 4
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
Koorosh Sadeghi
Greenhorn
Posts: 4
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
omg should I place'em somewhere else?
like where?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic