Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New to servlets - a few random easy questions

 
Anomander Rake
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)Is any Java program that runs on a server and communicates with a client considered to be a 'servlet'?

2)I have read that Tomcat or Jserv(e?) are needed to run servlets on a server. Is Tomcat a more advanced replacement for Jserv, or are they both up to date alternate means of handling servlets?

3)I want to send a stream of data from an applet to a java program on the server, and have the Java program store the data in a file. Must this Java program be a 'servlet' handled by Tomcat or Jserv?

Thanks.
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anomander Rake:
1)Is any Java program that runs on a server and communicates with a client considered to be a 'servlet'?

Generally yes, however it has to be compliant or extend servlet class.

2)I have read that Tomcat or Jserv(e?) are needed to run servlets on a server. Is Tomcat a more advanced replacement for Jserv, or are they both up to date alternate means of handling servlets?

Tomcat supports J2EE deployment of servlets and servlet spec. after 2.2.
It supports also addition to servlets as JSP. Jserv is out of support.

3)I want to send a stream of data from an applet to a java program on the server, and have the Java program store the data in a file. Must this Java program be a 'servlet' handled by Tomcat or Jserv?

It can be but fair not a requirement. However, using right servlet container can solve scalability in simple way, like you have thousands applets willing to send a stream to your program.

Thanks.
 
Indraneel A Das
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)Is any Java program that runs on a server and communicates with a client considered to be a 'servlet'?
servlets and JSPs are java programs run on a web server compliant with the Sun Java Servlet APIs and handle web requests.
For other Client-server application (eg Chat application), programs running on server need not be considered to be a 'servlet'

2)I have read that Tomcat or Jserv(e?) are needed to run servlets on a server. Is Tomcat a more advanced replacement for Jserv, or are they both up to date alternate means of handling servlets?
Servlets can be run on any servlet engines. Tomcat, Jserv are web servers compliant with the Sun Java Servlet APIs.
Yes, I think Tomcat is more advanced than JServ. Tomcat version 5 implements the Servlet 2.4 specification, whereas JServ implements the servlets 2.0 specification.

3)I want to send a stream of data from an applet to a java program on the server, and have the Java program store the data in a file. Must this Java program be a 'servlet' handled by Tomcat or Jserv?
Servlets can be regarded as service extensions added to a server. Servlets takes a request, process it and sends a response back.
Your applet sends a request containing data to the web server, the program that process this request (storing in a file) in the server is a Servlet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic