Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

HF Final Mock Q27

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 34
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HF means Head First Jsps and servlets
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic