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 data string?

0 Answers  


What are streams?

0 Answers  


Can java cast null?

0 Answers  


What is the meaning of nullable?

0 Answers  


What technique is carried out to find out if a particular string is empty?

0 Answers  






what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????

0 Answers   HCL, SAP Labs, Vital Soft,


give an example for encapsulation?

0 Answers   Aspire,


What is the purpose of stub and skeleton?

0 Answers  


What is the difference between this() and super()?

15 Answers   TCS,


What is a get method?

0 Answers  


What are the various access specifiers for java classes?

0 Answers  


What is the difference between Resultset and Rowset.

6 Answers   IBM, Wipro,


Categories