• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

JPilot mock Ques jsp:useBean

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,
here is a question from JPilot exam,

Which of the following are valid uses of the <jsp:useBean> action?
A.
<jsp:useBean id="myBean" class="MyBean" scope="session">
B.
<jsp:useBean id="myBean" class="MyBean"/>
C.
<jsp:useBean id="myBean" class="MyBean" beanName="SomeOtherBean"/>
D.
<jsp:useBean id="myBean" type="MyBean">

My answers were A and B, but it says B and D..
why so?
what is wrong with A??if you say A is not ending with a forward slash"/" but its the same with D. and why is D selected as correct ans?

thanks,
mallika
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as my knowledge goes, D is wrong since if only type attribute is specified without class attribute, then bean should exist already and hence jsp:useBean should have closing tag.
Correct me if I am wrong.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could you please let me know the jpilot exam link ..for mock SCWCD exam.


as i am planning to take up the exam by end of this month..
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think A is incorrect only because of not having a closing tag.
B is correct, C is incorrect because Class and beanName cannot exist together.D is correct and i dont think if a bean is already present as is the case with D, the tag should be closed.(They are 2 different things. If this is wrong pls let me know y?)
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well given answers are correct ie B & D.

Option A: <jsp:useBean> syntax is wrong (it is not closed properly)
Option B: No problem with this
Option C: useBean attribute class & beaNmae can't appear together.
Option D: also a valid one.
 
Vani Chinta
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

should not closing a tag mean using either if these options
1. </jsp:useBean>
2.specify /> at the end. (eg: <jsp:useBean id="name" class="" type="" />

In both options A and D none of these two forms exist. Then why is A incorrect for not having a proper closing tag where as D is correct even though it also doesnot have one closing tag?
 
Vani Chinta
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
thanks for pointing that having a body and closing tags are two different things. I have doubt though.
should not closing a tag mean using either if these options
1. </jsp:useBean>
2.specify /> at the end. (eg: <jsp:useBean id="name" class="" type="" />

In both options A and D none of these two forms exist. Then why is A incorrect for not having a proper closing tag where as D is correct even though it also doesnot have one closing tag?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic