import javax.servlet.*;

Hi there,

I'm trying to broaden my knowledge with by playing around with Servlets and JSP. I finally got Tomcat up and running, sort of. This is just a sideline question but does anyone know why when I load my page I need to use 127.0.0.1:8080 whereas localhost:8080 does not work. I've browsed throgh the FAQ and started reading the documentation but alas I can only access the server with 127.0.0.1:8080.

Know for my actual Java related question: I'm using NetBeans to try and create my first Servlet however when I importimport javax.servlet.*;

import javax.servlet.http.*;

I receive an error stating it can not import the classes. Do I need to download these classes or packages. I'm using the Enterprise Edition and thought that this would have been included with the API? If not does anyone know why it is not currently working because I'm unable to compile my first servlet:(

[985 byte] By [tarmenela] at [2007-10-3 6:54:50]
# 1

Can you "ping" localhost from the command line?

Have you tried it with http://localhost:8080 (the http bit can be important)

I am guessing you are on windows, so try opening a command prompt

- Start: run

- type "cmd"

You should get a dos window

ping localhost

and you should see something like this:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

With regards to the imports, you need to have the servlet api classes in your classpath.

The jar files you want will be [TOMCAT]/common/lib/servlet-api.jar and maybe [TOMCAT]/common/lib/jsp-api.jar.

Add these into your build path via the project settings, and your servlets should compile.

evnafetsa at 2007-7-15 1:46:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...