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

Regarding implicit object  RSS feed

 
yakkala krishna
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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 ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!