• 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

jspInit() method

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

can i overwrite the original "jspInit()" method just using scriptlet(<%%> , or is it mandatory to utilize declaration(<%! %> for that?

I mean, is it valid?

<%
public void jspInit(){

}

%>

Tks.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All methods need to be declared <%! %>
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Felipe,
By <% insert code here %> you are specifying that you want this code to be inserted inside the _jspService() method. So, doing <% jspInit(){} %> you mean that you want to declare the Init method inside the _jspService() method. Method decleration inside another method does not seem to be correct. So it is invalid. However if you do <%! jspInit() %> you mean that you have overriden the jspInit() method in the container generated servlet class. Now this class has two seperate method declerations, one for jspInit() which you can override and the container generated implementation of the _jspService() method.

I hope this helps you.

Regards,
Saurabh
 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So if i got this on exam <% jspInit() %> no way..cut it out , right?

Tks marc and Saurabh !
 
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic