views:

641

answers:

2

Hi.... I am having a problem assigning 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>
+1  A: 

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

JacobM
You were right.hehe... Just leave off the value and ${} part
cedric
A: 

What in the case you want to do both? bind a property, and set a default value? like

guillaume