Can we implement an interface in JSP?

Showing Answers 1 - 14 of 14 Answers

Navaladi

  • Nov 4th, 2005
 

No we cant implement interface in jsp

  Was this answer useful?  Yes

Hi

i think only a class or interface can implement an interface and should implements all the methods defined in that interface but incase of  jsp the webcontainer is creating the instances and call the respective methods that is defined in that container.So we cant implement interfaces in jsp. 

  Was this answer useful?  Yes

lakshmi

  • Jan 12th, 2006
 

hi

page directive does have only a import attribute and it is not have implements.

So also jsp cannot implement an interface

<%@ page
          [ language="java" ]
          [ extends="package.class" ]
          [ import="{package.class | package.*}, ..." ]
          [ session="true | false" ]
          [ buffer="none | 8kb | sizekb" ]
          [ autoFlush="true | false" ]
          [ isThreadSafe="true | false" ]
          [ info="text" ]
          [ errorPage="relativeURL" ]
          [ contentType="mimeType [ ;charset=characterSet ]"   |   "text/html ; charset=ISO-8859-1" ]
          [ isErrorPage="true | false" ]
%>

  Was this answer useful?  Yes

Nitin

  • May 25th, 2006
 

Write a class  which emplement the interface and than use it

  Was this answer useful?  Yes

sowjanya

  • May 26th, 2006
 

here a class is implementing a interface but how can a jsp directly implement a interface..................................

  Was this answer useful?  Yes

deepak

  • May 26th, 2007
 

In "Page" directive you have "extends" attribute which allows you to extend you class by jsp.
They why i can not implement my interface......??????
First solution::     i can do it by implementing my interface by my class and then i can use "Page" directive which have "extends" attribute which allows me to extend my class by jsp.

But i want only to implement my interface, don't want to extend a class then what will i do??????????????

  Was this answer useful?  Yes

dsmanyam

  • Jul 29th, 2007
 

You can actually extend a class within a JSP right.

Now take a template class make that class implement all your required interfaces and then make your JSP extend that template class and provide the functionalitywithin the JSP for all the interface methods.

Try this way. I havent tried it but it should work this way.

  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