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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:46:41+00:00 2026-05-29T10:46:41+00:00

I want to ask if i place my managed bean in session scope, then

  • 0

I want to ask if i place my managed bean in session scope, then it is stored in session’ Like if i have a bean like this

@ManagedBean
@SessionScoped
public class SessionScopedBean implements Serializable {

    .......

} //end of class SessionScopedBean

Then it stored in the session, and during my session i can get it using

session.getAttribut("SessionScopedBean");

This will give me the SessionScopedBean Object, and when session will get destroy, i will get null. Now i want to ask if i have my bean in view Scope, then how can i get it. Like

@ManagedBean
@ViewScoped
public class ViewScopedBean implements Serializable {

    .......

} //end of class ViewScopedBean

Now if the view is persist then this bean is in the view state, and when view changes, this bean will get destroy.Now i want to ask how can i get this bean from view state, if the view persist. Like

view.getAttrubute("ViewScopedBean");  //just a code. No actual implementation.

Thanks

  • 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-05-29T10:46:42+00:00Added an answer on May 29, 2026 at 10:46 am

    They’re stored in the view map as available by UIViewRoot#getViewMap():

    Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap();
    ViewScopedBean viewScopedBean = (ViewScopedBean) viewMap.get("viewScopedBean");
    // ...
    

    Equivalently, you should be using the session map abstraction as well which is available by ExternalContext#getSessionMap() (you ultimately want to have zero javax.servlet import declarations throughout your JSF code):

    Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
    SessionScopedBean sessionScopedBean = (SessionScopedBean) sessionMap.get("sessionScopedBean");
    // ...
    

    See also:

    • Get JSF managed bean by name in any Servlet related class

    Unrelated to the concrete problem, this may not be the best way. Look at @ManagedProperty if possible.

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

Sidebar

Related Questions

I wanted to ask, I have a div that I would want to place
I want to ask if is there any faster method how to make this
I want to ask a question about UITableViewCell. Apparently, this is what I want
I want to ask that If have read that it is possible to give
Hi want to ask if there is a way to do this without foreach
I hope this is the right place to ask. Here is my scenario for
Not sure if this is the right place to ask, but here goes.... I
I don't know if I'm in the right place to ask this question. I'm
I am not sure whether this is the right place to ask this question.
I think this is not best place to ask this question but ..i don't

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.