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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:21:29+00:00 2026-05-31T11:21:29+00:00

Background: I have a JSF 2.0 application using MyFaces. Using this application, the users

  • 0

Background: I have a JSF 2.0 application using MyFaces. Using this application, the users will create a complex “Widget” by going through a number of different JSF pages. I am storing the managed bean in the session scope, and the properties get filled in as the user goes through each page. Once they are done assembling the “widget”, they would then want to create a brand new “widget” and repeat the process. My question is, how do I completely (and safely) remove the managed bean from the session without disrupting the JSF lifecycle?

I have seen other responses for similar questions suggesting that you can invalidate the session, and also you can access the HttpSession through the FacesContext and remove the bean that way. I don’t want the user to have to log out or in again, and I don’t want to invalidate the entire session. Assuming that I need to go through FacesContext to access the HttpSession and remove the bean, when in the JSF lifecyle is the most appropriate place to do this safely so that problems don’t cascade through the rest of the cycle? I want to make sure JSF will have no problems creating a new session bean when the user starts the process of creating the next “widget”.

I am also curious to understand why there isn’t a mechanism in JSF to make this easier. Is there some other approach that I should be taking which is better in line with the intended JSF pattern? I can’t use View Scope here because the managed bean will go through several different pages and views before it is completed.

Thanks in Advance!

  • 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-31T11:21:30+00:00Added an answer on May 31, 2026 at 11:21 am

    Create a single page wherein you render the multiple wizard steps conditionally.

    <h:panelGroup rendered="#{wizard.step == 1}">
       <ui:include src="/WEB-INF/wizard/step1.xhtml" />
    </h:panelGroup>
    <h:panelGroup rendered="#{wizard.step == 2}">
       <ui:include src="/WEB-INF/wizard/step2.xhtml" />
    </h:panelGroup>
    <h:panelGroup rendered="#{wizard.step == 3}">
       <ui:include src="/WEB-INF/wizard/step3.xhtml" />
    </h:panelGroup>
    

    This way you can just use a @ViewScoped managed bean on this single page without much hassle.


    Unrelated to the concrete question, PrimeFaces has a <p:wizard> component which does almost exactly like that. You may find it useful in order to save yourself from some painful boilerplate code as to validation and such.

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

Sidebar

Related Questions

I have this JSF page: <div id=settingsdiv style=width:350px; height:400px; position:absolute; background-color:r; top:20px; left:1px> <h:form>
Background We have a WinForms application with Entity Framework 4.2 code-first / FluentAPI using
Background: I have encoded a raw h264 file using ffmpeg. I'm trying to create
Background: I have to create a report that will be run regularly to send
Background I have a web app that will create an image from user input.
Background: I have this with rollup query defined in MySQL: SELECT case TRIM(company) when
Background I have a custom collection that is binded to the datagridview this.datagridview.DataSource =
Background: I have an application with athletes, each of these athletes (Athlete model) can
Background I have a ror application which is continuously recording and showing on a
Background: We have a project with many modules. We're using EntityFramework 4.2 with FluentAPI

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.