Can we declare static variables in JSP page.

Answer Posted / rajender

yes

we should do in jsp declarative tag only.if we specify
variables in declaration tag, it belongs to class.
<%! static int i=0; %>

and u can not define static variable in scriptlet(<% %>).
as we know that we can not declare a static variable in a
method.

Is This Answer Correct ?    42 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do weakhashmap works?

837


What are the three parts of a lambda expression?

733


What is a for loop in java?

811


What is the use of keywords in java?

759


How can we pass argument to a function by reference instead of pass by value?

812


What is final variable?

689


How to call one constructor from the other constructor ?

800


How arrays are stored in memory in java?

707


Can we convert list to set in java?

727


What is diamond operator in java?

709


How do you allocate memory to object?

712


What is java in detail?

821


How do you sort a list in java?

787


Does java set allow duplicates?

764


What do you know about the garbage collector in java?

804