• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using interface in JSP

 
Abrahim Daver
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I use a java interface in a jsp page, If yes, How can I use that.
Thanks
Abra
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would you want to do with interfaces in JSP?

JSPs are best used as markup templates for output that has been built and processed in Servlets and Beans. Try to keep any real heavy programming code out of them.
 
Abrahim Daver
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its kind of question asked in an interview to my friend, hence I am a bit excited to know about it.

Thanks,
Abra
 
Jon Emerson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, well all JSP tags must implement the javax.servlet.jsp.tagext.Tag interface -- so just by using some tag libraries you're using interfaces. Then the page itself when translated into a javax.servlet.Servlet (also an interface) implements javax.servlet.jsp.JspPage.

Therefore, while developing JSP pages you're both implementing interfaces and calling into interfaces.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a really silly interview question -- aren't most of them -- but an answer such as Jon's at least lets the interviewer know that you know something about JSPs and how they work under the covers.
[ March 09, 2006: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!