I'm working with spring MVC, so Basically im creating a forum wich will take a file and radioButton as Input: form_li.jsp:
<f:form id="form1"
name="form1"
modelAttribute="parametre"
action="${addTreat}"
method="POST"
enctype="multipart/form-data">
<table>
<tr>
<td>xslx File : </td>
<td>
<f:input id="filepd" path="fileCom" name="filepd" type="file" />
</td>
</tr>
<tr>
<td>Choice </td>
<td>
<div>
<f:input id="az" name="az" path="choice" type="radio" value="false" />
<label for="az">1</label>
<f:input id="aj" name="aj" path="choice" type="radio" value="true"/>
<label for="aj">2</label>
</div>
</td>
</tr>
<tr>
<div align="center">
<f:input type="submit" value="Validate" path="" />
</div>
</tr>
</table>
</f:form>
for myController :
@RequestMapping(value="/addTreat", method= RequestMethod.POST)
public String addTr(HttpServletRequest req,
BindingResult result,
ModelMap model,
@RequestParam("parametre") Parametre parametre) {
model.addAttribute("parametre", new Parametre());
return form_li;
}
for the class Parametre.java:
public class Parametre {
private String choice;
private MultipartFile fileCom;
//getters and setters
//default constructor
}
my problem is when running the application and going to the /addTreat url. im getting the famous Neither BindingResult nor plain target object for bean name 'parametre' available as request attribute. i have tried multiple solutions but i doesn't work. please can anyone help to fix this problem.