Can we declare static variables in JSP page.

Answers were Sorted based on User's Feedback



Can we declare static variables in JSP page...

Answer / 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

Can we declare static variables in JSP page...

Answer / vijayakumar chinnasamy

In Declaration tag (<%! -- %>), you can able declare the
static variable,class, define methods.

Is This Answer Correct ?    23 Yes 4 No

Can we declare static variables in JSP page...

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

Post New Answer

More Core Java Interview Questions

What is continuity of a function?

0 Answers  


Define immutable object?

0 Answers  


Is class forname reflection?

0 Answers  


How are this() and super() used with constructors?

9 Answers  


Differentiate between vector and array list.

0 Answers  


What is the difference between the ">>" and " >>>" operators in java?

0 Answers  


Why only one Class is public in one file? Explain in details. Thanks in Advance.

12 Answers  


Is 64bit faster than 32 bit?

0 Answers  


Is empty string in java?

0 Answers  


Explain java coding standards for variables ?

0 Answers  


How do you initialize an arraylist in java?

0 Answers  


What is a nested structure?

0 Answers  


Categories