• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF Final Mock Q27

 
Ranjit Jana
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page no 813.


The question says Redirect Http Request.

That means same request should be forwarded to next URL.

It is only possible to forward the same request by using Option D

Option A and C will create new Request Objects.

Await your response.

Regards.
--------------------------
Question @7 How would you redirect an HTTP request to another URL ?
(choose all that apply)

A(marked) response.sendRedirect("/anotherUrl");
C(marked)response.sendRedirect(response.encodeRedirectURL("\anotherURL");

D(not marked)
RequestDispatcher dispatcher = request.getRequestDispatcher("\anotherURL");
dispatcher.forward(request, response);

-------------------
I better frame it in this way what does the redirect Http request actually mean.
 
Francois Roland
Ranch Hand
Posts: 34
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably the author of this question was referring to the HTTP request as the user sending an HTTP request to the application server. I think that you refer to the HttpServletRequest instance that is created whenever an application server receives an HTTP request.

Looking at all the questions I've already seen in mock exams, the term 'redirect' is always opposed to 'forward'.

Redirect means that the application server sends a response to the client with instructions to ask for a new URL location. Forward means that your servlet (or JSP, which is a servlet anyway) asks another resource to complete the request processing.

Forward is always hidden from the client, redirect is never.
 
muthulingam Jayakanthan
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me to get this mock exam resource, and What you mena by page number and which book u are referring. Are there any e copy to refer the pages and mock exam
 
Ranjit Jana
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HF means Head First Jsps and servlets
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic