Spring Web Flow - 形式:radiobutton

时间:2018-05-30 19:27:04

标签: spring spring-webflow

有人能帮我理解这里有什么问题吗?

这是来自Spring web flow项目的片段。我在 中创建新对象 订单 并从数据库中获取 对象的列表视图状态标记。

    <?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.xsd">

    <input name="order" required="true" />

    <view-state id="chooseTable" model="flowScope.order">
        <on-entry>
            <set name="flowScope.order" value="new pizza.Order()"></set>
            <evaluate expression="pizzaFlowActions.getFreeTables()"
                result="viewScope.tables" />
        </on-entry>
        <transition on="chosenCreateOrder" to="bookedToOrder">
        <evaluate expression="order.setTable(flowScope.order)" />
        </transition>
        <transition on="chosenNoOrder" to="booked">
        <evaluate expression="order.setTable(flowScope.order)" />
        </transition>
        <transition on="cancel" to="cancel" />
    </view-state>

    <end-state id="cancel" />

    <end-state id="bookedToOrder">
    </end-state>

    <end-state id="booked">
    </end-state>

    <global-transitions>
        <transition on="cancel" to="cancel" />
    </global-transitions>
</flow>

带有与 订单 对象绑定的表单的Jsp文件,以及radiobuttons&#39;从 表格列表 中提取的值。

<html xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:spring="http://www.springframework.org/tags"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:form="http://www.springframework.org/tags/form">

<jsp:output omit-xml-declaration="yes" />
<jsp:directive.page contentType="text/html;charset=UTF-8" />

<head>
<title>Book a table</title>

</head>
<body background = "${pageContext.request.contextPath}/resources/plan.gif">
    <form:form commandName="order" class="box login">
    <input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" />        
        <b>Choose table: </b>
        <c:forEach items="${tables}" var="place">   
           <form:radiobutton path="table" label="${place}" value="${place}"/>
        <br></br> 
        <br></br>   
        </c:forEach>
        <input type="submit" class="btnLogin" name="_eventId_chosenCreateOrder" value="Now choose Pizza" />
        <input type="submit" class="btnLogin" name="_eventId_chosenNoOrder" value="Just book a table" />
        <input type="submit" class="btnLogin" name="_eventId_cancel" value="Cancel" />
    </form:form>
</body>
</html>

订单类

public class Order implements Serializable {
private static final Logger LOGGER = getLogger(Order.class);
private int id;
private Customer customer;
private Set<Pizza> pizzas;
private Payment payment;
private Place table;

这里的问题是,在任何时候选择任何变体后,表单只是重新加载而且没有任何其他事情发生。

非常感谢任何帮助和提示。

0 个答案:

没有答案