This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes sendRedirect - to what Path? example code enclosed! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "sendRedirect - to what Path? example code enclosed!" Watch "sendRedirect - to what Path? example code enclosed!" New topic
Author

sendRedirect - to what Path? example code enclosed!

Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
This is a continuation of the discussion from the other threads (started by faiza) re the path issues. Stating them in seperate threads so that we can discuss them without crossing lines with other methods.....
The sendRedirect method of HttpResponse object takes a string argument which represents a URLpath. This URLpath can be:
  • relative to the current ServletContext starting with a "/".
  • relative to the current ServletRequest starting with a name of the servlet/jsp, not starting with a "/".
  • an absolute path starting with http://....
  • can point to an absolute URL outside the scope of the current ServletContext or the current Server. See example code.


  • Any output (response) added to the response
    object before the redirect is cleared and the
    content of the redirected page is returned to
    the client. If the buffer is committed to the
    client before the redirect, the container should
    throw a IllegalStateException.
    Any content added to the response after the
    redirect is ignored by the container.
    The foll. code made me come to these conclusions...

    - satya
    [ February 03, 2002: Message edited by: Madhav Lakkapragada ]

    Take a Minute, Donate an Hour, Change a Life
    http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
    faiza haris
    Ranch Hand

    Joined: Oct 17, 2000
    Posts: 173
    Yup everything works!!!
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: sendRedirect - to what Path? example code enclosed!
     
    Similar Threads
    exam
    Path ... doubts!
    Another Mock Exam Question
    Hi *.* :)
    ejb is required