Can we implements interface or extends class in JSP?

Showing Answers 1 - 7 of 7 Answers

bijan saha

  • Jun 21st, 2005
 

No , we can't implements interface or extends class in JSP

  Was this answer useful?  Yes

J. P. Naidu

  • Jul 27th, 2005
 

Yes u can do tht using <%@ page extend="package.className">

  Was this answer useful?  Yes

Vaish

  • Jul 29th, 2005
 

U can Extend class in JSP but,cann't implement interface.

  Was this answer useful?  Yes

Pchal

  • Aug 11th, 2005
 

You cannot extend any class in JSP because a JSP has no value to it on its own. It will only be useful when converted to a servlet and every servlet has to extend HTTPServlet. In this case HttpJspBase 
 
According to Java Language spec a class can extend one and only one class. So " No " a Jsp cannot extend any class. 
 
But a jsp can be made to extend our own servlet instead of container generated servlet by using 
 
<%@ page extend="package.className">  
 
but this servlet must satisfy all the rules that apply for the container generated HttpJspBase Servlet 

  Was this answer useful?  Yes

Shiv

  • Feb 18th, 2007
 

We cannot implement an interface in a jsp but we can extend a class in JSP by using  extends attribute of the page directive.

extends="package.class"

The fully qualified name of the superclass of the Java class file this JSP file will be compiled to. Use this attribute cautiously, as it can limit the JSP container's ability to provide a specialized superclass that improves the quality of the compiled file.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions