Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Declare methods within Scriptlets  RSS feed

 
Vidya Vemmelesseril
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can we declare methods inside Scriptlets in JSP ?

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65825
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scriptlets? In 2010? Are you kidding?

Do you also use stone knives and bearskins?

Let's move out of the Stone Age and write JSPs properly using the JSTL and EL instead of scriptlets which have been discredited for over 8 years now.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65825
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But to answer your question, yes, you can declare methods using scriptlet declarations. But don't. It's like trying to use vacuum tubes.
 
Vidya Vemmelesseril
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From what i have read, the java code in the scriptlet will be available in the _jspService() method once jsp is converted to servlet. So what happens to the methods we declare in the scriptlet?
Even though we don't use scriptlets nowadays it is still part of the certification exam objectives.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65825
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vidya Vemmelesseril wrote:From what i have read, the java code in the scriptlet will be available in the _jspService() method

That is not true of scriptlet declarations. Scriptlet declarations are placed at class level in the generated servlet.

Even though we don't use scriptlets nowadays it is still part of the certification exam objectives.

This is not a certification forum. If you have certification questions, be sure to post in the appropriate location.
 
Vidya Vemmelesseril
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your reply. I'll make sure that i post my questions in the appropriate forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!