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 8427061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:41:46+00:00 2026-06-10T04:41:46+00:00

I am trying to redirect the user from one jsp page to another jsp

  • 0

I am trying to redirect the user from one jsp page to another jsp page after making him wait for 10 seconds or 10000 milliseconds. But there is a redirect as soon as the page is opened in the browser. Why is this is so ? Is there anything wrong in the following code ? I am calling the redirectFunction which does the redirect.

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP - 1</title>
    <script>
        function redirectFunction() {
            <% response.sendRedirect("jsp-2.jsp"); %>
        }
    </script>
</head>

<body>
    <h1>
        Wait while you are redirected...
    </h1>
    <script type="text/javascript"> 
        setTimeout(redirectFunc,10000); // wait for 10 seconds,then call redirectFunc
    </script>
</body>

  • 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-06-10T04:41:47+00:00Added an answer on June 10, 2026 at 4:41 am

    You sends redirect exactly from server that`s why it fired immediatelly.

    If you want to fire redirect after 10 seconds than you need to change your code:

    function redirectFunction() {
        window.location.href = "jsp-2.jsp"
    }
    

    and setTimeout(redirectFunction,10000);

    Actually when you call <% response.sendRedirect("jsp-2.jsp"); %> Java server sets http code 302 to your http response, and header Location: jsp-2.jsp
    And browser redirects to page specified in Location header immediately.

    Hope it helps.

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

Sidebar

Related Questions

We've been trying to redirect from one action to another, hoping that data would
I´m trying to redirect to an action from one controller to another if something
I'm having an issue with trying to redirect to another page when a user
I'm trying to redirect users of a web page to one of two different
Possible Duplicate: How to redirect from one URL to another URL? I have the
I'm trying to redirect this page Page to a Jquery mobile website that I'm
I'm trying to redirect to a .php page if the $validForm variable is TRUE.
I am trying to redirect to the create method of another controller. However, I
I'm trying to direct the user to a certain page on my site (VB,
Here is my question: I am wanting to redirect users from one subdomain while

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.