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 |
Explain wait() method of object class ?
Difference between JVM and JRE?
What is linked hashset and its features?
Is arraylist an object in java?
What is difference between null and void?
What is lambda in java?
What do heavy weight components mean in java programming?
Why Static variable required in java?For ex,class A { static int a; int b; } Why static is required?
what ide u r using and wat version, how wil u build the project etc ?
What is Runtime class and its purpose?
Write a program to find maximum and minimum number in array?
I have one Shopping cart application, i that i have selected some items, while clicking submit button by mistake i have clicked twice or trice, that time items are selected twice or trice. Actually i want only one copy of items but its selected twice or trice. So how can we avoid this problem?