• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Basic JSP problem

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I have just installed tomcat on my windows xp machine.I downloaded the Apache-Tomcat version 5.5.15(windows executable) and also the jdk 5.0.
When I enter http://localhost:8080/ into the browser, I get the tomcat Jakarta page-no problem.

When I try my first test jsp page (main.jsp)with the follwing expression in the body section of the jsp page:
Hello! The time is now: <% = new java.util.Date() %>

I get the same line in my webpage:
Hello! The time is now: <% = new java.util.Date() %>

The java expression is not evaluated, no error messages.
Anyone have any suggestions what I should be doing?

Thanks
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, you've got an extra space between the % and the =.
You should remove it.

What file did you put this line in ? (filename and directory)
 
sai baba
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Thanks for the help,
I have the file main.jsp in a WebProject folder which is a subfolder of the Tomcat Root folder(Root/WebProject/main.jsp).

From what little I know its supposed to be a simple test. I have no servelet in the page so am I still to have created WebProject\WEB-INF\web.xml? If so what will it contain in the servlet tag? I have not edited any other XML files.

Any Ideas/Suggestions?

Sai
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Satou pointed out, you have extra space in around the "=". And to answer you last question, I don't think you have to have web.xml in place for your page has no servlets and you don't need any parameters set etc. Also, instead of "root", I'd put it under "webapps", say "webapps/app1/main.jsp". Then http://your_ip:8080/app1/main.jsp should work. If not use Tomcat manager and do a "reload" should make you happy.

Good luck.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suggestions:
Read this: http://tomcat.apache.org/tomcat-5.5-doc/appdev/index.html
Particularly the sections on Deployment/source organization.

The ROOT directory, is an already existing webapp. You should not have a directory ROOT/WebProject/WEB-INF.

WEB-INF directories should only be in a directory directly under webapps.
eg to define a web application "WebProject"
[TOMCAT]/webapps/WebProject/WEB-INF/web.xml
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't need web.xml yet, but you should deploy your application under webapps, not ROOT. Create a new directory (e.g. myapp) under webapps, and put your main.jsp file in it. Access it with:
http://localhost:8080/myapp/main.jsp
 
reply
    Bookmark Topic Watch Topic
  • New Topic