guys i'm using jsf 2.0 with spring. I have annotated a method in a managed bean with @PostConstruc, but if in the bean there aren't field connected to the jsf page the @PostConstruct method isn't called even if in the jsf page there is an action method connected to the Bean. Thank you in advance.
Added code for explaination:
this si my BackingManagedBean
@ManagedBean(name="utenteBean")
@ViewScoped
public class UtenteBean extends SupportBean implements Serializable
While this is my ControllerManagedBean
@ManagedBean(name="gestisciUtentiController")
@ViewScoped
public class GestisciUtentiController extends MessageSupportBean implements Serializable {
@ManagedProperty(value="#{utenteBean}")
private UtenteBean utenteBean;
public void setUtenteBean(UtenteBean utenteBean) {
this.utenteBean = utenteBean;
}
@PostConstruct
public void loadBean()
{
try
{
utenteBean.setUtentis(getFacadeFactory().getUtenteFacade().readAllOrdered(Utente.class, "username"));
}
catch (ApplicationException e)
{
setExceptionMessage(e.getLocalizedMessage(), e.getLocalizedMessageDetail());
}
}
@PostConstruct
useful if you don't have anything which renders to the view? You have basically nothing to prepare then. What kind of code do you have there? What's the functional requirement? – BalusC@ManagedBean
then. – BalusC