Ich bin neu in Spring, und ich habe ein Problem. Ich habe ein Formular, das verwendet wird, um Informationen an den Controller zu senden. Ich brauche oder will keinen Bean die Form Sicherung haben, damit ich in Form leer wie dies das commandName
Attribut links:Spring form ohne commandName
<form:form action="getReportFile.html" method="post">
<table>
<tr>
<td><form:label path="field1">Field1:</form:label></td>
</tr>
<tr>
<td><form:select path="field1" items="${FieldMap}" />
</td>
</tr>
<tr>
<td><form:label path="field2">Field2:</form:label></td>
</tr>
<tr>
<td><form:input path="field2"/></td>
</tr>
<tr>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>
</form:form>
Ich erhalte die folgende Fehlermeldung:
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute
Ich könnte here sehen, dass, wenn Sie commandName
keinen Wert geben, verwendet es die Standardeinstellung 'command'
, aber dann Muss ich noch etwas konfigurieren? sollte ich eine 'command'
Bohne in die dispatcher-servlet.xml
setzen? Wie wäre diese Bohne?
Ich möchte nur ein Formular, um die Informationen an den Controller zu senden. Muss ich wirklich eine Bohne erstellen, um es zu unterstützen?
Nun, eigentlich die andere Frage ist ein Duplikat dieser, wie dieses vor :) @SotiriosDelimanolis –