RequestDispatcher: server-side redirect with request and response objects. sendRedirect : Client-side redirect with new request and response objects.
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.
Cookie mycook = new Cookie("name","value");
Cookie killmycook = new Cookie("mycook","value");
An include directive tells the JSP engine to include the contents of another file (HTML, JSP, etc.) in the current page. This process of including a file is also called as static include.
: Used to include static resources during translation time. : Used to include dynamic content or static content during runtime.
No problem! The use Bean action specifies the beanName attribute, which can be used for indicating a serialized bean.
A couple of important points to note. Although you would have to name your serialized file "filename.ser", you only indicate "filename" as the value for the beanName attribute. Also, you will have to place your serialized file within the WEB-INFjspbeans directory for it to be located by the JSP engine.
ServletContext: Gives the information about the container
PageContext: Gives the information about the Request
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.
Use the following ways to pass control of a request from one servlet to another or one jsp to another.
The RequestDispatcher object â€˜s forward method to pass the control.
The response.sendRedirect method