Передача нескольких значений для Modelandview ⇐ JAVA
Передача нескольких значений для Modelandview
I have a Java Object that I use part of the ModelandView as below,
Spring Controller:-
@RequestMapping(value = "/student", method = RequestMethod.GET) public ModelAndView student() { return new ModelAndView("student", "command", new Student()); } Java Object:-
import java.util.List; public class Student { private Integer age; private String fname; private String mname; private String lname; private String dob; private List gender; private String birthplace; private String nationality; private String mothertongue; private String religion; private Integer id; public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public String getFname() { return fname; } public void setFname(String fname) { this.fname = fname; } public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } public String getDob() { return dob; } public void setDob(String dob) { this.dob = dob; } public List getGender() { return gender; } public void setGender(List gender) { this.gender = gender; } public String getBirthplace() { return birthplace; } public void setBirthplace(String birthplace) { this.birthplace = birthplace; } public String getNationality() { return nationality; } public void setNationality(String nationality) { this.nationality = nationality; } public String getMothertongue() { return mothertongue; } public void setMothertongue(String mothertongue) { this.mothertongue = mothertongue; } public String getReligion() { return religion; } public void setReligion(String religion) { this.religion = religion; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } JSP file
Student Information Name Age id Question:-
I need to pass a list for sex ie; MALE and FEMALE to the JSP File...I can add it as a array in my Java object but how do I reference in my JSP file..
Источник: https://stackoverflow.com/questions/263 ... delandview
I have a Java Object that I use part of the ModelandView as below,
Spring Controller:-
@RequestMapping(value = "/student", method = RequestMethod.GET) public ModelAndView student() { return new ModelAndView("student", "command", new Student()); } Java Object:-
import java.util.List; public class Student { private Integer age; private String fname; private String mname; private String lname; private String dob; private List gender; private String birthplace; private String nationality; private String mothertongue; private String religion; private Integer id; public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public String getFname() { return fname; } public void setFname(String fname) { this.fname = fname; } public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } public String getDob() { return dob; } public void setDob(String dob) { this.dob = dob; } public List getGender() { return gender; } public void setGender(List gender) { this.gender = gender; } public String getBirthplace() { return birthplace; } public void setBirthplace(String birthplace) { this.birthplace = birthplace; } public String getNationality() { return nationality; } public void setNationality(String nationality) { this.nationality = nationality; } public String getMothertongue() { return mothertongue; } public void setMothertongue(String mothertongue) { this.mothertongue = mothertongue; } public String getReligion() { return religion; } public void setReligion(String religion) { this.religion = religion; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } JSP file
Student Information Name Age id Question:-
I need to pass a list for sex ie; MALE and FEMALE to the JSP File...I can add it as a array in my Java object but how do I reference in my JSP file..
Источник: https://stackoverflow.com/questions/263 ... delandview
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Как открыть ответ Spring ModelAndView в методе успеха Ajax как полную страницу?
Anonymous » » в форуме JAVA - 0 Ответы
- 13 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Как открыть ответ Spring ModelAndView в методе успеха Ajax как полную страницу?
Anonymous » » в форуме Jquery - 0 Ответы
- 6 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Как нам решить, нужно ли нам использовать ModelAndView или String в методе Controlle Spring?
Anonymous » » в форуме JAVA - 0 Ответы
- 5 Просмотры
-
Последнее сообщение Anonymous
-