Springs Web Flow問題表單提交值正確,AjaxEventDecoration不正確
您</b>在“有效”之后沒有任何結(jié)束,但是</n>。這些事情有時會導致奇怪的問題,例如您遇到的問題
修復它,然后再試一次
[編輯]我找到了一個解決方案給您pb:基本上刪除您選擇的裝飾和ajax事件,并以此方式進行操作:
<tr> <td><font color=red><form:errors path='sex' /></font><b>Sex:</b></td> <td><form:select path='sex' required='true' data-dojo-type='dijit/form/Select' onchange='Spring.remoting.submitForm(’sex’, ’customer’, {fragments:’body’, _eventId: ’loadSchools’}); return false;'> <form:option value='MALE' label='MALE' /> <form:option value='FEMALE' label='FEMALE' /></form:select> </td></tr>
似乎選擇裝飾存在一些問題…我將嘗試看看是否可以找到另一種方法,但是我對此進行了測試,并且可以正常工作
解決方法我在Springs Web Flow中遇到問題。如果用戶單擊表單提交按鈕,則我的bean 中將有 RIGHT 值。
例如,性別字段為MALE或FEMALE。但是,然后我添加了一個 AjaxEventDecoration來對性別下拉框的更改進行提交,這實際上是一種 形式:select, 并且在bean中,我將獲得值 “ sex”,即elementId。下面是我的代碼,請您檢查一下,讓我知道您的想法…我需要盡快解決此問題…
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core'%><%@ taglib prefix='fmt' uri='http://java.sun.com/jstl/fmt'%><%@ taglib prefix='form' uri='http://www.springframework.org/tags/form'%><style type='text/css' media='screen'> @import url('<c:url value='/resources/dojo/resources/dojo.css'/>'); @import url('<c:url value='/resources/dijit/themes/claro/claro.css'/>');</style><script djconfig='parseOnLoad: true' src='http://www.cgvv.com.cn/wenda/<c:url value='/resources/dojo/dojo.js'/>' type='text/javascript'></script><script type='text/javascript' src='http://www.cgvv.com.cn/wenda/<c:url value='/resources/spring/Spring.js' />'> </script><script type='text/javascript' src='http://www.cgvv.com.cn/wenda/<c:url value='/resources/spring/Spring-Dojo.js' />'></script><script type='text/javascript'>dojo.require('dojo.parser');</script><html><head><title>Spring 3.0 MVC - Web Flow Example</title></head><body class='claro'> <h2>Dropdown Test</h2> <form:form commandName='customer' id='customer'><input type='hidden' name='_flowExecutionKey' value='${flowExecutionKey}' /><div id='container'> <table><tr> <td><font color=red><form:errors path='sex' /></font><b>Sex:</b></td> <td><form:select path='sex' id='sex'> <form:option value='MALE' label='MALE' /> <form:option value='FEMALE' label='FEMALE' /></form:select><script type='text/javascript'>Spring.addDecoration(new Spring.ElementDecoration({ elementId : 'sex',widgetType : 'dijit.form.Select',widgetAttrs : { promptMessage : 'Enter Sex',required : true }})); </script></td></tr></table></div><input type='submit' name='_eventId_submit' value='Submit' /><input type='submit' name='_eventId_cancel' value='Cancel' /><p><script type='text/javascript'> Spring.addDecoration(new Spring.ValidateAllDecoration({elementId : ’submit’,event : ’onclick’ })); Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId: 'sex',event: 'onChange',formId:'customer',params: {fragments:'body',_eventId: 'loadSchools'}}));</script> </form:form></body></html>
相關文章:
