This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello Tejas! When your jsp file is being converted into a servlet the jsp container puts all the code from the expressions, scriptlets and html in a service method called _jspService(). This method then talks to the service method of the created servlet. To understand this you need a basic understanding for how servlets work. This implies that all the variables being declared in scriptlets in a jsp file, are put into the same _jspService() method in the created servlet, and therefor they are local to that method. This also means that a variable that has been declared in a scriptlet in a jsp file, will be reachable from all the other scriptlets and expressions in the same file. If you need a global variable, then you should use declarations instead. Because when you declare a variable in a declaration, that variable will be put outside the _jspService() method and will therefor be global in this entire servlet. Hope this was helpful for you. Regards ------------------ Dominic Steng�rd Sun Certified Java 2 Programmer ------------------
[This message has been edited by Dominic Steng�rd (edited May 30, 2001).]