我在JSP中显示错误时遇到问题。这是代码:
<form action="" method="post">
<form:hidden path="id" />
<spring:bind path="set.name">
<span>Set name:</span>
<input type="text" name="${status.expression}" value="${status.value}" required="required">
<form:errors path="set.name" />
</spring:bind>
<br/><br/>
<spring:bind path="setup.targetLanguage">
<span>Target language:</span>
<form:select id="target-language" path="setup.targetLanguage" >
<option value="${category.defaultTargetLanguage.id}" selected="selected">${category.defaultTargetLanguage}</option>
<option value="${category.defaultSrcLanguage.id}">${category.defaultSrcLanguage}</option>
</form:select>
</spring:bind>
<spring:bind path="setup.targetSide">
<span>Target side:</span>
<form:select id="target-side" path="setup.targetSide">
<option value="${targetSide}" selected="selected">${targetSide}</option>
<option value="${srcSide}">${srcSide}</option>
</form:select>
</spring:bind>
命令<form:errors path="set.name" />
不起作用。我在这里不使用modelAttribute,因为我需要将数据传递给两个对象:set和setup。它必须在一个<form>
中。有解决方案吗?