List of usage examples for org.springframework.web.bind.annotation RequestMethod POST
RequestMethod POST
To view the source code for org.springframework.web.bind.annotation RequestMethod POST.
Click Source Link
From source file:com.swcguild.springmvcwebapp.controller.TipCalcController.java
@RequestMapping(value = "/tipCalc", method = RequestMethod.POST) public String calculateTip(HttpServletRequest request, Model model) { try {//from w w w . j av a 2s .c o m originalAmount = Double.parseDouble(request.getParameter("originalAmount")); tipPercentage = Double.parseDouble(request.getParameter("tipPercentage")); tipAmount = (tipPercentage * originalAmount) / 100; finalAmount = originalAmount + tipAmount; DecimalFormat df = new DecimalFormat("#.00"); model.addAttribute("originalAmount", df.format(originalAmount)); model.addAttribute("tipAmount", df.format(tipAmount)); model.addAttribute("tipPercentage", tipPercentage); model.addAttribute("finalAmount", df.format(finalAmount)); } catch (NumberFormatException e) { } return "tipCalcResponse"; }
From source file:AgendaSpringH.controladores.Controlador.java
@RequestMapping(method = RequestMethod.POST) public String processValidatinForm(@Valid ValidationForm validationForm, BindingResult result, Map model) { if (result.hasErrors()) { return "validationform"; }/* www .ja v a 2 s . co m*/ // Add the saved validationForm to the model model.put("validationForm", validationForm); return "validationsuccess"; }
From source file:edu.umuc.cmsc495.trackit.controllers.LoginUsernameController.java
@RequestMapping(method = RequestMethod.POST) public String loginUsername(@RequestParam("email") String email, ModelMap map) { // Getting all Logins boolean foundEmail = false; List<Login> allLogins = DatastoreSingleton.getAllLogins(); for (Login login : allLogins) { if (login.getEmail().equals(email)) { foundEmail = true;/*from w w w . jav a2 s . co m*/ break; } } // If found, we'll let them know if (foundEmail) { map.addAttribute("msgClass", "text-success"); map.addAttribute("msg", "Found your email, your username has been sent to your email!"); } else { map.addAttribute("msgClass", "text-danger"); map.addAttribute("msg", "Your email address was NOT found, try again!"); } // Must return name of file (minus .jsp) under /views return "login-username"; }
From source file:org.utb.project.controllers.ArticulosController.java
@RequestMapping(path = "/api/articulos", method = RequestMethod.POST) @ResponseBody public void guardar(@ModelAttribute Articulo articulo) { articuloDao.agregar(articulo); }
From source file:company.gonapps.loghut.controller.LoginController.java
@RequestMapping(value = "/login.do", method = RequestMethod.POST) public String login(HttpServletRequest request, String id, String password, String request_path) throws Exception { if (id.equals(getSettingDao().getSetting("admin.id")) && password.equals(getSettingDao().getSetting("admin.password"))) { request.getSession().setMaxInactiveInterval(new Integer(getSettingDao().getSetting("session.timeout"))); if (request_path != null) return "redirect:" + request.getScheme() + "://" + request.getServerName() + getSettingDao().getSetting("admin.url") + request_path; return "redirect:" + request.getScheme() + "://" + request.getServerName() + getSettingDao().getSetting("admin.url"); }//from w ww. j a va 2 s . c o m return "redirect:" + request.getScheme() + "://" + request.getServerName() + getSettingDao().getSetting("admin.url") + "/login_form.do"; }
From source file:com.swcguild.luckysevensmvc.LuckySevensController.java
@RequestMapping(value = "/placeBet", method = RequestMethod.POST) public String placeBet(HttpServletRequest req, Model model) { String betAmountString = req.getParameter("betAmount"); int betAmount = Integer.parseInt(betAmountString); // String message = "You bet " + betAmount + "dollars"; // model.addAttribute("resultMessage", message); int dice1;/*from w w w.j a va 2s. co m*/ int dice2; int maximumMoney; int currentMoney; int totalRoll = 0; int quitRoll = 0; currentMoney = betAmount; // request.setAttribute<currentMoney>; maximumMoney = currentMoney; do { Random r = new Random(); dice1 = r.nextInt(6) + 1; dice2 = r.nextInt(6) + 1; totalRoll = totalRoll + 1; if ((dice1 + dice2) == 7) { currentMoney = currentMoney + 4; } else { currentMoney = currentMoney - 1; } if (currentMoney > maximumMoney) { maximumMoney = currentMoney; quitRoll = totalRoll; } // System.out.println("currentMoney is: " + currentMoney); } while (currentMoney > 0); String resultLine1 = "You are broke after " + totalRoll + " rolls."; String resultLine2 = "You should have quit after " + quitRoll + " rolls."; model.addAttribute("resultLine1", resultLine1); model.addAttribute("resultLine2", resultLine2); return "luckySevensResult"; }
From source file:com.webservlet.LoginServlet.java
@RequestMapping(method = { RequestMethod.POST }) public ModelAndView handleRequestInternal() { return new ModelAndView("home"); }
From source file:core.controller.KategoriController.java
@RequestMapping(value = "/update", method = RequestMethod.POST) public String update(HttpServletRequest request) { long id = Long.valueOf(request.getParameter("txtId")); String kode = request.getParameter("txtKode"); String nama = request.getParameter("txtNama"); Kategori kat = new Kategori(); kat.setId(id);//from w w w . j a va 2 s .c o m kat.setKode(kode); kat.setNama(nama); kategoriDAO.update(kat); return "redirect:/kategori"; }
From source file:com.escarabajo.controllers.CardapioController.java
@RequestMapping(method = { RequestMethod.POST, RequestMethod.PUT }) public Cardapio save(Cardapio cardapio) { return service.save(cardapio); }
From source file:com.arindra.project.common.controllers.GeneralUserController.java
@RequestMapping(method = RequestMethod.POST, value = "/add/{username}/{password}") public boolean createEntity(@RequestBody GeneralUser generalUser, @PathVariable("username") String username, @PathVariable("password") String password) { if (generalUser != null) { userRepo.save(generalUser);//from www .ja v a 2s .c o m return true; } return false; }