表格选择,春季MVC错误

时间:2018-08-18 14:28:33

标签: spring spring-mvc drop-down-menu

student_form.jsp

<form:form  action="studentProcess" modelAttribute="student">
        Ime : <form:input path="username"/>
        Prezime : <form:input path="password"/>
        <br>
        <form:select path="mapaBroj">
            <form:options items="${student.mapaBroj}"/>
        </form:select>

        <br>
        Muski : <form:radiobutton path="pol" value="Muski"/>
        Zenski : <form:radiobutton path="pol" value="Zenski"/>
        <input type="submit" value="OK">
    </form:form>

学生控制器

@Controller
@RequestMapping("/student")
public class StudentKontroler {

    @RequestMapping("/studentForma")
    public String studentForma(Model model) {
        Student student = new Student();
        model.addAttribute("student", student);
        return "student_form";
    }

    @RequestMapping("/studentProcess")
    public String studentProcess(@ModelAttribute("student") Student student) {

        return "student_ispis";
    }
}

和student_ispis.jsp

Ime studenta : ${student.username} <br>
Sifra studenta : ${student.password} <br>
Vrijednost : ${student.mapaBroj} <br>
Pol : ${student.pol} <br>

学生模型类:

public class Student {
    private String username;
    private String password;
    private String broj;
    private LinkedHashMap<String, String> mapaBroj;
    private String pol;
    ...
}

它看起来像这样:

student_ispis.jsp page

它看起来根本不像选择选项。当我按下“提交”按钮时,它会引发以下消息:“由于某些原因(可能是客户端语法错误,无效的请求消息框架或欺骗性的请求路由),服务器无法或不会处理该请求。 “

0 个答案:

没有答案