• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock exam question?

 
raymond yadao
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
question from sybex web developer certification (chapter 9)
1. which of the following method can be overriden by the jsp author?
a. void jspInit()
b. void _jspService(HttpServletRequest request, HttpServletResponse response) throws ....
c. void jspDestroy()
d. none of the above
my answer is a and b.based from what i've read jspInit and jspDestroy can be overriden. _jspService should not be overriden.
but the book says that the correct answer is d.none of the above.Explanation jspInit() and jspDestroy() lacks the preceding _(underscore).could someone explain to me this?
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raymond,
I am not as yet fully clear about the life cycle of a JSP, need some ore studying but I have seen an example in the SCWCD Study Kit on page 169, where they over ride the jspInit() and jspDestroy() methods to connect to db and close the db connection respectively.
Therefore, I assume you can over ride both of those methods. I am not sure if you can override the _jspService(...) method, however, everything in the scriptlets ends up becoming part of the _jspService.
hth and sparks some useful discussion on the subject to clarify the subject matter.
 
Rakesh Jhamb
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello raymond,
we can always override jspInit() and jspDestroy(), though default implementations are provided, but u can if u want like ....
<%! public void jspInit() {
....
}
public void jspDestroy() { ..... }
%>
However, u cannot override _jspService() method. Also there is no underscore in front of jspInit() or jspDestroy().
Hope this helps.
 
raymond yadao
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.yeah i've read some books and on the internet that you can override the jspInit() and jspDestroy but not the _jspService().

raymond
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic