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 |
Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?
Can a method be static?
Is string a wrapper class?
What is thread pool in java with example?
Name and explain the types of ways which are used to pass arguments in any function in java.
What is difference between static class and singleton pattern?
Is a boolean variable?
What is the purpose of checked and unchecked exceptions in JAVA?
Explain reverse a linked list iterative solution in java?
What are the features of junit?
Can a abstract class be defined without any abstract methods?
What is the difference between stringbuffer and stringbuilder?