Two Laptop Bag*
The moose likes JSP and the fly likes Newbie question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Newbie question" Watch "Newbie question" New topic
Author

Newbie question

Janey Powell
Greenhorn

Joined: Mar 05, 2005
Posts: 3
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

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() %>


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Janey Powell
Greenhorn

Joined: Mar 05, 2005
Posts: 3
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Janey Powell
Greenhorn

Joined: Mar 05, 2005
Posts: 3
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.
 
wood burning stoves
 
subject: Newbie question
 
Similar Threads
How to run jsp on TOMCAT?
problem with JSP deployment in tomcat
location bar of the browser on include/forward/sendRedirect
JSP and XML
Stuck on HelloWorldServlet