我当前的平台是 NB 7 rc 1,我有一个只有一个“托管 bean”的 JSF 2 应用程序。及时,我正在使用 Tomcat 7.0.34。
这是发生错误的代码:
@ManagedBean
@SessionScoped
public class CopyController implements Serializable {
private static final long serialVersionUID = 1L;
private String pathBancoSentencas;
private List<Arquivo> arquivosUpload;
private HttpSession session;
private List<String> listaPdfs;
public List<Arquivo> getArquivosUpload() {
return arquivosUpload;
}
public void setArquivosUpload(List<Arquivo> arquivosUpload) {
this.arquivosUpload = arquivosUpload;
}
public CopyController() {
arquivosUpload = new ArrayList<Arquivo>();
}
@PostConstruct
public void doInit() {
session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false);
pathBancoSentencas = (String)session.getAttribute("DIRETORIO_TRABALHO");
}
处理请求后,例程调用如下视图:
<p:dataTable value="#{copyController.arquivosUpload}" var="arquivo" paginator="true" paginatorPosition="bottom"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}">
<f:facet name="header">
Item processado
</f:facet>
<h:column>
<h:outputText value="#{arquivo.nome}" />
</h:column>
</p:dataTable>
但是,视图不显示,并发生此错误:
Caused by: java.lang.NullPointerException
at br.jus.tjmg.dspace.copy.CopyController.doInit(CopyController.java:54)
... 70 more
有人能帮我吗?谢谢!