Is it intended that Spring MVC doesn't throw ServletException
when the expected JSP doesn't exist?
Code snippet below is the part of InternalResourceView
, where an exception should be made in my opinion. RequestDispatcher
might be null because there's no file on dispatcherPath.
In detail, dispatcherPath looks like /WEB-INF/jsp/v2/post/somename.jsp
.
// Obtain a RequestDispatcher for the target resource (typically a JSP).
RequestDispatcher rd = getRequestDispatcher(requestToExpose, dispatcherPath);
if (rd == null) {
throw new ServletException(
"Could not get RequestDispatcher for [" + getUrl() +
"]: Check that the corresponding file exists within your web application archive!");
}