cedric
cedric

Reputation: 3147

Spring Web Flow Set Form Input Value

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

<form:form method="post" modelAttribute="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>.

Upvotes: 1

Views: 5796

Answers (1)

Jacob Mattison
Jacob Mattison

Reputation: 51052

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 ${}.

Upvotes: 2

Related Questions