- Impact
- 0
I simply cannot understand servlets....I have something very simple to do and I can't figure it out. And it eats me inside. Although I read tutorials and everything I still can't figure it out.
I downloaed apache-tomcat-5.5.15
and j2re1.4.2_01
Both are installed in C:\apache-tomcat-5.5.15-src and C:\java
and I have this servlet:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class SimpleCounter extends HttpServlet {
int count = 0;
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
count++;
out.println("Since loading, this servlet has been accessed " +
count + " times.");
}
}
Simple question..how do I run it? Because I have no clue whatsoever on how to run it. I can't even understand how HelloWorld servlet runs....and thats the easiest one as I understand. Pls help me cause I'm going nuts.
The Helloword examples work so I guess both tomcat and java are installed corectly.
I downloaed apache-tomcat-5.5.15
and j2re1.4.2_01
Both are installed in C:\apache-tomcat-5.5.15-src and C:\java
and I have this servlet:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class SimpleCounter extends HttpServlet {
int count = 0;
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
count++;
out.println("Since loading, this servlet has been accessed " +
count + " times.");
}
}
Simple question..how do I run it? Because I have no clue whatsoever on how to run it. I can't even understand how HelloWorld servlet runs....and thats the easiest one as I understand. Pls help me cause I'm going nuts.
The Helloword examples work so I guess both tomcat and java are installed corectly.




