Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring-Web流:Can';我看不到第二眼_Spring_Jsp_Spring Mvc_Spring Webflow - Fatal编程技术网

Spring-Web流:Can';我看不到第二眼

Spring-Web流:Can';我看不到第二眼,spring,jsp,spring-mvc,spring-webflow,Spring,Jsp,Spring Mvc,Spring Webflow,我正在使用SpringWebFlow进行注册过程。我完全有了流程的第一页,但是当我点击应该带你到第二页的按钮时,我又得到了流程的第一页。正如您将在代码中看到的,我在标签上有flowExecutionKey,当我单击按钮时,它从e1s1转到e2s1,因此我认为它不会引导我进入流的第二个视图,而是启动一个新的流 代码如下: 因此,我有一个flow.xml: <?xml version="1.0" encoding="UTF-8"?> <flow xmlns="http://www.

我正在使用SpringWebFlow进行注册过程。我完全有了流程的第一页,但是当我点击应该带你到第二页的按钮时,我又得到了流程的第一页。正如您将在代码中看到的,我在标签上有flowExecutionKey,当我单击按钮时,它从e1s1转到e2s1,因此我认为它不会引导我进入流的第二个视图,而是启动一个新的流

代码如下:

因此,我有一个flow.xml:

<?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" start-state="inicio">
    <var name="proyecto" class="myPackage.MyModelClass"/>
<view-state id="inicio" view="inicio" model="proyecto">
    <binder>
        <binding property="titulo"/>
        <binding property="descripcion"/>
        <binding property="ciudad"/>

    </binder>
    <transition on="gotoPageTwo" to="flow2"></transition>

</view-state>
<view-state id="flow2" view="flow2" model="proyecto">
    <transition on="gotoPageThree" to="flow3"></transition>
    <transition on="goBack" to="inicio"></transition>
</view-state>
<view-state id="flow3" view="flow3" model="proyecto">
    <transition on="gotoPageFour" to="fin"></transition>
    <transition on="goBack" to="flow2"></transition>
</view-state>
<end-state id="fin" view="final">
</end-state>

这是我的inicio.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page session="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="/myapp/resources/css/main.css" rel="stylesheet" type="text/css">
<link href="/myapp/resources/css/tcal.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/myapp/resources/scripts/tcal.js"></script>
<title>Paso 1</title>
</head>
<body>
<form method="post" action="inicio.do">
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
<label>flowExecutionKey: ${flowExecutionKey}</label>
<table>
<tr>
    <td>
        <label class="textform">Título del proyecto</label>
    </td>
    <td>
        <input type="text" name="titulo">
    </td>
</tr>
<tr>
    <td>
        <label class="textform">Descripción</label>
        </td>
    <td>
        <input type="text" name="descripcion">
    </td>
</tr>
<tr>
    <td>
        <label class="textform">Ciudad del proyecto</label>
    </td>
    <td>
        <input type="text" name="ciudad">
    </td>
</tr>

<tr>
    <td>
      <input type="submit" value="Siguiente" name="_eventId=gotoPageTwo">
    <%--<a href="${flowExecutionUrl}&_eventId=gotoPageTwo&_flowExecutionKey=${flowExecutionKey}"> Siguiente página</a> 
         <input type="submit" value="Siguiente" name="eventId=gotoPageTwo">
          <input type="submit" value="Siguiente" name="${flowExecutionUrl}&_eventId=gotoPageTwo">--%>
    </td>
</tr>

Paso 1
flowExecutionKey:${flowExecutionKey}
蒂图罗·德尔·普罗耶克托
描述
项目城市

如您所见,我尝试发送一个gotoPageTwo的eventId,如flow.xml中所述

以及servlet-context.xml上与Spring web流相关的bean:

<beans:bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">

    <beans:property name="mappings">
    <beans:value>inicio.do=flowController</beans:value>
    </beans:property>
    <beans:property name="alwaysUseFullPath" value="true"></beans:property>
</beans:bean>
<beans:bean id="flowcontroller" class="org.springframework.webflow.mvc.servlet.FlowController">
<beans:property name="flowExecutor" ref="flowExecutor"></beans:property>
</beans:bean>
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry"/>
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices"> 
        <webflow:flow-location id="inicio" path="/WEB-INF/flujos/flow.xml"/> 
</webflow:flow-registry>   
<webflow:flow-builder-services id="flowBuilderServices" 
        view-factory-creator="viewFactoryCreator"/>
        <beans:bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
        <beans:property name="viewResolvers">
        <beans:list>
            <beans:ref bean="viewResolver"/>
        </beans:list>
        </beans:property>
        </beans:bean>
 <beans:bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <beans:property name="prefix" value="/WEB-INF/views/" />
    <beans:property name="suffix" value=".jsp" />
</beans:bean>

inicio.do=流量控制器
为什么会这样?我的错误在哪里?评论中的第一个链接起作用并显示第二个视图,但我认为它不发送表单,因此我没有数据,它是一个链接,而不是一个按钮:

<a href="${flowExecutionUrl}&_eventId=gotoPageTwo&_flowExecutionKey=${flowExecutionKey}"> Siguiente página</a>

其他的评论是我尝试过的,但不起作用


谢谢大家!

您需要将代码更改为:

    <td>
        <input type="submit" value="Siguiente" name="_eventId_gotoPageTwo">
    </td>

当您使用anchor href时,您将_eventId作为参数传递,因此您拥有它_eventId=gotoPageTwo

而现在“_eventId”编码在按钮字段的名称中,因此当表单提交时,“gotoPageTwo”事件将在流的当前状态下发出信号

另外,将表格更改为

    <form:form method="post"  modelAttribute="proyecto">


这是一个很好的提示,我在按钮名称中将=与u混淆,但不幸的是,它不起作用。我保持流的第一个状态,flowexecutionKey从e1s1更改为e2s1。谢谢。上下文文件中有两个问题:1)为什么有两个FlowController?2) viewResolver bean怎么样?(显示详细信息)1)我已经做了很多测试,可能我添加了最后一个而没有实现2)请参见编辑。好的,不作为视图使用的操作属性由flowController控制。另外,我建议使用spring表单标记。我做了一个编辑,在回答中提出了同样的建议。删除多个flowController定义。我移动到Spring表单库,现在它可以工作了。非常感谢。但这是否意味着如果不使用这个标记库,我就不能这样做?