Spring mvc 如何从@controller调用流?
当我浏览/app/wb/create时,我将进入下面的控制器方法,该方法需要调用flow/app/main,但spring将其解析为/main.xhtml。我的问题是如何从spring控制器重定向到流Spring mvc 如何从@controller调用流?,spring-mvc,spring-webflow,Spring Mvc,Spring Webflow,当我浏览/app/wb/create时,我将进入下面的控制器方法,该方法需要调用flow/app/main,但spring将其解析为/main.xhtml。我的问题是如何从spring控制器重定向到流 @Controller @RequestMapping("/wb") public class HomeController { private static final Logger logger = LoggerFactory.getLogger(HomeController.cla
@Controller
@RequestMapping("/wb")
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping("/create/")
public String home(Device device, Model model) {
if (device == null) {
logger.info("no device detected");
} else if (device.isNormal()) {
logger.info("Device is normal");
} else if (device.isMobile()) {
logger.info("Device is mobile");
} else if (device.isTablet()) {
logger.info("Device is tablet");
}
return "app/main"; // Where main is the flow id
}
}
流动
您必须删除应用程序路径
return "redirect:/main.xhtml"
您必须告诉控制器重定向。这会从flow中找到视图吗?当我添加/main时,它正在从webflow中查找/main.xhtml而不是view main。该流将从flow.xml中默认定义的第一个状态开始。它需要重定向到flow not xhtml页面。您的webflow配置是什么?
return "/main";
return "redirect:/main.xhtml"