Spring MVC Controller无法直接与Spring Web Flow连接?

时间:2013-10-16 19:55:27

标签: java spring spring-mvc

我最近不得不将Web流的第一步移出直接Web流逻辑,然后将其放在一个单独的控制器中。所以过去的步骤是:

File jsp/stuff/flow.xml:

<view-state id="startFlow" model="flowModel" view="flow/start" ></view-state>

现在应该像这样:

Controller Startup.java:

@RequestMapping("mything.html")
public String startFlow(Model model) {
    return "jsp/stuff";
}

当转到(localhost)/ MyApp / jsp / stuff时,流程就开始了。就在控制器发送给你的时候,你会遇到这个丑陋的错误:

   javax.servlet.ServletException: Could not resolve view with name 'jsp/stuff' in servlet with name 'MyApp'
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1190)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:827)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

有人可以解释一下吗?

1 个答案:

答案 0 :(得分:1)

您需要执行redirect:forward:来启动流程。