my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes SCWCD questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "SCWCD questions" Watch "SCWCD questions" New topic
Author

SCWCD questions

Chloe Chan
Greenhorn

Joined: Aug 20, 2010
Posts: 3
Hello everyone, I am new to this website and so I would like to say "hi!"

I am preparing my SCWCD exam and I have a few questions qhich I am quite confused about. (I have 2 different answers from different sources!)
If anyone knows, could you possibly post a reply for me? Thanks a lot!

1. Given in a single JSP page:
<%@ taglib prefix='java' uri='myTags' %>
<%@ taglib prefix='JAVA' uri='moreTags' %>
Which two are true? (Choose two.)

A. The prefix 'java' is reserved.
B. The URI 'myTags' must be properly mapped to a TLD file by the web container.
C. A translation error occurs because the prefix is considered identical by the web container.
D. For the tag usage <jave:tag1/>, the tag1 must be unique in the union of tag names
in 'myTags' and 'moreTags'.

(Answer: one says A,C and one says A,B)
Anyone knows if the content of prefix is case sensitive?

2. Given that a scoped attribute cart exists only in a user's session, which two, taken independently, ensure the scoped attribute cart no longer exists? (choose two)

A. ${cart = null}
B. <c:remove var = "cart" />
C. <c:remove var = "${cart}" />
D. <c:remove var = "cart" scope = "session" />
E. <c:remove scope = "session"> cart </c:remove>
F. <c:remove var = "${cart}" scope = "session" />
G. <c:remove scope = "session"> ${cart} </c:remove>

(Answer: one says B,D and one says D,E)


3. A JSP page needs to set the property of a given JavaBean to a value that is calculated with the JSP page. Which three jsp:setProperty attributes must be used to perform this initialization? (Choose three)

A. id
B. val
C. name
D. param
E. value
F. property
G. attribute

(Answer: one says C,E,F and one says D,E,F)
I think it is C,E,F since according to the book Im working on, it says param and value cannot be set at the same time

Thank you for replying in advance!
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1529
    
  22

Hi Chloe,

Welcome to Javaranch!

Have a quick look at How to ask a question on javaranch
Please post the source of your question and do one posting per question.

The answers
1) It is A and B (prefix is case sensitive so JAVA is allowed)
2) I think it should only be D (var can never have a rtexprvalue, and is body-less, B is wrong because the default scope="page")
3) You are right C,E,F

Regards,
Frits
Chloe Chan
Greenhorn

Joined: Aug 20, 2010
Posts: 3
Hi Frits!

Thank you very much for your reply. I will be careful with posting next time!

For question 2, you mentioned that var can never have a rtexprvalue, by rtexprvalue, is it <%=xxx %> ? I know there is a tag associated with rtexprvalue.

On the other hand, from the book I have read, it says that if <c:remove> doesnt have its scope set, it will search for the var in the page, request, session, application scope (in that order)

I guess the question asked for two answers... so maybe there is something we have missed here?

Many thanks!
Chloe
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1529
    
  22

On the other hand, from the book I have read, it says that if <c:remove> doesnt have its scope set, it will search for the var in the page, request, session, application scope (in that order)

You are right! so B is also correct

According to the specs (jstl1.1)
If attribute scope is not specified, the scoped variable is removed according to the
semantics of PageContext.removeAttribute(varName). If attribute scope is
specified, the scoped variable is removed according to the semantics of
PageContext.removeAttribute(varName, scope).

and the PageContext API:
public abstract void removeAttribute(String name)
Remove the object reference associated with the given name from all scopes. Does nothing if there is no such object.


And your second question (rte = Run-Time Expression Value)
rtexprvalue, is it <%=xxx %> ?

Yes, and also EL, like ${abx}

Regards,
Frits
Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
1) A,B

2) B,D

3) C,E,F

On the other hand, from the book I have read, it says that if <c:remove> doesnt have its scope set, it will search for the var in the page, request, session, application scope (in that order)


no matter what order it searches in it will remove attribute from all the scopes it exists in.


Parth Tiwari
| Pursuing Bachelor of Engineering | OSUM Club Leader | SCJP 6 | SCWCD 5 |...
Chloe Chan
Greenhorn

Joined: Aug 20, 2010
Posts: 3
Hi Frits and Parth

Thank you both for your replies!

Chloe
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SCWCD questions
 
Similar Threads
Mock exam question
Question about JSTL (c:remove)
About c:remove
Usage of c:remove tag
removeAttribute doubt from mock exam