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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:02:11+00:00 2026-06-01T02:02:11+00:00

I have a multi-page form, aka a Wizard pattern, where Page 1 corresponds to

  • 0

I have a multi-page form, aka a Wizard pattern, where Page 1 corresponds to Step 1 of the wizard form, Page 2 corresponds to Step 2, etc. Each page other than the last has a Next button on it that takes you to the next page in the form. The final page has a submit button that submits all the data for all pages in the wizard.

What scope should I use to maintain the state of the data entered on each form? e.g. should I use a View Scoped bean that holds all the data entered on all pages? Will that work since I’ll be navigating to different pages (Which I believe are considered to be different “views”; and if they’re different views, I believe the View Scoped data will be lost when you navigate to the next page in the wizard)

  • 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-01T02:02:12+00:00Added an answer on June 1, 2026 at 2:02 am

    I believe the View Scoped data will be lost when you navigate to the next page in the wizard)

    That’s correct. The view scope lives as long as you’re interacting with the same view and get trashed whenever a new view get created. You’re looking for the “conversation scope”. This isn’t available by any of the JSF managed bean scopes. This is however available by CDI @ConversationScoped. So if your environment happen to support CDI, you could make use of it:

    import javax.enterprise.context.Conversation;
    import javax.enterprise.context.ConversationScoped;
    import javax.inject.Inject;
    import javax.inject.Named;
    
    @Named
    @ConversationScoped
    public class Wizard implements Serializable {
    
        @Inject
        private Conversation conversation;
    
        @PostConstruct
        public void init() {
            conversation.begin();
        }
    
        public void submitFirstStep() {
            // ...
        }
    
        // ...
    
        public String submitLastStep() {
            // ...
    
            conversation.end();
            return "someOtherPage?faces-redirect=true";
        }
    
        // ...
    }
    

    The conversation is managed by the automatically inserted cid request parameter.

    If you’d like to stick to the JSF view scope, then your best bet is to create a single page wherein you render the multiple 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>
    

    Or, you could use a 3rd party component library like PrimeFaces which has a <p:wizard> component for exactly this purpose.

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

Sidebar

Related Questions

I have a multi-step form and user can navigate to any page to modify
I have a multi-lingual page where I want to display form validation error in
I have a multi-page PDF file that has information I need to parse. The
I have a multi-page form, and I'm trying to implement Back buttons, so that
I have a multi page form that I am trying to implement on my
I have a page of similar items, each in their own form I want
I have a multi-page form. I'd like to have a prev and next button
I have created a multi-page registration form for a website. Due to the page
I have a multi-step form, let's say for the sake of ease it's 2
I have a multi-line string that I want to do an operation on each

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.