Try this Website Hit Counter

hai,

i am trying this program,but not executed,

simple one but error occur,try this and give best solution

run this below program,i got error msg, javax.servlet package does not exit

why this error occur

what is the solution for this

try to give correct solution as soon as possible

i am using j2sdk1.4.0_01

****

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

public class hitcountServlet extends HttpServlet

{

static int count;

public void init(ServletConfig config)throws ServletException

{

super.init(config);

}

public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException

{

response.setContextType("text/html");

PrintWriter out=response.getWriter();

count++;

out.println("<html>");

out.println("<head><title>BasicServlet</title></head>");

out.println("<body>");

out.println("You are user number "+String.valueOf(count)+" visiting our web site"+ "\n");

out.println("</body></html>");

}

public String getServletInfo()

{

return "BasicServlet Information";

}

}

[1347 byte] By [Sri_Sria] at [2007-11-27 7:54:30]
# 1
hiset the classpath for servlet.jar file before compling the program.Bala
art84a at 2007-7-12 19:35:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

hai bala thanks for ur reply

you are told set the class path for servlet.jar file but i can't able to find this one

i am using j2sdk1.4.0_01

my file name is hitcount.java

i am trying to convert into class file for this

where this servlet.jar file are there,i don;t know clearly,please tell me details way

waiting for your reply...

Sri_Sria at 2007-7-12 19:35:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

if you are using tomcat then "servlet.jar" or other name "servlet-api.jar" then file is in following directory......

C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\

put whole path+file name in classpath variable

in WinXP

go start > control panel > system > advanced tab >environment variable

i.e. and put following line in classpath but chk on your system that jar file path

i give you my sys path.....

C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar;

sagar_biraria at 2007-7-12 19:35:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
hai sagar, thank you for sharing this information, it is working perfectly thank you verymuch
Sri_Sria at 2007-7-12 19:35:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...