Skip to main content

Posts

Showing posts from September, 2012

Difference Between GET and POST methods

GET: 1) Data is appended to the URL. 2) It is a single call system. 3) Maximum data that can be sent is 256. 4) Data transmission is faster. 5) This is the default method for many browsers.  6) GET method have not security because of data view in address bar. For ex: we can not use this method for checking log in. 7) We can bookmark link with this method. 8) Server can log all action. 9) because of server log, we can pass 255 char. as query  string. 10) It can store only 18 form variable. POST: 1) Data is not appended to the URL. 2) It is a two call system. 3) There is no Limit on the amount of data.That is characters any amount of data can be sent. 4) Data transmission is comparatively slow. 5) No default and should be Explicitly specified. 6) We can not bookmark page link. 7) We can pass unlimited data by this method as query string. 8) It is more secure but slower as compared to GET. 9) POST form contents are passed to the script as an input file.

How To Optimize Your Site With GZIP Compression

Compression is a simple, effective way to save bandwidth and speed up your site. I hesitated when recommending gzip compression when speeding up your javascript because of problems in older browsers . But it's the 21st century. Most of my traffic comes from modern browsers, and quite frankly, most of my users are fairly tech-savvy. I don't want to slow everyone else down because somebody is chugging along on IE 4.0 on Windows 95. Google and Yahoo use gzip compression. A modern browser is needed to enjoy modern web content and modern web speed -- so gzip encoding it is. Here's how to set it up. Wait, wait, wait: Why are we doing this? Before we start I should explain what content encoding is. When you request a file like http://www.yahoo.com/index.html , your browser talks to a web server. The conversation goes a little like this: 1. Browser: Hey, GET me /index.html 2. Server: Ok, let me see if index.html is lying around... 3. Server: Found it!

Life cycle of Servlet

The life cycle of a servlet can be categorized into four parts: Loading and Inatantiation:  The servlet container loads the servlet during startup or when the first request is made. The loading of the servlet depends on the attribute <load-on-startup> of web.xml file. If the attribute <load-on-startup> has a positive value then the servlet is load with loading of the container otherwise it load when the first request comes for service. After loading of the servlet, the container creates the instances of the servlet. Initialization:  After creating the instances, the servlet container calls the init() method and passes the servlet initialization parameters to the init() method. The init() must be called by the servlet container before the servlet can service any request. The initialization parameters persist untill the servlet is destroyed. The init() method is called only once throughout the life cycle of the servlet. The servlet will be available for service if it

Methods of Servlets

A Generic servlet contains the following five methods: init() public void init(ServletConfig config) throws ServletException The  init() method  is called only once by the servlet container throughout the life of a servlet. By this init() method the servlet get to know that it has been placed into service.  The servlet cannot be put into the service if  The init() method does not return within a fix time set by the web server.   It throws a ServletException Parameters - The init() method takes   a  ServletConfig  object that contains the initialization parameters and servlet's configuration and throws a  ServletException  if an exception has occurred. service() public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException Once the servlet starts getting the requests, the service() method is called by the servlet container to respond. The servlet services the client's request with the help of two objects. These two objects jav

Servlet Container

A servlet container is nothing but a compiled, executable program. The main function of the container is to load, initialize and execute servlets. The servlet container is the official Reference Implementation for the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed by Sun under the Java Community Process. A container handles large number of requests as it can hold many active servlets, listeners etc. It is interesting to note here that the container and the objects in a container are multithreaded. So each object must be thread safe in a container as the multiple requests are being handled by the container due to the entrance of more than one thread to an object at a time. Note : A Servlet container may run stand alone i.e. without a web server or even on another host. We can categorize the servlet containers as: I. A simple servlet container is not fully functional and therefore it can only run very simple s

What is Java Servlets?

Servlets are server side components that provide a powerful mechanism for developing server side programs. Servlets provide component-based, platform-independent methods for building Web-based applications, without the performance limitations of CGI programs. Unlike proprietary server extension mechanisms (such as the Netscape Server API or Apache modules), servlets are server as well as platform-independent.  This leaves you free to select a "best of breed" strategy for your servers, platforms, and tools. Using servlets web developers can create fast and efficient server side application which can run on any servlet enabled web server. Servlets run entirely inside the Java Virtual Machine. Since the Servlet runs at server side so it does not checks the browser for compatibility. Servlets can access the entire family of Java APIs, including the JDBC API to access enterprise databases.  Servlets can also access a library of HTTP-specific calls, receive all the benefits of