我在向Spring Form输入字段分配默认值时遇到问题。这是我的代码

<form:form method="post" modelAttribute="employeeDirectoryInfo">
      <form:input type="text" value=${employeeInfo.employee_id}>
</form>

问题是它会说value attribute is not valid for tag <form:input>

有帮助吗?

解决方案

您是仅尝试将该值插入输入框,还是要将该属性绑定到该框(以便用户输入的新值存储在该属性中)?

如果是前者,那么只需使用常规HTML <input type="text">并按原样设置值。

如果是后者,请不要使用<!>“;值<!>”;使用<!>“;路径<!>”,并取消$ {}。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top