I need help on this, please take a look at my code:
@ControllerAdvice
@EnableWebMvc
public class GlobalExceptionController {
@ExceptionHandler(CustomGenericException.class)
public ModelAndView handleCustomException(CustomGenericException ex) {
// create the model and view with the tiles View pointing to error jsp page
ModelAndView model = new ModelAndView("pagina.erro");
model.addObject("errCode", ex.getErrCode());
model.addObject("errMsg", ex.getErrMsg());
return model;
}
...
Tiles configuration:
<definition name="pagina.erro" extends="baseLayout">
<put-attribute name="titlepagina" value="Página de Erro" />
<put-attribute name="body" value="/WEB-INF/jsp/error/erro-generico.jsp" />
</definition>
In my Spring configuration xml I have:
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
The page erro-generico.jsp is being loaded because if I put a wrong code in it errors will be shown on eclipse console.
The problem is: the page is not shwowing, the actual page keeps showing on the browser, not even the URL changes.
What could be wrong?