• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JSP query! Can anyone give solution for this

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question: For manageability purposes, you have been told to add a "count" instance
variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being
invoked. Which JSP code snippet must you use to declare this instance variable in the JSP Document?

A. <jsp:declaration>
int count = 0;
<jsp:declaration>
B. <%! int count = 0; %>
C. <jsp:declaration.instance>
int count = 0;
<jsp:declaration.instance>
D. <jsp:scriptlet.declaration>
int count = 0;
<jsp:scriptlet.declaration>

The answer for the above question was given as 'A' in the mock exam paper. But i think 'B' is the right answer.
Can anyone help me solve this?
Thanks in advance.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Srinivas,
In the question, it is mentioned that "add a "count" instance
variable to a critical JSP Document so that........" .

A JSP document is a JSP page written in XML syntax as opposed to the standard syntax. As per the standard syntax...option B is correct. Here we need to look for the XML syntax as it is mentioned as a JSP document. Hence Option A is correct.

Hope this helps.
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The Question is asked about JSP Document.

It means jsp is XML complaint. So it should be <jsp:declaration> </jsp:declaration>

it should not be<! int a=0;%>, this is not xml complaint.

Thanks,

Bennet Xavier. X
 
srinivas pola
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya... got it...
Thanks a lot
 
Something must be done about this. Let's start by reading this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic