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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:35:05+00:00 2026-06-08T13:35:05+00:00

In my application, I have the following beans: @Named(value = mrBean) @SessionScoped public class

  • 0

In my application, I have the following beans:

@Named(value = "mrBean")
@SessionScoped
public class MrBean implements Serializable {

    @EJB
    private MrsBean mrsBean;

    private Item item;

    public void updateItem() {
        this.item = mrsBean.updateItem(item.getId());
    }

}

@Named(value = "itemBean")
@RequestScoped
public class itemBean {
    @Inject
    private MrBean mrBean;

    @PostConstruct
    public void init() {
        if (FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("update") != null) mrBean.updateItem();
    }
}

Before showing the item’s information on the ViewItem.xhtml page, I will check if the update parameter is submitted to update the item before showing.

When I test the page with the parameter update=true, I have no idea why the old data was rendered instead of the new updated one. In fact, I have to refresh the page before the new data is rendered.

From the above result, I wonder if the @PostConstruct method was called after the view was rendered.

I’d be very grateful if you could give me an advice.

Best regards,

  • 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-08T13:35:06+00:00Added an answer on June 8, 2026 at 1:35 pm

    That can happen if #{itemBean} is been referenced for the first time in the view after #{mrBean.item}. E.g.

    #{mrBean.item}
    ...
    #{itemBean}
    

    The managed beans are constructed for the first time when an EL expression references it for the first time and it does not exist in the scope yet. On a GET request wherein the managed bean instance is not referenced by a taghandler attribute or a f:event, then it would only be constructed during the render response.

    If rearranging them so that the #{itemBean} is always referenced (and thus constructed) before #{mrBean.item} is been referenced is not possible, then better make the @PostConstruct of #{itemBean} a <f:event type="preRenderView"> instead.

    <f:event type="preRenderView" listener="#{itemBean.init}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following models setup in my Django application class School(models.Model): name = models.TextField()
I have simple application with following folder structure: ProjFolder |-----src |----------packagename |---------------{sourcefiles} |----------META-INF |---------------{beans.xml}
I have the following simple expression in my application-context.xml: <bean id=instrument class=com.ustunozgur.Instrument init-method=initialize scope=prototype>
I have the following controller mapped as @Controller( value = stockToStoreController ) @RequestMapping(/stsr) public
Hi I have the following code: Controller: @Controller public class HelloWorldController { @RequestMapping(/hello) public
I have the following application: I have 1 window. On that window I add
In my application I have the following tables: Posts id title content Users id
In my Rails 3.2.3 application I have the following code in the application.html.erb to
I have following code in my application: // to set tip - photo in
I have following requirement in my application. A tableView with games title After selecting

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.