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

  • Home
  • SEARCH
  • 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 6733711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:48:06+00:00 2026-05-26T10:48:06+00:00

Possible Duplicate: Java page re-direct I want to go to a certain page the

  • 0

Possible Duplicate:
Java page re-direct

I want to go to a certain page the first time it calls that page and go to another page all times after that while the session is is still active. I already have a login mechanism in place. I made another topic and was suggested to set a flag on the session layer. I’m not sure how to implement this.

Basically if when they press a button to go to a page it calls this:

public int show(Action action) throws Exception {
    HttpServletRequest request = action.getRequest();
    action.setJspURI("objects/objects_guidlines.jsp");
    return FORWARD;
}

This is fine if they are coming here for the first time. How can I implement a check to see if this the first time or not and subsequently send to another page?

  • 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-26T10:48:07+00:00Added an answer on May 26, 2026 at 10:48 am

    HTTP is a stateless protocol so if you want to maintain state between requests (such as whether the user has been here before), you’ll need to use something like cookies or sessions.

    If you want to use the session, you can get it from the HttpServletRequest and do the following:

    public int show(Action action) throws Exception{
        HttpServletRequest request = action.getRequest();
        if (request.getSession().getAttribute("has_visited_previously")!=true)
        {
            //User has not been here before so record that they are visiting.
            request.getSession().setAttribute("has_visited_previously", true);
            action.setJspURI("objects/objects_guidlines.jsp");
            return FORWARD;
        }
        else
        {
            //User has been here before.
            action.setJspURI("objects/user_has_visited_before.jsp");
            return FORWARD;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to internationalize a java web application. greetings all i want that
Possible Duplicate: Java 7 Date/Time API I've read rumors that Joda Time is slated
Possible Duplicate: How do you find all subclasses of a given class in Java?
Possible Duplicate: Java \ Pattern - how to write a pattern that verifies the
Possible Duplicate: Java: generating random number in a range I want to generate a
Possible Duplicate: Best Java obfuscator ? For my example I know that eclipse offers
Possible Duplicate: Java garbage collector - When does it collect? When people say that
Possible Duplicate: replace & for & For a wordpress page to be validated, all
Possible Duplicate: Java Serial Communication on Windows Friends, I want to connect and transfer
Possible Duplicate: Can anyone recommend a simple Java web-app framework? I want to know

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.