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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:57:22+00:00 2026-06-13T19:57:22+00:00

Please note: This question is about CDI scopes as we are using CDI scopes

  • 0

Please note: This question is about CDI scopes as we are using CDI scopes in the app and not JSF scopes.

1) Controller Bean (TestController.java) which is in RequestScoped (enterprise context) is called index_cut.xhtml, when we come for first time on this page.

enter image description here

2) On button “Load”, we load the following method to populate the sapFinancialPeriodList which works fine and displays the data

<<XHTML Code>>

<<JAVA Code>>

<<XHTML Code>>

3) After changing the content on the page and submitting, the sapFinancialPeriodList appears as NULL in the following method –

<<JAVA Code>>

<< XHTML Result >>

Any suggestions?

  • 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-13T19:57:23+00:00Added an answer on June 13, 2026 at 7:57 pm

    Your bean is request scoped and you’re loading the data model on action only instead of on (post)construction. When the HTTP response after the action which loaded the data is finished, then the bean is garbaged. The subsequent request would get a brand new instance of the bean with all properties set to default. However, as the same data model isn’t been preserved during (post)construct, it remains empty.

    In JSF2 you’d solve this with using @ViewScoped. This way the bean will live as long as you’re interacting with the same view by postbacks (which return null or void).

    In CDI you’d need to solve this using @ConversationScoped, which in turn requires some additional @Inject Conversation boilerplate, complete with begin() and end() calls at the right moments. For a concrete example, see also What scope to use in JSF 2.0 for Wizard pattern?.

    An alternative is to pass the parameters responsible for creating the data model to the subsequent request via <f:param> in the command link/button as follows

    <h:commandButton value="save" ...>
        <f:param name="period" value="#{bean.period}" />
    </h:commandButton>
    

    and then recreate exactly the same data model in (post)constructor of the request scoped bean as follows

    String period = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("period");
    List<SapFinancialPeriod> sapFinancialPeriodList = someservice.list(period);
    

    (the above is by the way nicer to solve with @ManagedProperty if you were using standard JSF; as far as I know CDI doesn’t have an annotation which enables you to set a HTTP request parameter as a bean property)

    See also:

    • How to choose the right bean scope?

    Unrelated to the concrete problem, the upcoming JSF 2.2 solves this functional requirement in a nicer way using the new "Faces Flow" feature with the new @FlowScoped annotation and the new xmlns:j="http://java.sun.com/jsf/flow" tags.

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

Sidebar

Related Questions

Please note: This is a question about the Eclipse plugin Subversive , and not
Please note this is not a question about online/hosted SVN services. I am working
(NOTE: This question is not about escaping queries, it's about escaping results) I'm using
Please note that this is asking a question about constructors, not about classes which
Please note that this question is not about the mysql query per se, but
Please note that this question is not about the mysql query per se, but
note: please suppress comments about C++? Use std::string! . This question is using C
Please Note: This question is about the difference in terminology between the words destructor
Please note that this question is about CGLayer (which you typically use to draw
Please note this question related to performance only. Lets skip design guidelines, philosophy, compatibility,

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.