Bonjour ou bonsoir à tous!

Voilà, j'ai un petit soucis avec Spring et les formulaires. Je vous donne mon code du formulaire

infoDossier.jsp

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
 
<div>
<form:form method="post" commandName="addBindInfraction">
					<form:select path="niveau">
						<c:forEach items="${model.collInfractions}" var="infraction">
							<form:option value="${infraction.id}" >"${infraction.description}" ("${infraction.niveau}")</form:option>
			        	</c:forEach>
					</form:select>
					<input type="submit" value="Ajouter" />
				</form:form>
			</div>
Je vous donne le code du controller qui controle pas grand chose

InfoController.java

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
public ModelAndView onSubmit(Object command, BindException errors)
	throws ServletException, Exception {
		Infraction infraction = (Infraction) command;
		dossier.addInfraction(infraction);
 
		return super.onSubmit(command, errors);
	}
Maintenant la configuration de spring pour ce formulaire

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
<bean name="/infoDossier.htm" class="ca.etsmtl.log720.equipe8.web.InfoController">
	<property name="sessionForm" value="true"/>
	<property name="commandName" value="addBindInfraction"/>
	<property name="commandClass" value="ca.etsmtl.log720.equipe8.beans.Infraction"/>
</bean>
Lorsque j'exécute tout ce beau code la ca me donne l'erreur suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'addBindInfraction' available as request attribute
	at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141)
	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:172)
	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:192)
	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:158)
	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:145)
	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:136)
	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:120)
	at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:379)
	at org.springframework.web.servlet.tags.form.SelectTag.writeTagContent(SelectTag.java:198)
	at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:90)
	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77)
	at org.apache.jsp.jsp.infoDossier_jsp._jspService(infoDossier_jsp.java:169)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Ça fait au moin 3 bonnes heures que je cherche des informations la dessus et je ne trouve pas grand chose. Donc si quelqu'un pouvait m'aider ce serait apprécié.

Merci!