made FlowHandler handleException return a String; updated sample

This commit is contained in:
Keith Donald
2008-04-12 13:15:07 +00:00
parent 81258bb67a
commit 3bd270729e
8 changed files with 40 additions and 27 deletions

View File

@@ -3,9 +3,9 @@ package org.springframework.webflow.samples.booking;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.webflow.core.FlowException;
import org.springframework.webflow.core.collection.AttributeMap;
import org.springframework.webflow.execution.repository.NoSuchFlowExecutionException;
import org.springframework.webflow.mvc.servlet.AbstractFlowHandler;
public class BookingFlowHandler extends AbstractFlowHandler {
@@ -15,8 +15,12 @@ public class BookingFlowHandler extends AbstractFlowHandler {
}
@Override
public ModelAndView handleException(FlowException e, HttpServletRequest request, HttpServletResponse response) {
return new ModelAndView("redirect:/spring/hotels/index");
public String handleException(FlowException e, HttpServletRequest request, HttpServletResponse response) {
if (e instanceof NoSuchFlowExecutionException) {
return "hotels/index";
} else {
throw e;
}
}
}