Java Code Examples for org.springframework.web.servlet.view.RedirectView#setContextRelative()
The following examples show how to use
org.springframework.web.servlet.view.RedirectView#setContextRelative() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StudentLoginController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute LoginForm studLoginForm, BindingResult bindingResult){ model.addAttribute("studLoginForm", studLoginForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); if(bindingResult.hasErrors()) { studLoginForm = new LoginForm(); redirectView.setUrl("/smp/stud_login.html"); model.addAttribute("studLoginForm", studLoginForm); } else{ Login login = new Login(); login.setUserName(studLoginForm.getUsername()); login.setPassWord(studLoginForm.getPassword()); System.out.println("controller"+login.getUserName()); if(loginService.isStudentUser(login)){ redirectView.setUrl("/smp/stud_enroll.html"); model.addAttribute("studId", reportService.getStudentId(login.getUserName()).getStudentId()); }else{ studLoginForm = new LoginForm(); redirectView.setUrl("/smp/stud_login.html"); } } return redirectView; }
Example 2
Source File: AdminDepartmentFromController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute("deptForm") DepartmentForm deptForm, BindingResult bindingResult){ model.addAttribute("deptForm", deptForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/smp/admin_add_department.html"); List<Tbldepartment> depts = reportService.getAllDepartment(); model.addAttribute("depts", depts); if(bindingResult.hasErrors()) { deptForm = new DepartmentForm(); model.addAttribute("deptForm", deptForm); } else{ managementService.addDepartment(deptForm); deptForm = new DepartmentForm(); model.addAttribute("deptForm", deptForm); } return redirectView; }
Example 3
Source File: AdminCourseFormController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute("courseForm") CourseForm courseForm, BindingResult bindingResult){ model.addAttribute("courseForm", courseForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/smp/admin_add_course.html"); List<Tblcourses> courses = reportService.getAllCourses(); model.addAttribute("courses", courses); references(model); if(bindingResult.hasErrors()) { courseForm = new CourseForm(); model.addAttribute("courseForm", courseForm); } else{ managementService.addCourse(courseForm); courseForm = new CourseForm(); model.addAttribute("courseForm", courseForm); } return redirectView; }
Example 4
Source File: AdminDepartmentFromController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute("deptForm") DepartmentForm deptForm, BindingResult bindingResult){ model.addAttribute("deptForm", deptForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/smp/admin_add_department.html"); List<Tbldepartment> depts = reportService.getAllDepartment(); model.addAttribute("depts", depts); if(bindingResult.hasErrors()) { deptForm = new DepartmentForm(); model.addAttribute("deptForm", deptForm); } else{ managementService.addDepartment(deptForm); deptForm = new DepartmentForm(); model.addAttribute("deptForm", deptForm); } return redirectView; }
Example 5
Source File: AdminFacultyFormController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute("facultyForm") FacultyForm facultyForm, BindingResult bindingResult){ model.addAttribute("facultyForm", facultyForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/smp/admin_add_faculty.html"); List<Tblfaculty> faculty = reportService.getAllFaculty(); model.addAttribute("faculty", faculty); references(model); if(bindingResult.hasErrors()) { facultyForm = new FacultyForm(); model.addAttribute("facultyForm", facultyForm); } else{ managementService.addFaculty(facultyForm); facultyForm = new FacultyForm(); model.addAttribute("facultyForm", facultyForm); } return redirectView; }
Example 6
Source File: FacultyLoginController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute LoginForm facultyLoginForm, BindingResult bindingResult){ model.addAttribute("facultyLoginForm", facultyLoginForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); if(bindingResult.hasErrors()) { facultyLoginForm = new LoginForm(); redirectView.setUrl("/smp/faculty_login.html"); model.addAttribute("facultyLoginForm", facultyLoginForm); } else{ Login login = new Login(); login.setUserName(facultyLoginForm.getUsername()); login.setPassWord(facultyLoginForm.getPassword()); if(loginService.isFacultyUser(login)){ model.addAttribute("facultyId", reportService.getFacultyId(login.getUserName()).getFacultyId()); redirectView.setUrl("/smp/faculty_masterlist.html"); }else{ facultyLoginForm = new LoginForm(); redirectView.setUrl("/smp/faculty_login.html"); } } return redirectView; }
Example 7
Source File: AdminLoginController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute LoginForm adminLoginForm, BindingResult bindingResult){ model.addAttribute("adminLoginForm", adminLoginForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); if(bindingResult.hasErrors()) { adminLoginForm = new LoginForm(); redirectView.setUrl("/smp/admin_login.html"); model.addAttribute("adminLoginForm", adminLoginForm); } else{ Login login = new Login(); login.setUserName(adminLoginForm.getUsername()); login.setPassWord(adminLoginForm.getPassword()); if(loginService.isAdminUser(login)){ redirectView.setUrl("/smp/admin_pending.html"); }else{ adminLoginForm = new LoginForm(); redirectView.setUrl("/smp/admin_login.html"); } } return redirectView; }
Example 8
Source File: AdminFacultyFormController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute("facultyForm") FacultyForm facultyForm, BindingResult bindingResult){ model.addAttribute("facultyForm", facultyForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/smp/admin_add_faculty.html"); List<Tblfaculty> faculty = reportService.getAllFaculty(); model.addAttribute("faculty", faculty); references(model); if(bindingResult.hasErrors()) { facultyForm = new FacultyForm(); model.addAttribute("facultyForm", facultyForm); } else{ managementService.addFaculty(facultyForm); facultyForm = new FacultyForm(); model.addAttribute("facultyForm", facultyForm); } return redirectView; }
Example 9
Source File: AdminDepartmentFromController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute("deptForm") DepartmentForm deptForm, BindingResult bindingResult){ model.addAttribute("deptForm", deptForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/smp/admin_add_department.html"); List<Tbldepartment> depts = reportService.getAllDepartment(); model.addAttribute("depts", depts); if(bindingResult.hasErrors()) { deptForm = new DepartmentForm(); model.addAttribute("deptForm", deptForm); } else{ managementService.addDepartment(deptForm); deptForm = new DepartmentForm(); model.addAttribute("deptForm", deptForm); } return redirectView; }
Example 10
Source File: StudentEnrollController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, HttpServletRequest request, @Validated @ModelAttribute ListAvailCourseForm listForm, BindingResult bindingResult){ model.addAttribute("listForm", listForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); if(bindingResult.hasErrors()) { redirectView.setUrl("/smp/stud_enroll.html"); listForm = enrollmentService.listForm(); model.addAttribute("listForm", listForm); } else{ int studentId = (Integer) request.getSession().getAttribute("studId"); enrollmentService.enroll(listForm,studentId); listForm = enrollmentService.listForm(); redirectView.setUrl("/smp/stud_enroll.html"); } return redirectView; }
Example 11
Source File: FacultyLoginController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute LoginForm facultyLoginForm, BindingResult bindingResult){ model.addAttribute("facultyLoginForm", facultyLoginForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); if(bindingResult.hasErrors()) { facultyLoginForm = new LoginForm(); redirectView.setUrl("/smp/faculty_login.html"); model.addAttribute("facultyLoginForm", facultyLoginForm); } else{ Login login = new Login(); login.setUserName(facultyLoginForm.getUsername()); login.setPassWord(facultyLoginForm.getPassword()); if(loginService.isFacultyUser(login)){ model.addAttribute("facultyId", reportService.getFacultyId(login.getUserName()).getFacultyId()); redirectView.setUrl("/smp/faculty_masterlist.html"); }else{ facultyLoginForm = new LoginForm(); redirectView.setUrl("/smp/faculty_login.html"); } } return redirectView; }
Example 12
Source File: AdminLoginController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute LoginForm adminLoginForm, BindingResult bindingResult){ model.addAttribute("adminLoginForm", adminLoginForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); if(bindingResult.hasErrors()) { adminLoginForm = new LoginForm(); redirectView.setUrl("/smp/admin_login.html"); model.addAttribute("adminLoginForm", adminLoginForm); } else{ Login login = new Login(); login.setUserName(adminLoginForm.getUsername()); login.setPassWord(adminLoginForm.getPassword()); if(loginService.isAdminUser(login)){ redirectView.setUrl("/smp/admin_pending.html"); }else{ adminLoginForm = new LoginForm(); redirectView.setUrl("/smp/admin_login.html"); } } return redirectView; }
Example 13
Source File: AdminDepartmentFromController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute("deptForm") DepartmentForm deptForm, BindingResult bindingResult){ model.addAttribute("deptForm", deptForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/smp/admin_add_department.html"); List<Tbldepartment> depts = reportService.getAllDepartment(); model.addAttribute("depts", depts); if(bindingResult.hasErrors()) { deptForm = new DepartmentForm(); model.addAttribute("deptForm", deptForm); } else{ managementService.addDepartment(deptForm); deptForm = new DepartmentForm(); model.addAttribute("deptForm", deptForm); } return redirectView; }
Example 14
Source File: StudentEnrollController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, HttpServletRequest request, @Validated @ModelAttribute ListAvailCourseForm listForm, BindingResult bindingResult){ model.addAttribute("listForm", listForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); if(bindingResult.hasErrors()) { redirectView.setUrl("/smp/stud_enroll.html"); listForm = enrollmentService.listForm(); model.addAttribute("listForm", listForm); } else{ int studentId = (Integer) request.getSession().getAttribute("studId"); enrollmentService.enroll(listForm,studentId); listForm = enrollmentService.listForm(); redirectView.setUrl("/smp/stud_enroll.html"); } return redirectView; }
Example 15
Source File: AdminFacultyFormController.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @Validated @ModelAttribute("facultyForm") FacultyForm facultyForm, BindingResult bindingResult){ model.addAttribute("facultyForm", facultyForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/smp/admin_add_faculty.html"); List<Tblfaculty> faculty = reportService.getAllFaculty(); model.addAttribute("faculty", faculty); references(model); if(bindingResult.hasErrors()) { facultyForm = new FacultyForm(); model.addAttribute("facultyForm", facultyForm); } else{ managementService.addFaculty(facultyForm); facultyForm = new FacultyForm(); model.addAttribute("facultyForm", facultyForm); } return redirectView; }
Example 16
Source File: SocialLogin.java From Spring-MVC-Blueprints with MIT License | 6 votes |
@RequestMapping(value = "/twitterAuthentication") public RedirectView callback(@RequestParam(value = "oauth_token") String oauthToken, @RequestParam(value = "oauth_verifier") String oauthVerifier) { TwitterConnectionFactory connectionFactoryTwitter = new TwitterConnectionFactory("<consumer id>","<consumer key>"); OAuth1Operations oauth1Operations = connectionFactoryTwitter.getOAuthOperations(); OAuthToken requestToken = oauth1Operations.fetchRequestToken("http://www.localhost:8080/ch08/erp/twitterAuthentication.html", null); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); OAuthToken accessToken = oauth1Operations.exchangeForAccessToken(new AuthorizedRequestToken(requestToken, oauthVerifier), OAuth1Parameters.NONE); if(accessToken.equals("<enter access token here>")){ redirectView.setUrl("/erp/paymentmodes.xml"); }else{ redirectView.setUrl("http://www.google.com"); } return redirectView; }
Example 17
Source File: SignUpController.java From Spring-MVC-Blueprints with MIT License | 5 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @ModelAttribute LoginForm signupForm, BindingResult bindingResult){ model.addAttribute("signupForm", signupForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); if(bindingResult.hasErrors()) { signupForm = new LoginForm(); redirectView.setUrl("/ocs/signup"); references(model); model.addAttribute("signupForm", signupForm); } else{ loginService.addAccount(signupForm); IdentityService identityService = processEngine.getIdentityService(); User user = identityService.newUser(signupForm.getUsername()); user.setPassword(signupForm.getPassword()); identityService.saveUser(user); try{ identityService.saveGroup(identityService.newGroup("payor")); identityService.saveGroup(identityService.newGroup("shipper")); identityService.saveGroup(identityService.newGroup("shopper")); identityService.saveGroup(identityService.newGroup("buyer")); }catch(Exception e){ System.out.println("Groups already exists...."); } identityService.createMembership(signupForm.getUsername(), "shopper"); identityService.createMembership(signupForm.getUsername(), "buyer"); identityService.createMembership(signupForm.getUsername(), "payor"); identityService.createMembership(signupForm.getUsername(), "shipper"); redirectView.setUrl("/ocs/login"); } return redirectView; }
Example 18
Source File: FeedbackController.java From Spring-MVC-Blueprints with MIT License | 5 votes |
@RequestMapping(value = "/cfs/feedbacks/{topicId}/{id}/delete", method = RequestMethod.POST) public RedirectView deleteFeedback(@PathVariable("topicId") int topicId,@PathVariable("id") int id, final RedirectAttributes redirectAttributes) { feedbackService.removeFeedback(topicId, id); redirectAttributes.addFlashAttribute("css", "success"); redirectAttributes.addFlashAttribute("msg", "Feedback is deleted!"); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/cfs/feedback_update/"+topicId); return redirectView; }
Example 19
Source File: LoginDecoratorController.java From Spring-MVC-Blueprints with MIT License | 5 votes |
@RequestMapping(method=RequestMethod.POST) public RedirectView submitForm(Model model, @ModelAttribute LoginForm loginForm){ model.addAttribute("loginForm", loginForm); RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); if(userService.checkUser(loginForm)){ redirectView.setUrl("/hms/index.html"); }else{ loginForm = new LoginForm(); redirectView.setUrl("/hms/membership/login.html"); } return redirectView; }
Example 20
Source File: TopicFormController.java From Spring-MVC-Blueprints with MIT License | 5 votes |
@RequestMapping(value = "/cfs/topic_process_update", method = RequestMethod.POST) public RedirectView submitForUpdate( @ModelAttribute("topicForm") @Validated TopicForm topicForm, HttpServletRequest request, BindingResult result, Model model, final RedirectAttributes redirectAttributes) { RedirectView redirectView = new RedirectView(); redirectView.setContextRelative(true); redirectView.setUrl("/cfs/topics.html"); if (result.hasErrors()) { redirectView.setUrl("/cfs/topics.html"); } else { redirectAttributes.addFlashAttribute("css", "success"); boolean botCaptchaValid = createBotCaptcha(topicForm.getBotModel(), request); if (botCaptchaValid) { redirectAttributes.addFlashAttribute("msg", "Topic " + topicForm.getId() +" updated successfully!"); topicService.updateTopic(topicForm); redirectView.setUrl("/cfs/topics.html"); } else { redirectView.setUrl("/cfs/topics/" + topicForm.getId() + "/update"); } } return redirectView; }