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

When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

0 Answers  


Is vector synchronized in java?

0 Answers  


is java support call by reference and call by value, if supports please explain?

5 Answers  


What does  mean in regex?

0 Answers  


Is Constructor possible in abstract class in java ?

0 Answers   HCL,


What is hotjava?

0 Answers  


What are the three types of design patterns?

0 Answers  


Can try statements be nested?

3 Answers   Wipro,


What mechanism does java use for memory management?

0 Answers  


steps to connect with Oracle Databse using TYPE-2 Jdbc driver.

3 Answers  


What is protected access modifier?

0 Answers  


Which programming language is most secure?

0 Answers  


Categories