コード例 #1
0
  @RequestMapping("/registration/add")
  public String addStudent(HttpServletRequest request) {

    String[] languageStrings = request.getParameterValues("languages");
    ProgrammingLanguage[] languages = new ProgrammingLanguage[languageStrings.length];
    for (int i = 0; i != languageStrings.length; ++i) {
      languages[i] = ProgrammingLanguage.findMatch(languageStrings[i]);
    }
    Student student =
        new Student(
            request.getParameter("sid"),
            request.getParameter("unikey"),
            request.getParameter("password"),
            request.getParameter("firstName"),
            request.getParameter("lastName"),
            request.getParameter("primaryEmail"),
            request.getParameter("mobile"),
            StudyLevel.findMatch(request.getParameter("studyLevel")),
            Boolean.parseBoolean(request.getParameter("esl")),
            languages);
    student.setExperience(request.getParameter("experience"));
    student.setCourse(request.getParameter("course"));
    student.setSecondaryEmail(request.getParameter("secondaryEmail"));
    return "redirect:/"; // return to index page
  }
コード例 #2
0
 @RequestMapping("/registration")
 public String getEnums(Map<String, Object> map) {
   map.put("programmingLanguages", ProgrammingLanguage.getNames());
   map.put("roles", Role.getNames());
   map.put("socialMediaProviders", SocialMedia.Provider.getNames());
   map.put("studyLevels", StudyLevel.getNames());
   return "registration";
 }