I have a Bean that has @SessionScoped and works perfectly, however I want to use @ViewScoped, but when I change the annotation it stops working and it always marks me the Target Unreachable error
@ViewScoped I'm importing it with:
import javax.faces.bean.ViewScoped;
I'm not sure what is wrong.
What I want is for the variables that I use inside that Bean to die when I change my view.
This is the code of my Bean:
package mx.materiam.backend.controllers;
import java.io.Serializable;
import javax.faces.bean.ViewScoped;
import javax.inject.Named;
import mx.materiam.entities.OrdenProduccion;
@Named(value = "ordenProduccionController")
@ViewScoped
public class ordenProduccionController implements Serializable{
private OrdenProduccion ordenProduccion;
public ordenProduccionController() {
ordenProduccion = new OrdenProduccion();
}
public void foo(){
System.out.println("hola");
}
public OrdenProduccion getOrdenProduccion() {
return ordenProduccion;
}
public void setOrdenProduccion(OrdenProduccion ordenProduccion) {
this.ordenProduccion = ordenProduccion;
}
}