Hello everybody, My doubt is in servlets. I have done intranet chat app using socket connection.I want to convert into servlets.I am not familiar with servlets.so, i need a basic idea abt this. My application is like.. one server multiple clients.like one to many. for eg: server, client1, client2, client3... it wroks like this.. client1 comunicate to server same as client2 and 3. there is no client to client communication. i wanted to do it servlets.I have used applets. so for each client connection i create a separate threads. how the architecture should be ? help me pls...
Well, since you don't have experience with Servlets, then maybe you should start out with an easier application. Like create a hello world Servlet. Then the next Servlet have it return a table of data. I also don't really see Servlets as a good choice for a chat program. My opinion of course. Mark
wanted to do it servlets.I have used applets. so for each client connection i create a separate threads.
Well, thats the first big change you have to make - in a servlet architecture, the servlet container calls your servlet with a request from a client. Your job is to figure out which client sent it and create a response. You let the servlet container handle all the Threads and connections. Like Mark says - you better start with something simpler. Actually, a combination of servlet and applet makes a pretty good chat system - I have used a commercial chat that worked that way. My Servlets and JSP book (now out of print I think) used a chat servlet as an example - with HTML forms, not applets on the client side. Bill
Joined: Feb 01, 2004
Thanx for you kind suggestions. But i am confident i can start writing servlets. But i want to know the exact logic.. whether to have two servlets for server and client. or one servlet how to proceed abt. Thanx.
Author and all-around good cowpoke
Joined: Mar 22, 2000
You the programmer will have to invent the exact logic - thats what programming is all about. Sit down with a pencil and pad of paper - preferably far from the computer so you won't be tempted to start writing code too soon. Write out the various sequences of events that could possibly happen to users on your chat system - without using any specific details. Once you have a pretty complete list of the various events start diagramming the entities and the flow of data. Don't be afraid to throw away one or more preliminary designs. Bill