• 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Eduardo Cobian's mock question 4

Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given the following jsp line select the correct statements:
<% public void jspInit() { ...java code...} %>
1) It is a valid line that can be used to initialize the servlet that implements the jsp file.
2) It won't compile as no identifer can start with jsp not _jsp.
3) It will serve as the servlet initialization if the function's name is _jspInit.
4) There is no way to initialize a jsp's implementation class servlet.
correct answer is 1) , why?
i think the statement shuld be <% public void jspInit() { ...java code...} %> if the right answer is 1). what is your answer?
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same problem when doing this mock exams. I think, with intention of the author, the answer 1 is correct but the code should be
<%! public void jspInit() { ... } %>
(there was missing exclamation "!")
otherwise it would even compile because you can't declare method directly in the scriptlet section, as these go inside _jspService(..) method.
[ November 17, 2002: Message edited by: See El ]
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic