Java 使用SpringWebFlow中的链接在WebFlow中进行数据传输
我正在尝试创建SpringWebFlow应用程序。我有以下情况: flow1.xmlJava 使用SpringWebFlow中的链接在WebFlow中进行数据传输,java,spring,jsp,spring-webflow,Java,Spring,Jsp,Spring Webflow,我正在尝试创建SpringWebFlow应用程序。我有以下情况: flow1.xml <var name="user" class="com.test.User" /> <view-state id="signup" model="user"> <transition on="loginCredentialsEntered" to="lookupUser" /> </view-state> <decision-state id=
<var name="user" class="com.test.User" />
<view-state id="signup" model="user">
<transition on="loginCredentialsEntered" to="lookupUser" />
</view-state>
<decision-state id="lookupUser">
<if test="myActionBean.lookupUser(user)"
then="userRegistered" else="registerUser" />
</decision-state>
signup.jsp:
<html xmlns:form="http://www.springframework.org/tags/form">
<body>
<form action="&_eventId=loginCredentialsEntered" method="post">
<input type="hidden" name="_flowExecutionKey" value=""/>
<table>
<tr>
<td>Login Name:</td>
<td><input type="text" name="loginName"/></td>
</tr>
</table>
<input type="submit" value="Login" />
</form>
</body>
</html>
登录名:
在方法myActionBean.lookupUser(user)中,我可以看到正在传递的user.loginName是在表单中输入的
但是,如果我使用链接而不是按钮来提交表单
<a href="${flowExecutionUrl}&_eventId=loginCredentialsEntered">Login</a>
我可以看到user.loginName为null
有人能给我解释一下原因和解决办法吗
提前感谢这是因为该表单没有提交到任何地方。
将
表单
标记更改为:
<form action="${flowExecutionUrl}&_eventId=loginCredentialsEntered"
method="post">
这是因为表单没有提交到任何地方。
将
表单
标记更改为:
<form action="${flowExecutionUrl}&_eventId=loginCredentialsEntered"
method="post">
这是因为表单没有提交到任何地方。
将
表单
标记更改为:
<form action="${flowExecutionUrl}&_eventId=loginCredentialsEntered"
method="post">
这是因为表单没有提交到任何地方。
将
表单
标记更改为:
<form action="${flowExecutionUrl}&_eventId=loginCredentialsEntered"
method="post">
如果您将按钮替换为锚定,那么您将不再提交表单?单击链接不会发送
loginName
参数-因为它没有提交表单
如果要用链接替换按钮,则需要在单击链接时使用Javascript提交表单
为表单指定一个名称:
<form name="myForm" action="${flowExecutionUrl}&_eventId=loginCredentialsEntered"
method="post">
并将链接修改为:
<a href="#" onclick="document.myForm.submit();">Login</a>
或者,更好的解决方案是保留按钮,并使用CSS将其样式设置为更像链接。那么就不需要Javascript了。如果你用锚来替换按钮,那么你就不再提交表单了?单击链接不会发送
loginName
参数-因为它没有提交表单
如果要用链接替换按钮,则需要在单击链接时使用Javascript提交表单
为表单指定一个名称:
<form name="myForm" action="${flowExecutionUrl}&_eventId=loginCredentialsEntered"
method="post">
并将链接修改为:
<a href="#" onclick="document.myForm.submit();">Login</a>
或者,更好的解决方案是保留按钮,并使用CSS将其样式设置为更像链接。那么就不需要Javascript了。如果你用锚来替换按钮,那么你就不再提交表单了?单击链接不会发送
loginName
参数-因为它没有提交表单
如果要用链接替换按钮,则需要在单击链接时使用Javascript提交表单
为表单指定一个名称:
<form name="myForm" action="${flowExecutionUrl}&_eventId=loginCredentialsEntered"
method="post">
并将链接修改为:
<a href="#" onclick="document.myForm.submit();">Login</a>
或者,更好的解决方案是保留按钮,并使用CSS将其样式设置为更像链接。那么就不需要Javascript了。如果你用锚来替换按钮,那么你就不再提交表单了?单击链接不会发送
loginName
参数-因为它没有提交表单
如果要用链接替换按钮,则需要在单击链接时使用Javascript提交表单
为表单指定一个名称:
<form name="myForm" action="${flowExecutionUrl}&_eventId=loginCredentialsEntered"
method="post">
并将链接修改为:
<a href="#" onclick="document.myForm.submit();">Login</a>
或者,更好的解决方案是保留按钮,并使用CSS将其样式设置为更像链接。那么就不需要Javascript了。亲爱的阿尔法辛,谢谢你的回复。亲爱的阿尔法辛,谢谢你的回复。我想将域对象绑定到表单。因此,我将整个对象传递给myActionBean.lookupUser(用户)。不管怎样,现在表单看起来如下所示:'',但它没有帮助。myActionBean.lookupUser()方法中的user.email仍然为空亲爱的Alfasin,感谢您的回复。亲爱的Alfasin,感谢您的回复。我想将域对象绑定到表单。因此,我将整个对象传递给myActionBean.lookupUser(用户)。不管怎样,现在表单看起来如下所示:'',但它没有帮助。myActionBean.lookupUser()方法中的user.email仍然为空亲爱的Alfasin,感谢您的回复。亲爱的Alfasin,感谢您的回复。我想将域对象绑定到表单。因此,我将整个对象传递给myActionBean.lookupUser(用户)。不管怎样,现在表单看起来如下所示:'',但它没有帮助。myActionBean.lookupUser()方法中的user.email仍然为空亲爱的Alfasin,感谢您的回复。亲爱的Alfasin,感谢您的回复。我想将域对象绑定到表单。因此,我将整个对象传递给myActionBean.lookupUser(用户)。不管怎样,现在表单看起来如下所示:'',但它没有帮助。在myActionBean.lookupUser()方法中user.email仍然为空。这个技巧奏效了,非常感谢。我正在使用这个链接,因为我的HTML开发人员设计的页面使链接看起来像一个按钮。这个技巧很有效,非常感谢。我正在使用这个链接,因为我的HTML开发人员设计的页面使链接看起来像一个按钮。这个技巧很有效,非常感谢。我正在使用这个链接,因为我的HTML开发人员设计的页面使链接看起来像一个按钮。这个技巧很有效,非常感谢。我使用的是链接,因为我的HTML开发人员设计的页面使链接看起来像一个按钮。