A JSP page, include.jsp, has a instance variable "int a", now this page is statically included in another JSP page, index.jsp, w

Q

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?

✍: Guest

A

Compilation error, as two variables with same name can't be declared. This happens because, when a page is included statically, entire code of included page becomes part of the new page. at this time there are two declarations of variable 'a'. Hence compilation error.

2013-08-16, 2650👍, 0💬