| 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
|
|
||||||||||||||||||||||||||||||
|
Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs |
||||||||||||||||||||||||||||||
Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.
Copyright © 2007. All rights reserved.
Current Comments
3 comments so far (post your own) View All Comments Latest 10 Comments: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)
{
res.setContentType("text/html");
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 {
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
counter++;
pw.println("This servlet has been accessed" + counter + "times<br>");
hashTable.put(this,this);
pw.println("There are currently" + hashTable.size() + "threads<br>");
}
}
Posted by rajani on Thursday, 08.9.07 @ 17:17pm | #23025