req.setAttribute(DISPATCH_TO, finalLocation);
PortletRequestDispatcher dispatcher = ctx.getNamedDispatcher(dispatcherServletName);
if(dispatcher == null) {
throw new PortletException("Could not locate dispatcher servlet \"" + dispatcherServletName + "\". Please configure it in your web.xml file");
}
dispatcher.include(req, res);
} else {
PortletRequestDispatcher dispatcher = ctx.getRequestDispatcher(finalLocation);
if (dispatcher == null) {
throw new PortletException("Could not locate dispatcher for '" + finalLocation + "'");
}