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

Declare methods within Scriptlets

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

Can we declare methods inside Scriptlets in JSP ?

 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
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