• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jspInit() method

 
Steven Colley
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.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All methods need to be declared <%! %>
 
Saurabh Chaubey
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 !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic