Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet-applet

 
priya _raghu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Priya priya"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it
here.
Thanks! and welcome to the JavaRanch!
Mark
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
priya _raghu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
priya _raghu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx sir i will try.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic