Difference Between Forward and Include in JSP

The <jsp:forward> action enables you to forward the request to a static HTML file, a servlet, or another JSP. <jsp:forward page=”url” /> The JSP that contains the <jsp:forward> action stops processing, clears its buffer, and forwards the request to the target resource. Note that the calling JSP should not write anything to the response prior to the … Read more

Difference Between JSP Include Directive and JSP Include Action

<%@ include file=”filename” %> is the JSP include directive.At JSP page translation time, the content of the file given in the include directive is ‘pasted’ as it is, in the place where the JSP include directive is used. Then the source JSP page is converted into a java servlet class. The included file can be … Read more

Advantages of JSP Over Servlet

Efficient: With traditional CGI, a new process is started for each HTTP request. If the CGI program does a relatively fast operation, the overhead of starting the process can dominate the execution time. With servlets, the Java Virtual Machine stays up, and each request is handled by a lightweight Java thread, not a heavyweight operating system … Read more

Types of Comments in JSP

There are two types of comments are allowed in the JSP. These are hidden and output comments. A hidden comments does not appear in the generated output in the html, while output comments appear in the generated output. Example of hidden comment: <%– This is hidden comment –%> Example of output comment:<!– This is output comment –> In JavaServer … Read more

Life Cycle Methods in JSP

  Life-cycle methods of the JSP are: jspInit(): The container calls the jspInit() to initialize the servlet instance. It is called before any other method, and is called only once for a servlet instance. _jspService():The container calls the _jspservice() for each request and it passes the request and the response objects. _jspService() method cann’t be … Read more