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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:53:40+00:00 2026-06-05T03:53:40+00:00

I am using a session scope to store the bean,and i want to project

  • 0

I am using a session scope to store the bean,and i want to project the bean value to the jsp page when needed like this way

request.getSession().setAttribute("bean", bean);

        response.sendRedirect("test.jsp");

And in the jsp i am using the below code to get the value on jsp

<%  bean1 bean = (bean1) session.getAttribute("bean");

  %>
<%= bean.getValue() %> 

Instead of using a session scope i want to use a request scope,so can i set my attribute in my servlet in this way

request.setAttribute("bean", bean);

So how can i call it on my jsp
can i say

<%  bean1 bean = (bean1) request.getAttribute("bean");

But it is showing error.Or instead of using scriplet how can i show my output using JSTL.

  • 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-05T03:53:43+00:00Added an answer on June 5, 2026 at 3:53 am

    You’re not understanding what a redirect is. A redirect is a response you send to the browser so that the browser sends another, new request to the location you redirected to. So, when you call sendRedirect("test.jsp"), the browser will send a new request to test.jsp. And obviously, all the attributes you have stored in the current request won’t be available anymore.

    It’s impossible, without context, to say if a redirect is something you should do in this case, or if you should instead forward to the JSP. A forward is very different from a redirect, since it only transfers the responsibility of the current request and response to another component. In that case, there would be a unique request, and the JSP could find the attribute set by the servlet in the request.

    The only thing I can say is that, in a properly designed MVC application, the JSP is used as a view, and there should never be a direct request to the view. Each request should go through a controller.

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

Sidebar

Related Questions

I want to use cookie in my project. But now i m using session.
I want to ask if i place my managed bean in session scope, then
I have a session scoped managed bean with name 'usermanager'. i want to store
I am printing some values on a JSP from session using < bean:write />
I want to implement something like this using JSF.(part of search screen) More and
I have been using SESSION Variables to enter data with loginName as way to
I am confused with cookies and using session in servlets in jsp's and servlets.
I'm looking for best way of using session within zf application. At first I
I am storing data in application scope. I want to clear this data after
I have my webapplication structured like this: Main page with n links and a

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.