开发者

Spring Web Flow Set Form Input Value

开发者 https://www.devze.com 2022-12-09 14:06 出处:网络
I am having a problem assigning a default value to my Spring Form input field. Here\'s my code <form:form method=\"post\" modelAttribute开发者_如何学Python=\"employeeDirectoryInfo\">

I am having a problem assigning a default value to my Spring Form input field. Here's my code

<form:form method="post" modelAttribute开发者_如何学Python="employeeDirectoryInfo">
      <form:input type="text" value=${employeeInfo.employee_id}>
</form>

The problem is it will say that value attribute is not valid for tag <form:input>.


Are you just trying to insert that value into the input box, or do you want to bind that property to the box (so that a new value typed by the user gets stored in that property)?

If the former, then just use a regular HTML <input type="text"> and set the value as you are doing.

If the latter, don't use "value", use "path", and leave off the ${}.

0

精彩评论

暂无评论...
验证码 换一张
取 消