问题在于表单中显示和接收数据的参数名不一样所致,比如
<input type="text" name="student.name" value="student.name">
这是正确的
如果写成
<input type="text" name="student.name" value="studentTwo.name">
验证不通过input回来的时候就会清空表单,原因在于
action(student, studentTwo)-页面form(student)-action(student)-页面form(student)
到第四步的页面form的时候studentTwo已经没值了.所以页面被清空了
<input type="text" name="student.name" value="student.name">
这是正确的
如果写成
<input type="text" name="student.name" value="studentTwo.name">
验证不通过input回来的时候就会清空表单,原因在于
action(student, studentTwo)-页面form(student)-action(student)-页面form(student)
到第四步的页面form的时候studentTwo已经没值了.所以页面被清空了
本文探讨了表单中因参数名不一致导致的数据显示与接收问题。详细分析了当表单元素的名称与预期接收的数据源不匹配时,如何引发表单验证失败及数据丢失现象,并提供了解决思路。
2936

被折叠的 条评论
为什么被折叠?



