我有以下托管bean(删除了一些行):
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.flow.FlowScoped;
@ManagedBean
@FlowScoped(value="create-colaborator")
public class CriarProfessionalController implements Serializable {
private static final long serialVersionUID = -6578310438927368912L;
@ManagedProperty("#{professionalService}")
private IProfessionalService professionalService;
@ManagedProperty("#{territorioService}")
private ITerritorioService territorioService;
@PostConstruct
public void init() {
this.profissional = new Professional();
this.setTipoDeDocumentos(tipoDocumentoService.buscaTodos());
this.setProvincias(territorioService.buscaTodosProvincias());
}
}
我必须添加CDI才能在JSF中使用FlowScope,所以我的pom.xml中有以下内容:
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>2.2.14.Final</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jandex</artifactId>
<version>1.2.2.Final</version>
</dependency>
在我的faces-config.xml中,我有:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<application> <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
</faces-config>
似乎没有使用流量计!