It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.
_jspService() method will be written by the container hence any methods which are not to be overridden by the end user are typically written starting with an '_'. This is the reason why we don't override _jspService() method in any JSP page.
Cookie mycook = new Cookie("name","value");
Cookie killmycook = new Cookie("mycook","value");
A jsp:useBean action may optionally have a body. If the body is specified, its contents will be automatically invoked when the specified bean is instantiated. Typically, the body will contain scriptlets or jsp:setProperty tags to initialize the newly instantiated bean, although you are not restricted to using those alone.
The following example shows the "today" property of the Foo bean initialized to the current date when it is instantiated. Note that here, we make use of a JSP expression within the jsp:setProperty action.
Yes , of course you can use the constructor instead of init(). Thereâ€™s nothing to stop you. But you shouldnâ€™t. The original reason for init() was that ancient versions of Java couldnâ€™t dynamically invoke constructors with arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you wonâ€™t have access to a ServletConfig or ServletContext.
ServletContext: Gives the information about the container
PageContext: Gives the information about the Request
A cookie, mycookie, can be deleted using the following scriptlet:
RequestDispatcher: server-side redirect with request and response objects. sendRedirect : Client-side redirect with new request and response objects.
Using errorPage attribute of page directive and also we need to specify isErrorPage=true if the current page is intended to URL redirecting of a JSP.