Which version of TOMCAT do you have installed? I am an advocate of placing the JSPs in one directory under the root, which has the name (or facsimile) related to the application name. I don't know how many beginners with TOMCAT know this, but you can have your JSPs wherever you like. You don't need to place them In a "special" place. You do have to tell TOMCAT that you want to do this and also where the document root for the application is going to be. In the server.xml file, you can state: <!-- My Application Context --> <Context path="/myapplication" docBase="C:\myapp" debug="0"/> I forget the exact meaning of "debug" but you get the picture. Then your application root would be at c:\myapp. Another thing, while in this subject, is that you can define the servlet path name to your servlets using the <servlet-mapping> element in web.xml. There is nothing sacred about the /servlet/ part of the path.
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Put it in your webapps directory - actually, you should stick it in a subidirectory in webapps (i.e. webapps/yourapp). Also, you'll probably need to make an additional context entry in tomcat.conf Open up tomcat.conf and look for the line like this: <b>ApJServMount /examples /root</b> and add your own directory to it so it looks like <b>ApJServMount /examples /root /yourapp</b> If you just installed Tomcat and haven't changed anything else it should be as simple as this. (of course there is a 90% chance I am forgetting something but Im sure somebody else will help out if I have) Good luck
All the configurations and stuff may be still too confusing for you. I usually do this before i start messing with web.xml or server.xml. In your Tomcat\webapps directory create folder and call it, for example, myproject. Place your test.jsp page in that folder, restart Tomcat. Open up your browser and type http://localhost:8080/myproject/test.jsp That is all you shoul do.
Hi, First off thanks for the prompt responses!I reinstalled Tomcat in order to get a fresh start.I think i've tried to do all those things and its still not working.Here's the response in the dos screen: Ctx():404 R( +/ExJSP/MyFirstJSP.jsp + null) JSP file not found. I'm pretty sure that because i'm trying a little of everyone's suggestions im getting thrown off with the directories and editing variables and stuff.Well I've been at it for over 10 hours now and i want to get this right! lol! If any one can give me a step by step installation guide i would appreciate it. Thanks Vivek,Tony,B.J.,and Mocca for your input.I've learned alot already! Jim
Oh, I think maybe you should ignore what I said about Tomcat.conf - I apologize if I confused you. I am using Apache with Tomcat which has involved Tomcat.conf but you shouldn't worry about it. Anyway, Mocca Az and Vivek probably have the best advice here - keep it simple. Does your out of the box Tomcat install work at all? Can you run any of the examples? Please tell me the directory on your machine that MyFirstJSP.jsp is located in, and also exactly what URL you are entering in your browser. Hang in there.
[This message has been edited by BJ Grau (edited September 02, 2001).] [This message has been edited by BJ Grau (edited September 02, 2001).] [This message has been edited by BJ Grau (edited September 02, 2001).] [This message has been edited by BJ Grau (edited September 02, 2001).]
Hi BJ, No apologies necessary . You guys have been a big help. The file is in c:\tomcat\ExJSP\MyFirstJSP.jsp. I can see the default page and run its examples.Do i have to set an environmental variable that i perhaps have overlooked? My autoexec.bat looks like this: rem - By Windows 98 Network - C:\WINDOWS\net start SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JDK1.2.1\BIN;%PATH% I know that i have to set HOME_PATH=C\JDK1.2.1. I'm not so sure if i'm supposed to change the classpath in tomcat.bat or in autoexec.bat though. lol!What do you think?
Jim, You didn't follow instructions that i posted. If you want to keep existing path to your .jsp files then you must follow instructions posted by sheriff Tony, therefore you must edit server.xml found in C:\Tomcat\conf directory. If you want keep it simple then you must follow instructions posted by me earlier, which means that your .jsp pages must live in C:\Tomcat\webapps\ExJSP\MyFirstJSP.jsp. If you can run default examples than your CLASSPATH, JAVA_HOME & TOMCAT_HOME are set correctly. follow this steps 1. Create folder called ExJSP in C:\Tomcat\webapps = C:\Tomcat\webapps\ExJSP 2. Put MyFirstJSP.jsp in this folder = C:\Tomcat\webapps\ExJSP\MyFirstJSP.jsp 3. Start Tomcat or restart it if its running already so the changes take affect. 4. Open up your browser and type http://localhost:8080/ExJSP/MyFirstJSP.jsp This is it. The error message you are getting at the moment means that Tomcat can't find directory ExJSP therefore MyFirstJSP.jsp can't be found as well. Reason for this is because your folder/file does not live in C:\Tomcat\webapps and the place where it lives "c:\tomcat\ExJSP\MyFirstJSP.jsp" is not configured in server.xml. If you follow the steps i describe above, you can't miss it. Hopefully after you get some sleep you'll clear your head up a bit an stay with me on this one, OK...