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 null in java?

0 Answers  


What is difference between public static and void?

0 Answers  


What are virtual methods?

1 Answers   TCS,


What is difference between Iterator and for loop

9 Answers   HP,


How the elements are organized in BorderLayout?

5 Answers  






Can classes declared using the abstract keyword cab be instantiated?

0 Answers   MCN Solutions,


Can a class have an interface?

0 Answers  


Does treeset allow null in java?

0 Answers  


What is jrmp?

0 Answers  


Explain in detail about encapsulation with an example?

4 Answers  


what do you mean by stream pipelining in java 8? Explain

0 Answers  


What is java object name?

0 Answers  


Categories