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 meant by string pooling?

12 Answers   Oracle, Polaris, Tribal Fusion, Wipro,


public class Test { public static void main(String ar[]) { Integer a = 10; Integer b =10; Integer c = 145; Integer d = 145; System.out.println(a==b); System.out.println(c==d); } }

7 Answers   iGate,


What is the purpose of using java.lang.class class?

0 Answers  


What is 'finally' method in Exceptions?

4 Answers  


What is protected and friendly?

1 Answers  






Explain about GridBag Layout?

1 Answers  


What is the alternate of 'Inheritance' ?

4 Answers   CybAge, HCL,


how we can make a write-only class in java?

0 Answers  


How can we create a synchronized collection from given collection?

0 Answers  


What is arraylist e?

0 Answers  


In Inheritence concept, i have a static method in super class and i am inheriting that class to one sub class.in that case the static method is inherited to sub class or not????

12 Answers   Accenture,


Why arraylist is used in java?

0 Answers  


Categories