This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Tomcat" Watch "Tomcat" New topic


S Varana

Joined: Feb 04, 2004
Posts: 18
I am new to JSP. Just wanting to get started. I have installed Tomcat 3.1 on my win98 machine. I am able to run the startup and shutdown scripts sucessfully. When I type in http:/localhost:8080, it displays me a tomcat homepage. So far so good. But when I try to execute any of the examples given,I get and error.
I have also created a hello.JSP file and put that into tomcat/webapps/ROOT directory. when I load it using the command http:/localhost:8080/hello.jsp, it shows me the source code along with some extra tags and indentations. I am unable to understand it. I was expecting that when I load this hello.jsp file, 'HELLO WORLD' shows up. Can anyone help me with this, where I am going wrong? I know this is a basic question but I am going nowhere.
I tried going thru previous postings and some of the psotings did help me get this far especially by bill brodgen and others.
Please help.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13018
I would say that the first thing to do is to get all of the examples running, and the first step is to examine this error you are getting.
Tomcat writes System.out stuff to the MSDOS window - are you seeing any exceptions reported there? How about error reports to the log files?
I found out the other day that the MSIE browser has this "Friendly HTTP error" mode that substitutes a MS page for error reports from Tomcat. You can get rid of that from the advanced Internet tools menu.

S Varana

Joined: Feb 04, 2004
Posts: 18
Bill, I did the change in settings for disabling friendly HTTP error messages. To explain again:
The error message I get is Source) in server window.
I tried with different examples and the latest example which I was running is of creating a hello.jsp file and having the following code in it.
<% String visitor = request.getParameter("name");
if (visitor == null) visitor = "World"; %>
Hello, <%= visitor %>!
I saved this JSP file in c:\tomcat\webapps\ROOT directory and restarted TOMCAT. When I type http://localhost:8080/hello.jsp I get the following displayed in browser. Note that The line above the tag </BODY> is missing.
<% String visitor = request.getParameter("name");
if (visitor == null) visitor = "World"; %>
Like I said earlier, I fail to undertand why the source is getting displayed. Am I going wrong somewhere? Please help...
S Varana

Joined: Feb 04, 2004
Posts: 18
Just want to add that Netscape displays back the above code while MSIE does not display anything. When I do a right click and view source I get the above. Thanks.
S Varana

Joined: Feb 04, 2004
Posts: 18
hello all,
when i try to run a JSP page from the browser, the contents inside <% and %> are not getting displayed. It seems the JSP tags are ignored while all other plain HTML output gets displayed in the page. Can someone help me with this.
I agree. Here's the link:
subject: Tomcat
It's not a secret anymore!