What Happens when the index.jsp Page is Requested by the Client, if this page included instance variable and included in another jsp page. .

A JSP Page, Include.jsp, has a Instance Variable “int a”, now this Page is Statically Included in Another JSP Page, index.jsp, which has a Instance Variable “int a” Declared. What Happens when the index.jsp Page is Requested by the Client. Compilation error, as two variables with same name can’t be declared. This happens because, when … Read more

What Happens when a Page is Statically Included in Another JSP Page

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. When a page is statically included in another JSP page in Java, it means that the content of one JSP page is … Read more

Why is _jspService() Method Starting with an ‘_’ while other Life Cycle Methods do not?

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. In JavaServer Pages (JSP), the _jspService() method is a special method that handles … Read more

Can we Override the jspInit(), _jspService() and jspDestroy() Methods

We can override jspinit() and jspDestroy() methods but not _jspService(). In advanced Java, specifically when dealing with JavaServer Pages (JSP), you cannot override the jspInit() and jspDestroy() methods. These methods are part of the HttpJspPage interface, which is implemented by the container when it translates a JSP page into a servlet. The jspInit() method is … Read more

How is JSP Include Directive Different From JSP Include Action.

When a JSP include directive is used, the included file’s code is added into the added JSP page at page translation time, this happens before the JSP page is translated into a servlet. While if any page is included using action tag, the page’s output is returned back to the added page. This happens at … Read more