0

I am currently building an application of which the (customer) requirements are Java EE and JSF (Primefaces) as front-end.

In this application I need to create a kind of wizard with several steps. I thus created a backing bean which holds the information of the several steps and a controller which handles the clicks and actions in the form, hence depending strongly on the Bean.

Problem is that the Bean although annotated as Sessionscoped is recreated every single time the controller is invoked. Hence, I get nullpointers and such since fields which I expect to be initiated remain null.

This is a part of the code of the bean:

import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import java.io.Serializable;

@SessionScoped
@Named
/**
 * A placeholder for all the information needed in the wizard.
 */
public class WizardBean implements Serializable {

And this is part of the code for the controller:

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import java.io.IOException;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;

@ManagedBean(name = "registerInvestigationController")
@SessionScoped
public class WizardController implements Serializable {

    private static final long serialVersionUID = 3327044905245768948L;

    private static final Logger LOGGER = LoggerFactory.getLogger(WizardController.class);

    @Inject
    private WizardBean wizardBean;

Any idea what I am doing wrong?

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
zip4ever
  • 121
  • 1
  • 7

0 Answers0