I've a <form:textarea>
element. I would like to prefill it with data from the modelAttributes
Here's my code :
java :
ArrayList<Bloc> lblocs= new ArrayList<>();
lblocs = blocDao.getListBlocs();
modelMap.addAttributes("listeBlocs", lblocs);
Jsp :
<form:form method="post" modelAttribute="listeBlocs">
<c:forEach var="bloc" items="${listeBlocs}" varStatus="status">
<form:textarea path="bloc_contenu" name="BContenu_textarea"
value="" />
</c:forEach>
</form:form>
bloc_contenu is supposed to be a String attribute to a Bloc object. When I load the page I get the following error :
Invalid property 'bloc_contenu' of bean class [java.util.ArrayList]: Bean property 'bloc_contenu' is not readable or has an invalid getter method
Any suggestions?
change your textarea to this code
columnName is the name of the column in your database. you must have created it in model class with its getterts/setters!