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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:58:50+00:00 2026-06-14T14:58:50+00:00

I am creating a Login Application in JAVA.I am making the presentation in JSP

  • 0

I am creating a Login Application in JAVA.I am making the presentation in JSP and all the logic (Database connectivity) in Servlet [this is not a right approach I know that].
I check the username Password in Servlet and then create a session variable.
and add the session like this

sess.setAttribute("username",oName);

Then I redirect the user to its homepage say student.jsp

response.sendRedirect("student.jsp");

It removes the session variable.I need a way to preserve the session variable and move to student.jsp.I tried to use forwading but that didn’t worked out.

RequestDispatcher dispatcher =
                getServletContext()
                    .getRequestDispatcher("/student.jsp");

            if (dispatcher != null) {
                dispatcher.forward(request, response);
            }

It forward request but the Page address doesn’t change to student.jsp which is not good.
Any help in this regard will be appreciated
Thank you

  • 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-14T14:58:51+00:00Added an answer on June 14, 2026 at 2:58 pm

    For the redirected request to come back and attach to the same session, it needs a session ID, usually carried in a JSESSIONID (or another name) cookie or in the URL as a parameter.

    This cookie or URL parameter should be added by the servlet container and you should not have to add it yourself.

    If you do not see the cookie in your browser, and you are not attaching the JSESSIONID to the URL, then it is creating a new session with each request, and not attaching to the same session.

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

Sidebar

Related Questions

When creating an enterprise Java EE application, part of the business logic like messaging
I am creating a Java EE web service application. I am not sure on
im creating a java application with netbeans. i have two jframes for login and
This is my first Java application I am creating (using Eclipse IDE) and the
I'm creating simple example on JSF. It's small Login application. My problem is duplicate
I am creating a login system for a web application using PHP. My question
I've been reading this post Creating a login form in CodeIgniter based on Ion
I am creating a login screen for an application in C#. In my login
i'm creating a login for my application which is in table view.On success i
I am creating a login screen for my application with more than 1 authentication.

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.