| 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: 56178
|
|
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?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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: 56178
|
|
|
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: 56178
|
|
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: 56178
|
|
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.
|
 |
 |
|
|
subject: Not able to run and view the jsp file
|
|
|