Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


Java Tutorials



Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Servlets HolisticCounterInServlet

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

5 comments so far (post your own) View All Comments Latest 10 Comments:

Plz send me examples of servlets

Posted by santosh soni on Wednesday, 09.15.10 @ 14:48pm | #99592

This example is fine if you dont mind can you explain me in detail.

Posted by Gangadhar on Monday, 07.26.10 @ 16:06pm | #98445

I tried the example above, but not getting the multiple threads, I opened new browser, still everytime its giving 1 Threads in console only..

Posted by shaily on Thursday, 09.18.08 @ 13:23pm | #80280

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

public class Demo extends HttpServlet
public void doPost(HttpServletRequest req,HttpServletResponse res)
PrintWriter out=res.getWriter();

out.println("This is example of Sevlet using only doPost(): ");

Posted by Renu on Monday, 05.12.08 @ 11:56am | #59430

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

public class HolisticCounter extends HttpServlet{
int counter = 0; //separate For Each Servlet
static Hashtable hashTable = new Hashtable(); //Shared by all the threads

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter pw = response.getWriter();
pw.println("This servlet has been accessed" + counter + "times<br>");
pw.println("There are currently" + hashTable.size() + "threads<br>");

Posted by rajani on Thursday, 08.9.07 @ 17:17pm | #23025

Ask programming questions?



Back to Tutorial


  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name


Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright 2007. All rights reserved.