servlet programming indiaHelp with ASP programming     servlet programming indiaDiv X -The New Star      servlet programming indiaWhy Flash ?      servlet programming india Useful Techniques in Web Graphics
  Web Programming
servlet programming india Useful techniques in Flash      servlet programming india Quality Seal
Web Site Development
Maintenance & Hosting
Consultancy Services
Resource Centre
About Us
Contact Us
Help with Servlet Programming

Here is some frequently asked  questions by the Internet software developers about Java Servlet programming and its answers . 

1. Difference between CLASSPATH and PATH

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)

throws IOException{response.addCookie(new Cookie("cookie_name", "cookie_value"));}

4. Single-threading and multithreading in servlets

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.

More Links,

Home     About us     Contact us