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

The Archive Base Latest Questions

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

I read , to set a session attribute I need to put : <sessions-enabled>true</sessions-enabled>

  • 0

I read , to set a session attribute I need to put :

<sessions-enabled>true</sessions-enabled>

inside appengine-web.xml and also implement java.io.Serializable. (though I don’t understand the reason for this !)

Following is one of the servlet that uses HttpSession :

 @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) 
        throws ServletException, IOException {
    String userName = request.getParameter("username");
    String password = request.getParameter("password");
    ArrayList list = new ArrayList();
    if(userName.compareTo("user") != 0 ) {
        list.add("Wrong Username");
    } else if(password.compareTo("password") != 0) {
        list.add("Wrong Password");
    }

    if(list.isEmpty()) {
        HttpSession session = request.getSession();
        if(session.isNew()) {
            session.setAttribute("UserRole", "PW :Admin");
            session.setMaxInactiveInterval(900);
            RequestDispatcher rd = request.getRequestDispatcher("abc/cpanel/PcPanel.jsp");
            request.setAttribute("SessionStatus", "JC"); // Just Created 
            rd.forward(request, response);
        }
    } else {
        response.sendRedirect("abc/cpanel/PcPanel_Login.jsp");
    }
}

After validating the username and password and entering the if block,request should be forwarded to PcPanel Login.jsp but it doesn’t happen.Intead a blank page appears with the address of this servlet. But if I remove/comment all the session junk,it works fine. Why does it happen ? Am I missing something or I making a mistake somewhere ?

  • 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-09T21:08:08+00:00Added an answer on June 9, 2026 at 9:08 pm

    Don’t use isNew(). isNew() is only true when session is first established = when user first lands on any of your pages.

    See the answer to this question: Session is NOT working – GAE/J

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

Sidebar

Related Questions

I have tried the obvious SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED, but my
I need to give my user a web interface to change the session timeout
How can i read cookie set date? In rails api I can not find
Is it possible to read or set the recovery email address in Gmail programmatically?
I've been trying to read and set the departmentNumber property for a DirectoryEntry object
I am using Microsoft.Office.Interop.Word.ApplicationClass to read a set of Word documents. I am able
I have the following code: $SQL = UPDATE jobs SET read = '1' WHERE
Is it safe for a thread to READ a variable set by a Delphi
My checkbox column doesn't respond when ticked, apparently it was set to read only,
On Ubuntu Linux, with Bash, I have /etc/profile set with read-only variables on login.

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.