Galera olhem estes codigos…
action
try {
Delegate delegate = new Delegate();
boolean retorno = delegate.validar(nroSerieCredencial, nomeUsuario);
} catch (Exception e) {
// Report the error using the appropriate name and ID.
errors.add("error", new ActionError(e.getMessage()));
}
if (!errors.isEmpty()) {
saveErrors(request, errors);
forward = mapping.findForward("error");
} else {
forward = mapping.findForward("success");
}
return (forward);
}
Delegate
public String validar(String usuario, String nroSerieCredencial) throws BDException {
try {
BO bo = new BO();
boolean retornoAssociacao = bo.validar(usuario, nroSerieCredencial);
} catch (BOException e) {
throw new BDException(e.getMessage());
}
return retornoAssociacao;
}
BO
public boolean validar(String usuario, String nroSerieCredencial) throws BOException {
boolean retornoValidacao = false;
try {
if(usuario == null && nroSerieCredencial == null) {
throw new BOException("Paramentros nulos.");
}else if(usuario == null) {
throw new BOException("Usuário nulo");
}else if(nroSerieCredencial == null){
throw new CredentialBOException("nroSerieCredencial nulo");
}else{
retornoValidacao = true;
}
} catch (DAOException e) {
throw new BOException(e.getStackTrace());
}
return retornoValidacao;
}
Galera a unica coisa que eu quero é monstrar a exception que eu lancei na tela.
“throw new BOException(“Usuário nulo”);”
mais não cai aqui dentro
catch (Exception e) {
// Report the error using the appropriate name and ID.
errors.add("error", new ActionError(e.getMessage()));
Como posso resolver isso?