当我导航 /app/wb/create 时,我将进入下面的控制器方法,该方法需要调用流 "/app/main" 但弹簧将其重新定位为 "/main.xhtml" 。我的问题是如何从弹簧控制器重定向到流?
@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
}
}
流动
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<var name="user" class="com.veera.myapp.domain.UserEntity" />
<view-state id="welcome" view="welcome.xhtml">
<transition on="newUser" to="signUp" />
</view-state>
<view-state id="signUp" view="signUp.xhtml" model="user">
<transition on="backToSignIn" to="welcome" />
</view-state>
</flow>