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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:23:40+00:00 2026-05-18T09:23:40+00:00

I think the question is clear by the title. This is my actual bean

  • 0

I think the question is clear by the title. This is my actual bean :

@ManagedBean(name="selector")
@RequestScoped
public class Selector {
    private String profilePage;

    @PostConstruct
    public void init() {
        System.out.println("I'm PostConstruct");
        if(profilePage==null || profilePage.trim().isEmpty()) {
            this.profilePage="main";
        }
    }

    public String getProfilePage() { 
        return profilePage;
    }

    public void setProfilePage(String profilePage) { 
        this.profilePage=profilePage;
        System.out.println("I'm setProfilePage");
    }
}

And i change his value (profilePage) by using ajax call :

<h:commandButton value="Some Action">
    <f:setPropertyActionListener target="#{selector.profilePage}" value="some" />
    <f:ajax event="action" render=":profileContent"/>
</h:commandButton>

I notice that my output on server is not ever a sequence of I'm PostConstruct followed by I'm setProfilePage. Sometimes I'm setProfilePage is totally absent.

I read that Methods marked with the @PostConstruct annotation will be invoked after the bean has been created, any resources have been injected, and any managed properties set, but before the bean is actually pushed into scope.

I would like to know if @PostConstruct can make some conflicts with setter method.

Cheers

  • 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-18T09:23:40+00:00Added an answer on May 18, 2026 at 9:23 am

    Sometimes I'm setProfilePage is totally absent.

    That can happen when the UICommand component is not rendered in the component tree during apply request values phase and/or update model values phase. I.e. the rendered attribute of it or one of its parents has evaluated false at that point.

    The presence of @PostConstruct should not have any influence.

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

Sidebar

Related Questions

I think title of this question is pretty clear. const int WM_KEYDOWN = 0x100;
Well I think the title of this question is far to be clear but
I think the question title is clear enough: is is possible to stable_sort() a
Sorry about the title to this question, it's not very clear but wasn't sure
I don't know how to ask this question properly. I think the title is
This question should be quite clear from its title alone, but let me explain
I think my question title is already crystal clear. I am invoking Process.Start() method
Update I don't think I was clear enough when I originally posted this quesion.
I think this question has been asked many a times but I've been searching
I think this question may end up being a bit subjective so I'm marking

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.