Here is some frequently asked questions by the Internet software
developers about Java Servlet programming and its answers .
1. Difference between CLASSPATH and
Many of them who are new in Java don't
know the difference between CLASSPATH and PATH. CLASSPATH is the
environmental variable defined for the Java run-time system. Java
run-time system is looking for class file in the directories which
you included in the CLASSPATH . PATH variable is separate from CLASSPATH.
Your system is looking for executable files in the directories that
are in PATH variable
2. Improving the performance of Servlet.
By deducing the use of expensive resources
use can improve the performance of your servlet. In general it is
a good idea to reduce the number of object you create in your servlet
code. If some object is expensive to create, then you can reuse
the object instead of creating one for each request and throw it
away. This technique is often called object pooling. For e.g.. Creating
a database connection object is very expensive. You can use object
pooling in the case of JDBC connection objects.
3. Sending cookies from a servlet
Adding a cookie to a browser is easy.
Cookies are represented by the javax.servlet.http.Cookie class.
Using the addCookie(Cookie) method you can sent cookies as part
of a HTTPServletResponse. The code is
public void doGet (HttpServletRequest
request, HttpServletResponse response)
4. Single-threading and multithreading
You should implement the javax.servlet.SingleThreadModel
interface if you require a single-threaded servlet. Because by default
servlets are multithreaded. Single-threaded model allows concurrent
execution of the servlet. But this can cause performance problems.