lundi 4 janvier 2016

some error in spring mvc registraton program

i have a problem on this code please help me i have a error like this Neither BindingResult nor plain target object for bean name 'command' available as request attribute

controllercode

public class RegistrationController  {
@RequestMapping(value="/reg" ,method = RequestMethod.POST)
public String reg(@ModelAttribute("aaa") User user,ModelMap model,BindingResult res){
    model.addAttribute("Fname",user.getFname());
    System.out.println(user.getFname());
    model.addAttribute("Lname", user.getLname());
    model.addAttribute("Email", user.getEmail());
    model.addAttribute("Pwd", user.getPwd());
    model.addAttribute("Phnum", user.getPhnum());
    return "NewFile";


}

}

<form:form method="POST" action="/reg" name="aaa">
        <table>
            <tr>
                <td width="127"><form:label path="Fname">Employee Id:</form:label></td>
                <td width="102"><form:input path="Fname" /></td>
            </tr>
            <tr>
                <td width="127"><form:label path="Lname">Employee Id:</form:label></td>
                <td width="102"><form:input path="Lname" /></td>
            </tr>
            <tr>
                <td width="127"><form:label path="Email">Employee Id:</form:label></td>
                <td width="102"><form:input path="Email" /></td>
            </tr>
            <tr>
                <td width="127"><form:label path="Pwd">Employee Id:</form:label></td>
                <td width="102"><form:input path="Pwd" /></td>
            </tr>
            <tr>
                <td width="127"><form:label path="Phnum">Employee Id:</form:label></td>
                <td width="102"><form:input path="Phnum" /></td>
            </tr>

        </table>




Aucun commentaire:

Enregistrer un commentaire