Can we declare static variables in JSP page.
Answers were Sorted based on User's Feedback
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 |
Answer / vijayakumar chinnasamy
In Declaration tag (<%! -- %>), you can able declare the
static variable,class, define methods.
| Is This Answer Correct ? | 23 Yes | 4 No |
Answer / srinu
yes we declare the varible as static in a jsp.we declare the
static varible in the declaration tag.
ex:-
<%! static int a=10;%>
| Is This Answer Correct ? | 12 Yes | 3 No |
What are the traverses in Binary Tree?
What modifiers can be used with a local inner class?
what is difference between type 4 driver and type 1 driver?
2 Answers CMC, CTS, IBM, JK Technosoft, Napier Healthcare,
What is the base class of all exception classes in java?
What is the destroy method?
Howmany number of objects we can store in an ArrayList. Is there any limit?
What are the advantages of encapsulation in java?
What is the difference between static and non-static variables in java programming?
Why isn’t there operator overloading?
What exactly is java?
Explain the significance of listiterator.
Where are variables stored?