Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

3 questions

 
shi lei
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
---2.question :
the "acme inc" plans to design a web application with an enjoyable user experience,for all kinds of

Internet browsers.to do this,there is a need to read the "user-agent" header and determind the flow of

action accordingly.identify the EL fragment that can be used to identify the same.select two choices.

a. ${headerValues['user-agent'][0]}
b. ${header['user-agent']}
c. ${headerValues.user-agent.[0]}
d. ${header.user-agent}

i think b,d

---3 question:
A web site stores loged on user's name in the session variable "name".which of the following core JSTL

fragmetns will print "welcome xxx" when a user xxx is logged on and "welcome guest" otherwise.select three

choices.
a. welcome <c ut value="${sessionScope.name}" default="guest"/>
b. <c ut value="welcome &{sessionScope.name}" default="guest"/>
c. welcome <c ut value= "${sessionScope.name}">guest</c ut>
d. welcome <c ut value = "${sessionScope.name}" default="guest">guest</c ut>
e. welcome <c ut value= "${sessionScope.name}" default="guest" escapeXml="true"/>

which is right answer

i think a,c,e

---4 question:
Identify the true statements about the sendRedirect(STring url) method of the HttpServletResponse interface

.select two choices.
a. rediects to a different URL with the existing headers and content body.
b. sets appropriate headers and content body to redirect the client to a different URL.
c. accepts relative URL path or the context path.Container will translate it to valid URL.
d. this method should be called only after committing the response to the client.redirection before

committing causes IllegalStateException.

i think a,c
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

---2.question :
the "acme inc" plans to design a web application with an enjoyable user experience,for all kinds of

Internet browsers.to do this,there is a need to read the "user-agent" header and determind the flow of

action accordingly.identify the EL fragment that can be used to identify the same.select two choices.

a. ${headerValues['user-agent'][0]}
b. ${header['user-agent']}
c. ${headerValues.user-agent.[0]}
d. ${header.user-agent}

Option a and b are valid. Option c and d are invalid as the user-agent does not fit in the valid java identifier defination. that is you van not use '-' in the names.


---3 question:
A web site stores loged on user's name in the session variable "name".which of the following core JSTL

fragmetns will print "welcome xxx" when a user xxx is logged on and "welcome guest" otherwise.select three

choices.
a. welcome <c ut value="${sessionScope.name}" default="guest"/>
b. <c ut value="welcome &{sessionScope.name}" default="guest"/>
c. welcome <c ut value= "${sessionScope.name}">guest</c ut>
d. welcome <c ut value = "${sessionScope.name}" default="guest">guest</c ut>
e. welcome <c ut value= "${sessionScope.name}" default="guest" escapeXml="true"/>

which is right answer

i think a,c,e

Option b is also valid.

---4 question:
Identify the true statements about the sendRedirect(STring url) method of the HttpServletResponse interface

.select two choices.
a. rediects to a different URL with the existing headers and content body.
b. sets appropriate headers and content body to redirect the client to a different URL.
c. accepts relative URL path or the context path.Container will translate it to valid URL.
d. this method should be called only after committing the response to the client.redirection before

committing causes IllegalStateException.

i think a,c
My option is B and C.

Thanks
 
shi lei
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
question 4 ,why b is right?
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Redirection is happened at client browser. So the container send the target url and redirect status code ( not rember the exact status code) in headers to client to activate the redirection.

Thanks
[ July 13, 2006: Message edited by: Narendra Dhande ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic