Java Spring Webflow使用按钮eventid转换到下一个状态
我有一个主流,它是index.jsp中的链接,index.jsp是链接到子流的测试应用程序的入口点。mainflow是main-flow.xml,在bean声明中用class=“org.springframework.webflow.mvc.servlet.FlowController”映射到main.htm 在主流程视图中有链接 苏晨系统 链接到子流的 在子流中,我有以下内容:Java Spring Webflow使用按钮eventid转换到下一个状态,java,spring,jsp,spring-webflow-2,Java,Spring,Jsp,Spring Webflow 2,我有一个主流,它是index.jsp中的链接,index.jsp是链接到子流的测试应用程序的入口点。mainflow是main-flow.xml,在bean声明中用class=“org.springframework.webflow.mvc.servlet.FlowController”映射到main.htm 在主流程视图中有链接 苏晨系统 链接到子流的 在子流中,我有以下内容: <?xml version="1.0" encoding="UTF-8"?> <flow xmln
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns0="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"
start-state="Search">
<view-state id="Search" view="/Search" >
<transition on="proceed" to="temp" />
<transition on="cancel" to="SubEnd" />
</view-state>
<view-state id="temp" view="/End" />
<view-state id="SubEnde" view="/Start" />
</flow>
搜索视图目前不包含任何逻辑,只包含一个链接和一个按钮。jsp的jsp for End.jsp只包含一些lore ipsum静态内容,Start与主流使用的视图相同
Search.jsp链接和按钮:
这项工作:
<a href="main.htm?_flowExecutionKey=${flowExecutionKey}&_eventId=proceed">
<span>Proceed Link</span></a>
这不会显示“请求的资源不可用的说明”。站点:
而这个按钮什么都做不了:
<input type="submit" value="Proceeding" name="_eventId_proceed" id="eventId_proceedButton1">
这里出了什么问题?我在互联网上看到过许多这样指定按钮的例子。我是否缺少一些按钮的配置 如果您使用的是按钮,则需要通过jquery或javascript进行操作。类似于在按钮单击事件中执行以下操作:
document.getElementById('<yourFormName>').action = '${flowExecutionUrl}&_eventId=<yourEventID>';
document.getElementById('<yourFormName>').submit();
document.getElementById(“”).action='${flowExecutionUrl}&_eventId=';
document.getElementById(“”).submit();
这可能会对您有所帮助。您应该添加隐藏字段以保留快照变量(表示localhost:8080/yourappcontext/yourpage?execution=e1s1)。在上面的url中,e1s1是快照变量的值。因此,在你的情况下:
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
<input type="submit" value="Proceeding" name="_eventId_proceed"/>
但是这两个标签都应该是停留在表单标签中
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
<input type="submit" value="Proceeding" name="_eventId_proceed"/>