Win a copy of Head First Android this week in the Android forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

jspInit() method

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All methods need to be declared <%! %>
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So if i got this on exam <% jspInit() %> no way..cut it out , right?

Tks marc and Saurabh !
 
reply
    Bookmark Topic Watch Topic
  • New Topic