People, I am starting to preapare for SCWCD exam from today. I have taken a look at some JSP basics today and have this question.. A declaration is where you declare a variable or method. You can do the same thing using the scriptlets. What is the difference? Or is it just two ways of doing it?
Declaration it's like in regular java class instance variable declaration and method declaration. Everything what is inside scriplet goes into _jspService method. As you already know you can not declare methods inside another methods.
Yes , Every variable u declare in declaration is instance variable(so need not initialized). --every variable declared in scriptlet goes into _jspService method as "LOCAL VARIABLE" hence need explicit initialization. -- u can't declare a method in scriptlet (because a method can't be declared inside another method(_jspService). Regards, Ajay Rana