Hi all, When I declare this as global it gives me an error where as I do not declare the variable as gloabl it runs with out error Error: <%! int a = 10; String a = request.getParameter("name"); %> <input type=text value = "<%=a%>" >
No Error <% int a = 10; String a = request.getParameter("name"); %> <input type=text value = "<%=a%>" > Regards, Aakash
"request" object is avilable only inside the service and related method like doPost, doGet methods. When you declare it global(class level) variable. The variable will be out side the service method of jsp. Hence "request" object do not have any value assigned, hence you are getting error. -arun [ January 28, 2003: Message edited by: Arun Boraiah ]
Arun is absolutely right. request is one of the implicit variable. request object is passed as an argument to _jspService() method by container, when browser requests for a particular JSP. Whereas u r using request variable at global phase, which is erroe porn. Hope this helps, Dharmin
SCJP2 (93%),SCWCD(88%)<br />-------------------------------<br />Never under estimate yr self, just represent yr profile in proper manner.
Joined: Aug 28, 2002
how did you not get an error there, aakash, when you declared a variable twice in the same scope?