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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:56:45+00:00 2026-06-14T08:56:45+00:00

My problem is simple but I am confused with this please help me. In

  • 0

My problem is simple but I am confused with this please help me.

In a JSP, I am receiving an Attribute(idsList) from Servlet1 and I want to send this Attribute(idsList) to another servlet, Servlet2 but I can do this using session.setAttribute(). My trouble is, how can we send to Servlet2 in JSP itself?

Here is my code, but it’s not working because the same request is used to set and get.
Please do the favour.

In Servlet1:

request.setAttribute("idsList",idsList);---is null

In JSP

List<Integer> idsList =(List<Integer>)request.getAttribute("idsList");
System.out.println("size of ids list :"+idsList.size());
request.setAttribute("idsList",idsList);

In Servlet2 :

request.getAttribute("idsList");---is null
  • 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-14T08:56:46+00:00Added an answer on June 14, 2026 at 8:56 am

    Forward your request using RequestDispatcher as shown below:

    request.setAttribute("idsList",idsList);
    RequestDispatcher rd = getServletContext().getRequestDispatcher("servlet2");
    rd.forward(request, response);
    

    You can use request.getAttribute("idsList") on servlet2.

    Do not use response.sendRedirect() to send request object.

    EDIT :

    I found a comment below your question:

    r u getting value in JSP using setAttribute? YES

    Generally, JSP are used as a VIEW perspective, so,

    IT SHOULD NOT CONTAIN BUSINESS LOGIC

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

Sidebar

Related Questions

This is a seemingly simple problem but I am having trouble doing it in
hey guys having this really simple problem but cant seem to figure out have
this may seem like a simple problem but I couldn't find it in the
this must be such a simple problem but can someone tell me why this
I have a simple problem but I am not sure how to solve it.
I have a simple problem but no matter what I try I can't see
I have a simple problem but I don't know how to solve it because
I have a very simple problem but cannot find a nice solution. I have
I am stuck with a simple problem but not able to figure out the
Hi I am new to PHP and have a simple problem but I have

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.