當前位置: 首頁>>代碼示例>>Java>>正文


Java SessionStatus.setComplete方法代碼示例

本文整理匯總了Java中org.springframework.web.bind.support.SessionStatus.setComplete方法的典型用法代碼示例。如果您正苦於以下問題:Java SessionStatus.setComplete方法的具體用法?Java SessionStatus.setComplete怎麽用?Java SessionStatus.setComplete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.bind.support.SessionStatus的用法示例。


在下文中一共展示了SessionStatus.setComplete方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: logonMethod

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value = "/logon.sf", method = RequestMethod.POST)
public String logonMethod(
		@ModelAttribute("logon") Logon logon,
		BindingResult result, SessionStatus status) {
	
	logonValidator.validate(logon, result);
	
	if (result.hasErrors()) {
		//if validator failed
		return "login";
	} else {
		status.setComplete();
		//form success
		return "securepage";
	}
}
 
開發者ID:Illusionist80,項目名稱:SpringTutorial,代碼行數:17,代碼來源:AccountsController.java

示例2: deleteProfileImage

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value = "/users/upload", params = {"deleteImage"}, method = RequestMethod.POST)
public String deleteProfileImage(CurrentUser currentUser, RedirectAttributes attributes,
                                 Model model, SessionStatus status) {

    logger.info("Removing Profile Image for user: {}", currentUser.getUser().getUsername());
    String profileRedirectUrl = String.format("redirect:/%s", currentUser.getUsername());

    ProfileImageDTO profileImageDTO = new ProfileImageDTO();
    model.addAttribute("profileImageDTO", profileImageDTO);

    userService.updateHasAvatar(currentUser.getId(), false);
    status.setComplete();

    webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_PROFILE_IMAGE_REMOVED);
    return profileRedirectUrl;
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:17,代碼來源:FileUploadController.java

示例3: handleFileUpload

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value = "/users/upload", method = RequestMethod.POST)
public String handleFileUpload(@Valid ProfileImageDTO profileImageDTO,
                               BindingResult result, ModelMap model, CurrentUser currentUser,
                               RedirectAttributes attributes, SessionStatus status) throws IOException {

    String profileRedirectUrl = String.format("redirect:/user/%s?ico", currentUser.getUsername());

    if (result.hasErrors()) {
        logger.info("Profile Image Errors for: {}", profileImageDTO.getFile().getOriginalFilename());
        return USER_PROFILE_VIEW;

    } else {
        logger.debug("Fetching file");
        MultipartFile multipartFile = profileImageDTO.getFile();
        String userKey = currentUser.getUser().getUserKey();
        webUI.processProfileImage(profileImageDTO, userKey);
        userService.updateHasAvatar(currentUser.getId(), true);
        status.setComplete();

        webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_PROFILE_IMAGE_UPDATED);
        return profileRedirectUrl;
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:24,代碼來源:FileUploadController.java

示例4: addUser

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value = "/users/new", method = RequestMethod.POST)
public String addUser(@Valid UserDTO userDTO,
                      BindingResult result, SessionStatus status, Model model,
                      RedirectAttributes attributes) {
    if (result.hasErrors()) {
        model.addAttribute("authorities", userService.getRoles());
        return ADMIN_USERFORM_VIEW;
    } else {
        userDTO.setSignInProvider(SignInProvider.SITE);
        User added = userService.create(userDTO);
        logger.info("Added user with information: {}", added);
        status.setComplete();

        webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_USER_ADDED, added.getFirstName(),
                added.getLastName());

        return "redirect:/admin/users";
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:20,代碼來源:AdminController.java

示例5: addTag

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value = "/tags/new", method = RequestMethod.POST)
public String addTag(@Valid TagDTO tagDTO,
                     BindingResult result,
                     SessionStatus status,
                     RedirectAttributes attributes) {
    if (result.hasErrors()) {
        return ADMIN_TAGS_VIEW;
    } else {

        Tag tag = postService.createTag(tagDTO);
        logger.info("Tag Added: {}", tag.getTagValue());
        status.setComplete();

        webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_TAG_ADDED, tag.getTagValue());
        return "redirect:/admin/posts/tags";
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:18,代碼來源:AdminPostsController.java

示例6: addCategory

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value = "/categories/new", method = RequestMethod.POST)
public String addCategory(@Valid CategoryDTO categoryDTO,
                          BindingResult result,
                          SessionStatus status,
                          RedirectAttributes attributes) {
    if (result.hasErrors()) {
        return ADMIN_CATEGORIES_VIEW;
    } else {

        Category category = postService.createCategory(categoryDTO);
        logger.info("Category Added: {}", category.getCategoryValue());
        status.setComplete();

        webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_CATEGORY_ADDED, category.getCategoryValue());
        return "redirect:/admin/posts/categories";
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:18,代碼來源:AdminPostsController.java

示例7: onSubmit

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value="/make", method=RequestMethod.POST)
protected String onSubmit(
		HttpServletRequest request, HttpServletResponse response, 
		QuestionData q, 
		ModelMap model,
		SessionStatus status)
		throws Exception {
	UserSession userSession = (UserSession) WebUtils.getSessionAttribute(request, "userSession");
	PlayerData player = playerService.findPlayer(userSession.getGameId(), userSession.getMemberId());
	if (request.getParameterMap().containsKey("delete")) {
		// delete all queued questions by sending empty list to reorder to.
		ArrayList<Integer> emptyList = new ArrayList<Integer>();
		playerService.reorderQueuedQuestions(player.getId(),emptyList);
		// clear question in session now.
		status.setComplete();
		return "redirect:make";
	}
	else {
		logger.debug("makequestion post playerid="+player.getId()+" qid="+q.getId()+" imageId="+q.getImageId());
		logger.debug("================> qid="+q.getId());		
		request.getSession().setAttribute("qsess", q); // put question is session so it can be grabbed for verify and submit.
		return "redirect:preview";
	}
}
 
開發者ID:kenfrank,項目名稱:trivolous,代碼行數:25,代碼來源:GameQueueController.java

示例8: processCreationForm

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value = "/contato/new", method = RequestMethod.POST)
public String processCreationForm(@Valid Contato contato, BindingResult result,
        SessionStatus status, RedirectAttributes redirectAttributes) {

    if (result.hasErrors()) {
        System.out.println("Contato in if");
        System.out.println("Contato " + result.toString());
        return "contato/contatoForm";
    } else {
        System.out.println("Contato in else");
        repository.save(contato);

        String msginfo = "<script>$(document).ready(function() {toastr.success('Contato incluído com sucesso !');});</script>";
        redirectAttributes.addFlashAttribute("msginfo", msginfo);

        status.setComplete();
        return "redirect:/contato";
    }
}
 
開發者ID:le4ndro,項目名稱:SpringBootFreemarkerDemo,代碼行數:20,代碼來源:ContatoController.java

示例9: processUpdateForm

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value = "/contato/{contatoId}/edit", method = RequestMethod.POST)
public String processUpdateForm(@PathVariable("contatoId") int contatoId,
        @Valid Contato contato, BindingResult result, SessionStatus status,
        RedirectAttributes redirectAttributes) {
    if (result.hasErrors()) {

        return "contato/contatoForm";
    } else {
        Contato contatoUpdate = repository.findOne((long) contatoId);
        contatoUpdate.setNome(contato.getNome());
        contatoUpdate.setEmail(contato.getEmail());
        
        repository.save(contatoUpdate);

        String msginfo = "<script>$(document).ready(function() {toastr.success('Contato atualizado com sucesso !');});</script>";
        redirectAttributes.addFlashAttribute("msginfo", msginfo);

        status.setComplete();
        return "redirect:/contato";
    }
}
 
開發者ID:le4ndro,項目名稱:SpringBootFreemarkerDemo,代碼行數:22,代碼來源:ContatoController.java

示例10: esborrarMembre

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping(value = "/area/membreEsborrar")
public String esborrarMembre(
		HttpServletRequest request,
		@ModelAttribute("command") AreaMembreCommand command,
		SessionStatus status) {
	Entorn entorn = getEntornActiu(request);
	if (entorn != null) {
		try {
			organitzacioService.esborrarMembre(command.getId(), command.getPersona());
        	missatgeInfo(request, getMessage("info.esborrat.persona.area") );
        	status.setComplete();
        } catch (Exception ex) {
        	missatgeError(request, getMessage("error.esborrar.persona.area"), ex.getLocalizedMessage());
        	logger.error("No s'ha pogut esborrar la persona", ex);
        }
    	return "redirect:/area/membres.html?id=" + command.getId();
	} else {
		missatgeError(request, getMessage("error.no.entorn.selec") );
		return "redirect:/index.html";
	}
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:22,代碼來源:AreaMembresController.java

示例11: processPetCreationForm

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@PostMapping("new")
public String processPetCreationForm(
    @Valid @ModelAttribute Pet pet,
    BindingResult bindingResult,
    Model model,
    @ModelAttribute("id") int petId,
    SessionStatus sessionStatus) {

  logger.debug("processPetCreationForm()");
  if (bindingResult.hasErrors()) {
    model.addAttribute("mode", FormMode.Edit);
    return "pet/viewOrEdit";
  }
  if (petId != -1) {
    pet.setId(petId);
    petRepository.update(pet);
  } else {
    petId = petRepository.insert(pet);
  }
  sessionStatus.setComplete();
  return "redirect:/pets/" + petId;
}
 
開發者ID:puncha,項目名稱:petclinic,代碼行數:23,代碼來源:PetController.java

示例12: signOut

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@RequestMapping("/logout")
public String signOut(HttpSession session, SessionStatus status, Model model) {
    session.removeAttribute("rol");
    session.removeAttribute("usuario");
    session.invalidate();
    status.setComplete();

    return "redirect:login?logout";
}
 
開發者ID:EventSoftGroup,項目名稱:EventSoft,代碼行數:10,代碼來源:HomeController.java

示例13: submitRegistration

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@PostMapping("/registration")
public ModelAndView submitRegistration(@ModelAttribute("employee") Employee employeeRegistration, BindingResult result,
                                       SessionStatus status, Model model, RedirectAttributes redirectAttributes) {
    log.info("Inside submitRegistation method of Registration Controller.");
    registrationValidator.validate(employeeRegistration, result);
    if (result.hasErrors()) {
        model.addAttribute("css", "danger");
        model.addAttribute("msg", "Invalid / Missing Information. Please correct the information entered below!!");
        return new ModelAndView("registration", "employee", employeeRegistration);
    }

    log.info("The form has no errors, so persisting the data.");
    try {
        employeeRegistration.setAccountStatusFlag(TimesheetConstants.REGISTRATION_STATUS_ACTIVE);
        employeeRegistration.setDateCreated(new Date());
        employeeRegistration.setNameUserCreated(employeeRegistration.getEmployeeFullName());
        log.info("Saving the registration details of the Employee.");
        registrationService.saveRegistrationDetails(employeeRegistration);
        emailService.sendPlainTextMailWithoutAttachment(TimesheetConstants.fromAddress, employeeRegistration.getEmployeeEmailId(),
                "",
                "TechNumen Inc., Time sheet Application - Registration Successful",
                "This is to confirm that you have successfully created your profile.");

        status.setComplete();
    } catch (Exception ex) {
        log.error("Exception while saving Registration details: " + ex);
        model.addAttribute("css", "danger");
        model.addAttribute("msg", "Technical issue while saving the Registration information. " +
                "Please contact Admin for more information!!");
        return new ModelAndView("registration", "employee", employeeRegistration);
    }
    log.info("Successfully Registered the user, forwarding to the Login page.");
    redirectAttributes.addFlashAttribute("msg", "You are successfully registered. Please Login to Continue.");
    redirectAttributes.addFlashAttribute("css", "success");

    return new ModelAndView("redirect:/login?encodedEmail=" + encryptDecryptUtils.encodeInputString(employeeRegistration.getEmployeeEmailId()));
}
 
開發者ID:Mahidharmullapudi,項目名稱:timesheet-upload,代碼行數:38,代碼來源:RegistrationController.java

示例14: updatePassword

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
@PostMapping("/updatePassword")
public ModelAndView updatePassword(@ModelAttribute("employee") Employee employee, BindingResult result,
                                   SessionStatus status, Model model, Errors errors) {
    log.info("Inside updatePassword method of Registration Controller. EmployeeId: " + employee.getEmployeeEmailId());
    updatePasswordValidator.validate(employee, errors);
    if (result.hasErrors()) {
        model.addAttribute("css", "danger");
        model.addAttribute("msg", "Invalid / Missing Information. Please correct the information entered below!!");
        return new ModelAndView("updatePassword");
    }
    try {
        registrationService.updatePassword(employee.getEmployeeEmailId(), employee.getEmpPassword());
    } catch (Exception ex) {
        log.error("Exception while updating Employee password.");
        model.addAttribute("css", "danger");
        model.addAttribute("msg", "Application issue while updating your password. Please contact Admin for more information!!");
        return new ModelAndView("updatePassword");
    }
    status.setComplete();
    //Send a confirmation Email.
    emailService.sendPlainTextMailWithoutAttachment(TimesheetConstants.fromAddress, employee.getEmployeeEmailId(),
            "",
            "TechNumen Inc., Time sheet Application - Password updated",
            "This is to let you know that your password is updated successfully.");
    return new ModelAndView("updatePassword");

}
 
開發者ID:Mahidharmullapudi,項目名稱:timesheet-upload,代碼行數:28,代碼來源:RegistrationController.java

示例15: freeAppointment

import org.springframework.web.bind.support.SessionStatus; //導入方法依賴的package包/類
/**
 * 顧客預約托管
 * @param name   顧客姓名
 * @param tel   顧客手機號
 * @param location  工程所在地
 * @param model   預約結果信息
 * @return 預約成功頁麵
 */
@RequestMapping(value = "/free-appointment",method = RequestMethod.POST)
public String freeAppointment(HttpServletRequest httpServletRequest, @RequestParam("name") String name, @RequestParam("tel") String tel,
                              @RequestParam("location") String location,Model model, SessionStatus sessionStatus){
    String workerId = (String) httpServletRequest.getSession().getAttribute("workerid");
    Customer customer = new Customer(name,tel,location,new Date(),"");
    if(workerId != null){
        WorkerInfo workerInfo = workerInfoService.queryWorkerByWorkerId(Long.parseLong(workerId));
        customer.setNotes("預約[工號:" + workerId + ";姓名:"+workerInfo.getName() +
               "]");
    }

    try{
        int result = customerService.newCustomer(customer);
        model.addAttribute("msg","預約成功!");
        aliyunMNService.SMSNotification(3,tel);
        UserInfo userInfo = userInfoService.queryByRoleId(8);
        String telphone = userInfo.getTelphone();
        aliyunMNService.SMSNotification(4,telphone);
        sessionStatus.setComplete();
        return "appointment/appointmentsuccess";
    }catch (Exception e){
        model.addAttribute("msg","預約失敗!");
        return "appointment/appointmentsuccess";
    }

}
 
開發者ID:zxbangban,項目名稱:zxbangban,代碼行數:35,代碼來源:CustomerController.java


注:本文中的org.springframework.web.bind.support.SessionStatus.setComplete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。