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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:14:22+00:00 2026-06-01T12:14:22+00:00

im trying to establish and access a session from my servlet, but I can’t

  • 0

im trying to establish and access a session from my servlet, but I can’t get it working.

All tutorials just call request.getSession(true); for the session object, but I get “request can not be resolved”.

I purely have to work with taglibs, no logic in the jsp page.

How can I access session data?
Thanks!

package controller;

import java.io.*;
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.http.*;
import javax.servlet.jsp.tagext.*;

public class Initialize extends BodyTagSupport
{
    public int doEndTag() throws JspTagException
    {
        try
        {
            // Implementation
            JspWriter out = pageContext.getOut();
            HttpSession session = request.getSession(true);
            out.println(session.getId());
            return SKIP_BODY;
        }
        catch(IOException error)
        {
            throw new JspTagException(error);
        }
    }
}
  • 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-01T12:14:23+00:00Added an answer on June 1, 2026 at 12:14 pm

    The right example for session data access from a taglib would have been:

    package controller;
    
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import javax.servlet.http.*;
    import javax.servlet.jsp.tagext.*;
    
    public class Initialize extends BodyTagSupport
    {
        public int doEndTag() throws JspTagException
        {
            try
            {
                // Implementation
                JspWriter out = pageContext.getOut();
                HttpSession session = pageContext.getSession(true);
                out.println(session.getId());
                return SKIP_BODY;
            }
            catch(IOException error)
            {
                throw new JspTagException(error);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to establish a connection with access database using java... But while
Just trying to establish whether prototype can do something like $$('#ID a:last').css('color','#111'); Any ideas
i am trying to get the remote access from windows system to linux system
I'm new to C# and trying to establish a C# db connection. But I'm
I'm trying to access my Amazon S3 account using the aws-s3 gem, but no
I am trying to establish a local telnet session in C++ and send commands/receive
I'm trying to establish the best way to log an attempted unauthorized access to
I have been trying to understand why I cannot access these links from my
I'm using groovy in SOAPUI and am currently trying establish whether the response from
I am trying to establish upper / lower bound in my stored procedure below

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.