• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding implicit object

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,this is Y.Rama Krishna.

I have small problem regarding Implicit objects.
when in use out object in the scriplet tag it is not giving any error.but if i have used out object in a method declaration.it is saying out is not recognized.

may i know why this problem coming to me.i have also placed the code below.
please try to give me a clear idea why its not accepting in a method declartion.



with regards,
rama krishna.y


[BPSouther: Added code tags]
[ February 08, 2008: Message edited by: Ben Souther ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The implicit variables are not available to code within the <%! ... %> tag.

Unless you really understand that tag and have a very specific reason for using it, it is a good idea to avoid it altogether.
Any variables declared in that tag will become instance variables in your generated servlet and won't be thread safe. Also, as you've seen, you can't use the implicit objects in there.

These days, the accepted best practice is to avoid scriptlets altogether and perform all of your business logic and flow handling in a controller servlet and/or plain old Java objects. EL and JSTL give us just enough power to work the results of these objects without the need to resort to writing Java code in our JSPs.
[ February 08, 2008: Message edited by: Ben Souther ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic