0
I have a method in controller
which has as its function to make a query in my bank and after returning me only one field of this search, however I am taking nullpointer
in the first for
that I’m using. I’d like help with that.
The constants are these:
private List<String> listaNomeProjeto;
private List<String> listaNomePerfil;
private List<String> listaNomeJornada;
@RequestMapping(value = REDIRECT_PAGE_CADASTRO, method = RequestMethod.GET)
public ModelAndView viewCadastro(Model model) {
List<Projeto> listaCompletaProjeto = projetoService.findAll();
for (Projeto listaProjetos : listaCompletaProjeto) {
listaNomeProjeto.add(listaProjetos.getProjeto());
}
List<Perfil> listaCompletaPerfil = perfilService.findAll();
for (Perfil listaPerfis : listaCompletaPerfil) {
listaNomePerfil.add(listaPerfis.getPerfil().toString());
}
List<Jornada> listaCompletaJornada = jornadaService.findAll();
for (Jornada listaJornadas : listaCompletaJornada) {
listaNomeJornada.add(listaJornadas.getDsJornada().toString());
}
usuarioBean = new UsuarioBean(listaNomeProjeto, listaNomePerfil, listaNomeJornada);
model.addAttribute("usuarioBean", usuarioBean);
return new ModelAndView(REQUEST_MAPPING_PAGE_CADASTRO);
}
Thanks in advance!
Copy and paste the
stacktrace
entire error in your question, otherwise it becomes difficult to know what the problem is– Sorack