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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:35:18+00:00 2026-06-01T19:35:18+00:00

I have a web-based service implemented in Tomcat and using Tomcat container-based authentication. What

  • 0

I have a web-based service implemented in Tomcat and using Tomcat container-based authentication. What I’m trying to achieve is to have the login page appear differently depending on how the user got there. Specifically:

  • If the user clicks on the “login” button, I want the login page to just ask for a username and password. I’ve implemented the login button to simply take the user to the “logged in” page, and made that a secure page so that container login gets triggered.

  • If an unauthenticated user visits a page that requires authentication, I want the login page to also say “You must login to do this” or something like that.

So the problem is to make the controller or JSP for the login form aware of what the browser was requesting when it got redirected here. I’ve looked at the headers and other attributes in the request object, but I couldn’t see anything that would help.

Can anyone suggest a solution? Or maybe a different way to implement the “login” button that would avoid the problem?

  • 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-01T19:35:19+00:00Added an answer on June 1, 2026 at 7:35 pm

    You can use this to determinate the target of the original request:

    <%
    String value0 = (String)request.
                    getAttribute("javax.servlet.forward.request_uri");
    if(value0.contains("login_success.jsp")) {
        out.print("USER, LOG IN!");
    } else {
        out.print("USER, you have to LOG IN to go there!");
    }
    %>
    

    Other options include:

    You could implement the login button to redirect to the login success page and add a ?MyKey=value to the URL, that attribute can be seen by the login page and you can react on it.

    I will work over my code that plots out everything and anything I could find and make it better readable and then post it here. I’m sure that the value where the user gets next is present somewhere in your request, you just have to find out where.

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

Sidebar

Related Questions

I have implemented web service using rails server. The server uses rails default authentication
I have a Java based web service client connected to Java web service (implemented
We have build several web service based on .net. Now we want to create
I have a pool of MySQL connections for a web-based data service. When it
I have a spring-based Web Service. I now want to build a sort of
I have a .NET 3.5 based web service running at http://localhost/serivce.svc/ . Then I
I have a web-based system built with user login data based on session variables.
I have an application that connects via https to a SOAP-based web service that
We have a Seam 2 based web application with the usual user login and
I have a javascript-based client that is currently polling a .NET web service for

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.