working with JSP

Hi, I've never worked with JSP and MySQL. One of the things that I did was search CG for an answer and I found this link. (http://www.dev-archive.com/forum/showthread.php?s=&threadid=267028&highlight=getting+started) I downloaded TomCat and stuff(it came with my servlet package that I downloaded from sun, its official name is jwsdp-1_3-windows-i586). And after doing all of the installations, I typed up this simple code, hoping that it would work...

// jsp_test.java: this is a simple JSP example that will print something on the web browser

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class jsp_test extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
PrintWriter out = response.getWriter();
out.println("Hello World");
}
}

... however, I still managed to get the below errors...

C:\Program Files\Xinox Software\JCreator LE\MyProjects\jsp_test\jsp_test.java:4: package javax.servlet does not exist
import javax.servlet.*;
^
C:\Program Files\Xinox Software\JCreator LE\MyProjects\jsp_test\jsp_test.java:5: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
C:\Program Files\Xinox Software\JCreator LE\MyProjects\jsp_test\jsp_test.java:7: cannot resolve symbol
symbol : class HttpServlet
location: class jsp_test
public class jsp_test extends HttpServlet
^
C:\Program Files\Xinox Software\JCreator LE\MyProjects\jsp_test\jsp_test.java:9: cannot resolve symbol
symbol : class HttpServletRequest
location: class jsp_test
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
^
C:\Program Files\Xinox Software\JCreator LE\MyProjects\jsp_test\jsp_test.java:9: cannot resolve symbol
symbol : class HttpServletResponse
location: class jsp_test
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
^
C:\Program Files\Xinox Software\JCreator LE\MyProjects\jsp_test\jsp_test.java:9: cannot resolve symbol
symbol : class ServletException
location: class jsp_test
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException

... any help is appreciated in order to get me out of the mess that I'm in right now. Thanks in advance.
[2669 byte] By [ats007spdou] at [2007-11-18 19:07:28]
# 1 Re: working with JSP
You get these when you compile your code, because the appropriate packages have not been added to your classpath.
I don't have the time right now to tell you exactlly what packages you need to add. Will be back later tonight (in 4-6 hours).
khp at 2007-11-8 0:19:14 >
# 2 Re: working with JSP
Not sure what version of tomcat you are running. But in tomcat5, the classes you are missing above, are all part of the servlet-api.jar archive, located in the folder $CATALINA_HOME/common/lib

So to compile the servlet above you could do something like

javac -classpath $CATALINA_HOME/common/lib/servlet-api.jar jsp_test.java

BTW, the name jsp_test is a bit misleading, the above is not a jsp page, it's a servlet.
khp at 2007-11-8 0:20:14 >
# 3 Re: working with JSP
Sorry for taking so long to respond...

See, the thing is I downloaded something called... "jwsdp-1_3-windows-i586". And I looked at plenty of sites that give you start up directions and such. However, one thing that bothers me is that sometimes all of those directions are different from one another(and I don't mean that one talks about setting up jsp in Linux and the other one in Windows). Sometimes I found stuff that talked about tomcat, the other ones didn't..... I don't know, maybe it's just me(most likely). I just want a set of very simple instructions on what to do(step by step), in terms of setting up the whole package and then a simple program that outputs "Hello World" or something. I have no idea where to even start(since I'm a newbie) and the amount of information available online is overwhelming. Thanks in advance.
ats007spdou at 2007-11-8 0:21:20 >
# 4 Re: working with JSP
I would suggest that you read the documentation, that comes with what you have downloaded, surely it comes with some samples.

But perhaps it would also be beneficial, if you took the time to learn the basics of java programming, before trying to build servlets.
khp at 2007-11-8 0:22:22 >
# 5 Re: working with JSP
I already know the basics of java programming, I'm just having a difficult time setting this stupid thing up. I'm not sure what to install, when and how. Oh well, I'll keep you posted khp with my progress(or lack of it).
ats007spdou at 2007-11-8 0:23:21 >
# 6 Re: working with JSP
Well, here's the deal, I put in everything that I thought I humanly could into the registration, but I still get a wrong class path error :( . These are all of the files that I have in my C drive that are related to java...
jsdk2_1-win
jwsdp-1.3
j2sdk1.4.2_04
...where should my class path point to? Thanks.
ats007spdou at 2007-11-8 0:24:20 >
# 7 Re: working with JSP
Hey, khp, I still have some questions. I'm using XP and I went to Control Panel, System, Advanced, Environment Variables. I put in the Variable CLASSPATH and the Value as(it's all in a single line)...
C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar;
C:\Documents and Settings\Andrew Shrets\My Documents\Programming\server pages;
C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\jsp_test.jar
... and the darn thing still doesn't want to work. Any suggestions.

Note, this will be something dumb that I forgot to do along the way or other idiotic action on my behalf.
ats007spdou at 2007-11-8 0:25:22 >