What is the Difference Between System.out & System.err output in a Servlet

System.out goes to ‘client side’ and is seen in browser, while System.err goes to ‘server side’ and is visible in error logs and/or on console. In Java, including Advanced Java, System.out and System.err are both instances of PrintStream that represent standard output and standard error streams, respectively. In the context of a Servlet: System.out (Standard … Read more

What is ServletContext

ServletContextInterface defines methods that a servlet can use to communicate to the Container. ServletContext Parameters are specified for entire application and are available for all servlets. ServletContext is also calledapplication object. ServletContext is used to obtain information about environment on which a servlet is running. There is one instance object of the ServletContext interface associated … Read more

Explain About ServletConfig Interface

ServletConfig a ServletConfig object is used to obtain configuration data when it is loaded. There can be multiple ServletConfig objects in a single web application. This object defines how a servlet is to be configured is passed to a servlet in its init method. Most servlet containers provide a way to configure a servlet at … Read more

How to Start Servlet Automatically

If present, calls the servlet’s service() method at the specified times. <run-at> lets servlet writers execute periodic tasks without worrying about creating a new Thread. The value is a list of 24-hour times when the servlet should be automatically executed. To run the servlet every 6 hours, you could use: <servlet servlet-name=”test.HelloWorld”> <run-at>0:00, 6:00, 12:00, 18:00</run-at> </servlet> … Read more

Why there is no Constructor in Servlet

Every java class will have aleast one constructor and servlets are no exception to this. But while using servlets ,we never instantiate the servlet rather the container does it for us by using the newInstance() defined in the Class class;  which in turn uses the empty(Default) constructor to create a new instance of the servlet. … Read more