Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7581081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:06:39+00:00 2026-05-30T18:06:39+00:00

How to redirect Request object using getRequestDispatcher() , which located in another context? Or

  • 0

How to redirect Request object using getRequestDispatcher(), which located in another context? Or how I can redirect data that stored inside Request object to another JSP? Mehod of HTTP protocol must be same (i.e. if initial method – POST, then i must redirect with POST. So sendRedirect() not applicable)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:06:41+00:00Added an answer on May 30, 2026 at 6:06 pm

    The following is the way of setting the data in the Request object .And getting the Value in the another page by using request.getAttribute() method.The sample code is :

    RequestDispatcher rd = request.getRequestDispatcher("newpage.jsp");
      request.setAttribute("msg","Welcome");
     rd.forward(request, response);
    

    And It can also be used with ServletContext

      ServletContext context= getServletContext();
      RequestDispatcher rd= context.getRequestDispatcher("/LoggedIn");
      rd.forward(request, response);
    

    I dont think that the method type must same.Its an object of type Request and it can be accessed within the Context.And the difference between SendRedirect and Forward is that

    In forward()

    1. we pass request and response object so our old request object is present on new resource which is going to process our request.

    2.It is accessed within the same server ,another resource could be any servlet, jsp page any kind of file.

    In sendRedirect() :

    1.client request to some other location,the new location is available on different server or different context.

    2.It is visible in browser as a new request .It can also be called as the Client Redirect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to redirect/forward a Pylons request. The problem with using redirect_to is that
Okay I have this RewriteRule which is supposed to redirect any request for the
I am using ASP.NET 2.0 C#. I want to redirect all request for my
Suppose we have the xhr 'POST' request that returns 'redirect' status code. In that
I tried some work using http handler and found that we can not execute
I'm try to redirect any request to mydomain.com/video/(.*) to video.mydomain.com/$1. I have the following
What happens if the browser receives a redirect response to an ajax request?
I'm using Mod Rewrite for IIS 7.0 from iis.net and want to redirect requests:
I want to redirect all requests for index.html|php|php5 to http://www.domain.co.uk/ using mod_rewrite and I've
I'm wondering how to send custom headers using a redirect, currently with no success.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.