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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:07:47+00:00 2026-06-08T21:07:47+00:00

My application is build with jsp pages and jquery.mobile. I use a Java function

  • 0

My application is build with jsp pages and jquery.mobile. I use a Java function to check login status and do a redirect when that’s not OK from within a Bean like this:

public String getMenu(HttpSession session, HttpServletResponse response, MenuType menuType, CurrentPage currentPage)
{
    if (session.getAttribute("state") == LoginChecked.UNDEFINED))
    {
        response.sendRedirect("../index.jsp");

        return null;
    }
    else
    {
        ...

The problem is that the redirect to index.jsp is handled by jquery.mobile as an ajax reload of the content of the page, and not a complete redirect.

How can I force a complete reload of the browser of the index.jsp page?

— ADDED —

Within html this would be solved with the “rel” attribute like this, so I would need some kind of method to use this rel from within my Java sendRedirect:

<a href='../index.jsp' data-role='button' data-icon='plus' rel='external'>
  • 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-08T21:07:49+00:00Added an answer on June 8, 2026 at 9:07 pm

    I was looking at solving a similar problem myself recently (actually redirecting when an AJAX request is redirected), and found a very good answer on here that I apparently didn’t bookmark. However, having successfully implemented it for myself, I’ll share the approach I took based on that answer.

    The first stage was to identify AJAX requests so they can be handled differently to standard requests. This can be done by checking the value of the X-Requested-With request header; a value of XMLHttpRequest indicates an AJAX request. In the case of a standard request, we proceed with the redirect as normal. In the case of handling an AJAX request, rather than proceeding with the redirect, what I did is set a response header to signify that a redirect would have occurred, and set its value to the URL that I want to redirect to.

    Then, I used the following jQuery code to check all completed AJAX requests, and redirect when appropriate:

    $(document).bind('ajaxComplete', function(event, xhr, options) {
        var redirectHeader = xhr.getResponseHeader('YourHeader');
        if(xhr.readyState == 4 && redirectHeader != null) {
            window.location.href = redirectHeader;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build reusable JSP components for an application that I am building.
I am trying to build a quick application with Java/Hibernate that uses Google Maps
I'm currently building a Spring MVC application. I was looking to use JSP pages
I am trying to build a Web application using jQuery Mobile. When testing on
I have a WorldWind application build based on the Java SDK. It has a
I have a web application build on PHP that (does some processing and) displays
I have a web application build in Django + Python that interact with web
I've build a simple SpringMVC login system that works fine, but I want to
I have the following structure in a Java Web Application: TheProject -- [Web Pages]
Everyone who's done any web application development in Scala knows that you can use

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.