• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPilot mock Ques jsp:useBean

 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • 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
 
Vani Chinta
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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.
 
ashwini agarwal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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..
 
Muralidhar Adhikarla
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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?)
 
Abhishek Sharma
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic