• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

can an interface be implemented in jsp

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can an interface be implemented in jsp
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mintoo,
You can't directly implement interface in JSP but surely you can have a indirect implementation by extending user defined class which intern implements(empty impplenmentation will also do) Interface you want.

e.g
public class JSPBaseImpl implements .......,......,ILogin(user defined Interface dot indicates some predefined interfaces this class should implement )

{
//define all methods
}


use page direcive as follows
<%@page extends="JSPBaseImpl" %>

i hope this helps otherwise feel free to revert back.





Shrinivas
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
can pls specify me why JSp specification impose a restriction behind
implementing Interface.
i mean why cannot we implement Interface in JSP


Thanks
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to?
Given the nature of a container managed JSP's lifecycle, I can't imagine a good reason to want to implement any other interfaces from one.
A JSP is not something you pass around.

There is the <%@ page extends=.... directive.
You could always implement your own JSP superclass and have it implement whatever you want.
 
    Bookmark Topic Watch Topic
  • New Topic