• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SCWCD questions

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Chloe Chan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frits and Parth

Thank you both for your replies!

Chloe
 
reply
    Bookmark Topic Watch Topic
  • New Topic