Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

GIAC Exam GSNA Topic 2 Question 57 Discussion

Actual exam question for GIAC's GSNA exam
Question #: 57
Topic #: 2
[All GSNA Questions]

You work as a programmer for uCertify.Inc. You have a session object named session1 with an attribute named Attribute1, and an HttpSessionBindingEvent object binding1 bound to session1. Which of the following will be used to retrieve Attribute1?

Each correct answer represents a complete solution. Choose all that apply.

Show Suggested Answer Hide Answer
Suggested Answer: A, D

The following two code are used to retrieve Attribute1:

1.Object obj=session1.getAttribute('Attribute1'); The getAttribute() method is used to retrieve the bound object with the specified

name in this session, or null if no object is bound under the name.

2.Object obj=binding1.getSession().getAttribute('Attribute1'); The getSession() gets the current valid session associated with this

request.

Answer E and C are incorrect. These code are invalid because the getAttribute() method returns an object instead of a long object or

a String object.

Answer B is incorrect. The HttpSessionBindingEvent object cannot use the getAttribute() method.


Contribute your Thoughts:

Elbert
2 months ago
Option D, all the way! It's like the session is handing you the attribute on a silver platter.
upvoted 0 times
Maurine
11 days ago
User2: Yeah, I see what you mean. Option D does seem straightforward.
upvoted 0 times
...
Kristeen
21 days ago
User3: I agree with User1, Option D seems like the best choice.
upvoted 0 times
...
Rodolfo
1 months ago
User2: I think Option A is also correct.
upvoted 0 times
...
Dulce
1 months ago
Option D is the way to go!
upvoted 0 times
...
...
Hubert
2 months ago
Hey, I've got a hunch that option A is the way to go. It's like a treasure hunt, but with Java objects!
upvoted 0 times
...
Serina
2 months ago
Hold up, are we sure we can't use option E? I'm feeling adventurous and want to try the String approach.
upvoted 0 times
Erasmo
1 months ago
E) String str1=session1.getAttribute(Attribute1);
upvoted 0 times
...
Lavelle
1 months ago
D) Object obj=session1.getAttribute(Attribute1);
upvoted 0 times
...
Karol
1 months ago
A) Object obj=binding1.getSession().getAttribute(Attribute1);
upvoted 0 times
...
...
Lewis
2 months ago
Oooh, option C looks tempting. But wait, why do I need to cast it to a Long? That's a bit sketchy.
upvoted 0 times
Adelle
2 months ago
Yeah, option D seems like the safest choice here.
upvoted 0 times
...
Keneth
2 months ago
Ah, that makes sense. Thanks for clarifying!
upvoted 0 times
...
Francesco
2 months ago
I think we should go with option D to retrieve Attribute1.
upvoted 0 times
...
Ashlyn
2 months ago
Maybe it's because the attribute is stored as a Long data type.
upvoted 0 times
...
Lajuana
2 months ago
Maybe it's because the attribute is stored as a Long data type.
upvoted 0 times
...
Huey
2 months ago
Option C is tempting, but why do we need to cast it to a Long?
upvoted 0 times
...
Huey
2 months ago
Option C is tempting, but why do we need to cast it to a Long?
upvoted 0 times
...
...
Lottie
3 months ago
I'm not sure, but I think it might be A and D both. We can try both options to see which one works.
upvoted 0 times
...
Inocencia
3 months ago
I'm feeling lucky with option B. Who needs a session when you've got that binding object, am I right?
upvoted 0 times
Willie
1 months ago
True, it's always good to double check before making a decision.
upvoted 0 times
...
Jaleesa
2 months ago
I'm not so sure, maybe we should consider other options as well.
upvoted 0 times
...
Eun
2 months ago
I agree, that binding object seems pretty powerful.
upvoted 0 times
...
Ardella
2 months ago
I think option B is the way to go.
upvoted 0 times
...
...
Alyce
3 months ago
I believe it's D, because we need to retrieve the attribute from the session object directly.
upvoted 0 times
...
Curtis
3 months ago
Hmm, I think option D is the way to go. Can't go wrong with a good old session.getAttribute().
upvoted 0 times
Olga
2 months ago
I think option A is also correct, using binding1.getSession().getAttribute().
upvoted 0 times
...
Alita
2 months ago
I agree with you, option D is the correct one.
upvoted 0 times
...
...
Peggy
3 months ago
I think the correct answer is A.
upvoted 0 times
...

Save Cancel