aspose file tools*
The moose likes Tomcat and the fly likes JSP not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "JSP not working" Watch "JSP not working" New topic
Author

JSP not working

Ray Tam
Greenhorn

Joined: Mar 01, 2003
Posts: 12
I have installed Tomcat 4.1.18 successfully on Windows XP Pro. I run the startup.bat in my apache\bin directory and when I key in http://localhost:8080, I get the start page. However, when I try to bring up my JSP page, it is not working.
<html>
<body>
<% out.println ("testing JSP"); %>
<h1>JSP test</h1><br><hr>
</body>
Any idea why this is not working? Thanks in advance.
</html>
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
What error are you getting? Where is your jsp paage? What url are you putting in the browser?
Ray Tam
Greenhorn

Joined: Mar 01, 2003
Posts: 12
I am not getting any error. I expected that "Testing JSP" would have shown. I have moved the JSP page to several directories in an effort to make it work. Is there a directory that I need to be in?
Ray Tam
Greenhorn

Joined: Mar 01, 2003
Posts: 12
Neither suggestions yielded the correct results. I intentionally made typos and it was ignored.
Brian Glodde
Ranch Hand

Joined: Jun 27, 2001
Posts: 171
The JSP page should be in under the webapps folder. If the JSP, say "yourjsp.jsp" is part of a web application eg "foo", your JSP should be at located in "%CATALINA_HOME%/webapps/foo/yourjsp.jsp" and via URL at http://localhost:8080/foo/yourjsp.jsp
Sorry for the earlier post, was incorrect and in haste.
Ray Tam
Greenhorn

Joined: Mar 01, 2003
Posts: 12
The URL is correct since I placed
<h1> My JSP </h1>
before the
<% out.println ("JSP test"); %>
I see that fine. It's the "JSP test" that's not coming out. Is there something that needs to be done prior or is there something missing from the HTML??
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

this works fine for me:
And in the generated servlet I get:Not sure why you'd break into a scriptlet just to use the 'out' object though. That's what JSPs were meant to make easy.
Dave Jochim
Ranch Hand

Joined: Jan 08, 2003
Posts: 31
the code that Mike posted works for me as well. Are you looking for 'JSP test' to be printed in the JSP or in the Tomcat window opened with the startup.bat? I may be off here (which is usually the case) but you sounded like you might be looking in the startup.bat window, in which case you need System.out.println().
Again sorry if this is off the mark.
Ray Tam
Greenhorn

Joined: Mar 01, 2003
Posts: 12
I swiped this code from a book except for the hard coded literals. I would expect to see on the HTML
Testing JSP
Test JSP
Why would you go to look at the servlet? Thanks.
praveen patil
Greenhorn

Joined: Mar 03, 2003
Posts: 9
hi,
just SET
CLASSPATH=.;<TOMCAT_HOME>\COMMOM\LIB\SERVLET.JAR.
also if u r using ur own directory, put it in
classpath. i hope it will work fine now.
Praveen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP not working