http://hi.baidu.com/danghj/blog/item/e567b5340e1677add0a2d3b6.html
只是为了记录,避免忘记
<form action="regDo.do" method="POST">
<table style="width: 100%; height: 100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th>邮箱</th>
<td><input name="termId" type="text" class="text-input" /></td>
<td><form:errors path="term.termId"></form:errors></td>
</tr>
<tr>
<th>密码</th>
<td><input id="termName" name="termName" type="text" class="text-input" /></td>
<td><form:errors path="term.termName"></form:errors></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="btn_tijiao" value="提交注册" /></td>
</tr>
</table>
</form>
<form:form action="regDo.do" method="POST" commandName="term">
<table style="width: 100%; height: 100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th>邮箱</th>
<td><input name="termId" type="text" class="text-input" /></td>
<td><form:errors path="termId"></form:errors></td>
</tr>
<tr>
<th>密码</th>
<td><input id="termName" name="termName" type="text" class="text-input" /></td>
<td><form:errors path="termName"></form:errors></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="btn_tijiao" value="提交注册" /></td>
</tr>
</table>
</form:form>
同时:
@ModelAttribute("term") Terms term, BindingResult result
在freemarker中
<form action="regDo.do" method="POST">
<table style="width: 100%; height: 100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th>termId---</th>
<td>
[@spring.formInput "term.termId" /]
</td>
<td>[@spring.showErrors "" /]</td>
</tr>
<tr>
<th></th>
<td>
</td>
<td>[@spring.showErrors "" /]</td>
</tr>
<tr>
<th>taxonomy</th>
<td>
[@spring.formInput "term.taxonomy" /]
</td>
<td></td>
</tr>
<tr>
<th>termName</th>
<td>
[@spring.formInput "term.termName" /]
</td>
<td>[@spring.showErrors "" /]</td>
</tr>
<tr>
<th></th>
<td>
</td>
<td>[@spring.showErrors "" /]</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="btn_tijiao" value="提交注册" /></td>
</tr>
</table>
</form>
那么: