title: JSF - passing parameter to @PostConstruct method
body: <p>I've got a little problem with passing a parameter to @PostConstruct method of my @ManagedBean. I already know it can't be done just like that, but I also don't know how it can be done.</p>
  
  <p>Let's start with some code:</p>
  
  <pre><code>    &lt;h:form&gt;
                  &lt;h:dataTable value="#{accountsList.accountsList}" var="konto"&gt;
                      &lt;h:column&gt;
                          &lt;f:facet name="header"&gt;#{messages.id}&lt;/f:facet&gt;
                          #{konto.id}
                      &lt;/h:column&gt;
                      &lt;h:column&gt;
                          &lt;f:facet name="header"&gt;#{messages.login}&lt;/f:facet&gt;
                          &lt;h:commandLink value="#{konto.login}" action="#{profileViewer.showProfile()}" /&gt;
                      &lt;/h:column&gt;
                      .........
                  &lt;/h:dataTable&gt;
      &lt;/h:form&gt;
  </code></pre>
  
  <p>The xhtml above is used to display accounts list.</p>
  
  <p>Take a look at the commandLink. I would like to pass it's value (user's login) as a parameter to the action method which is a PostConstruct method of ProfileViewer bean.</p>
  
  <p>Here's the ProfileViewer bean code:</p>
  
  <pre><code>@ManagedBean
  @RequestScoped
  public class ProfileViewer {
  
  @EJB
  private MokEndpointLocal mokEndpoint;
  
  private Konta konto;
  
  private String login;
  
  @PostConstruct
  public String showProfile(){
      konto = mokEndpoint.getAccountByLogin(login);
      return "profile";
  }
  
  public Konta getKonto() {
      return konto;
  }
  
  public void setKonto(Konta konto) {
      this.konto = konto;
  }
  
  public String getLogin() {
      return login;
  }
  
  public void setLogin(String login) {
      this.login = login;
  }
  
  public ProfileViewer() {
  }
  }
  </code></pre>
  
  <p>How can I do this? Please help me! I would appreciate an answer with an easy and good solution and some code.</p>
  
  <p>Ok, I'll say it this way:
  I've got a JSF page displaying list of accounts. I want each account name (login) to be a link to profile info (which is other jsf page displaying info about selected account)</p>