Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

JSP not working

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What error are you getting? Where is your jsp paage? What url are you putting in the browser?
 
Ray Tam
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Neither suggestions yielded the correct results. I intentionally made typos and it was ignored.
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic