User_86
User_86

Reputation: 275

can we extend multiple classes in jsp page using export attribute

We can define multiple attributes in a single page directive or we can have multiple page directives in a single JSP page. But can we extend multiple classes in any jsp page using extends attribute?

for eg:

<%@ page extends="Class1" %>
<%@ page extends="Class2" %>

Upvotes: 2

Views: 2704

Answers (1)

AlexR
AlexR

Reputation: 115378

extends Specifies a superclass that the generated servlet must extend

This means that writing <%@ page extends="Class1" %> is kind of equivalent to

class MyClass extends Class1 {}

because JSP page is compiled to java class with similar name (depending on container). Since java does not support multiple inheritance writing more than one JSP attribute extends must be illegal.

Upvotes: 3

Related Questions