This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Newbie question

 
Janey Powell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone, I'm trying to write my first JSP and I'm having a bit of trouble, I'm a complete novice at J2EE "but I know a bit about J2SE) and I just can't figure out what Ive done wrong.

I've installed Tomcat 5 and when I enter http://localhost:8080 it confirms it's sucessfully installed, so far so good. Then I wrote a simple JSP....

<HTML>
<HEAD>
<TITLE>MY FIRST JSP</TITLE>
<META NAME="AUTHOR" CONTENT="ME">
</HEAD>

<BODY>
<UL>
<LI> CURRENT TIME: <%= NEW JAVA.UTIL.DATE() %>
</UL>
</BODY>
</HTML>

...to test it but every time I enter http://localhost:8080/jsp/first.jsp I get.....

HTTP Status 404 - /jsp/first.jsp

type Status report

message /jsp/first.jsp

description The requested resource (/jsp/first.jsp) is not available.
Apache Tomcat/5.5.7



What am I doing wrong?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34401
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Janey,
Welcome to JavaRanch!

What directory did you place the JSP in?

Note that once Tomcat finds the JSP, you are going to have a compiler error. Since Java is case sensitive, the scriplet should be <%= new java.util.Date() %>
 
Janey Powell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAVA.DATE.UTIL well it has been a couple of years since the SCJP

Ok as to the directory I just have it in a directory called jsp off root (/jsp), I guess I need a special directory structure or something but I don't know what.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Under the Tomcat's webapps directory, create a folder for your app:
{tomcat_home}/webapps/jsp
Under that, you need to create a folder called WEB-INF
{tomcat_home}/webapps/jsp/WEB-INF

Once you've done that, Tomcat will recognize it as a webapp.
You can then put your JSPs under the 'jsp' (or whatever you app's name is) directory and start hacking.
 
Janey Powell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks it works, kinda I get my page but no method call, I know JAVA_HOME is set so I'll have a poke around and see what the prob is.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic