Example usage for org.springframework.web.bind.annotation RequestMethod POST

List of usage examples for org.springframework.web.bind.annotation RequestMethod POST

Introduction

In this page you can find the example usage for org.springframework.web.bind.annotation RequestMethod POST.

Prototype

RequestMethod POST

To view the source code for org.springframework.web.bind.annotation RequestMethod POST.

Click Source Link

Usage

From source file:com.training.controller.IndexController.java

@RequestMapping(value = "/input", method = RequestMethod.POST)
public String inputNamePost(@RequestParam(value = "data") String data, Model model) {
    model.addAttribute("message", data);
    return "users/index";
}

From source file:com.healthcit.cacure.web.controller.ModuleCopyController.java

@RequestMapping(value = Constants.MODULE_COPY_URI, method = RequestMethod.POST)
public View onSubmit(@RequestParam(value = "moduleId", required = true) Long moduleId) {

    Module module = (Module) moduleMgr.getModule(moduleId);

    moduleMgr.copyModule(module);// w w w .j a v a2s  . c om

    return new RedirectView(Constants.MODULE_LISTING_URI, true);
}

From source file:controller.book.BookCtr.java

@RequestMapping(value = "get20newbooks", method = RequestMethod.POST)
public @ResponseBody ArrayList<Book> get20NewBooks() {
    try {/*from w ww  .j a v a2 s .c om*/
        ArrayList<Book> list20NewBooks = new BookDAO().get20NewBooks();
        if (list20NewBooks != null) {
            return list20NewBooks;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:controller.ProgramController.java

@RequestMapping(method = RequestMethod.POST)
public ModelAndView onSubmit(HttpServletRequest request, @ModelAttribute("program") Program program) {
    //pass validation if they enter "TEST" and "TEST"
    String informationMessage = "";
    String errorMessage = "";
    String programToDelete = request.getParameter("delete");
    if (!(programToDelete == null || programToDelete.isEmpty())) {
        try {//from w  w w  .  ja v a  2 s .co m
            ProgramBO.deleteProgram(Integer.parseInt(programToDelete));
            informationMessage = "Program deleted";
        } catch (Exception ex) {
            System.out.println("Error deleting program");
            errorMessage = "Error deleting program";
        }
    } else {

        System.out.println("About to add a program (" + program.getProgramName() + ")");
        try {
            ProgramBO.insertProgram(program);
            informationMessage = "Program added";
        } catch (Exception ex) {
            errorMessage = "Error adding program";
            System.out.println("Error inserting program");
        }
    }

    ModelAndView mv;
    mv = new ModelAndView("program");
    mv.addObject("programs", ProgramBO.getPrograms());
    mv.addObject("errorMessage", errorMessage);
    mv.addObject("informationMessage", informationMessage);
    mv.addObject("menu", new Menu());

    return mv;
}

From source file:edu.eci.cosw.controllers.ProductsController.java

@RequestMapping(value = "/regifamilia", method = RequestMethod.POST)
public ResponseEntity<?> adicionarFamilia(@RequestBody Familia familia) {
    services.addFamilia(familia);/*from  ww  w  .j a  va 2s .  c o m*/
    return new ResponseEntity<>(HttpStatus.ACCEPTED);
}

From source file:controllers.proveedoresController.java

@RequestMapping(value = "/proveedoresCRUD_registrar.htm", method = RequestMethod.POST)
public String registrar(@RequestParam("cedula") String cedula, @RequestParam("nombre") String nombre,
        @RequestParam("apellido") String apellido, @RequestParam("telefono") String telefono,
        @RequestParam("correo") String correo, Model model) {
    proveedorDAO.ingresarproveedor(cedula, nombre, apellido, telefono, correo);
    model.addAttribute("proveedores", proveedorDAO.obtenerProveedores());
    return "proveedores";
}

From source file:com.opencnc.controllers.TipoCodigoController.java

@RequestMapping(method = RequestMethod.POST)
public void obtener() {

}

From source file:controller.PublisherController.java

@RequestMapping(method = RequestMethod.POST)
public ModelAndView onSubmit(HttpServletRequest request, @ModelAttribute("publisher") Publisher publisher) {
    //pass validation if they enter "TEST" and "TEST"
    String informationMessage = "";
    String errorMessage = "";
    String publisherToDelete = request.getParameter("delete");
    if (!(publisherToDelete == null || publisherToDelete.isEmpty())) {
        try {/*  ww w .j a  v a  2  s  .  c  o m*/
            PublisherBO.deletePublisher(Integer.parseInt(publisherToDelete));
            informationMessage = "Publisher deleted";
        } catch (Exception ex) {
            System.out.println("Error deleting publisher");
            errorMessage = "Error deleting publisher";
        }
    } else {

        System.out.println("About to add a publisher (" + publisher.getName() + ")");
        try {
            PublisherBO.insertPublisher(publisher);
            informationMessage = "Publisher added";
        } catch (Exception ex) {
            errorMessage = "Error adding publisher";
            System.out.println("Error inserting publisher");
        }
    }

    ModelAndView mv;
    mv = new ModelAndView("publisher");
    mv.addObject("publishers", PublisherBO.getPublishers());
    mv.addObject("errorMessage", errorMessage);
    mv.addObject("informationMessage", informationMessage);
    mv.addObject("menu", new Menu());

    return mv;
}

From source file:org.unitec.maven.ControladorGastos.java

@RequestMapping(value = "/gastos/{fecha}/{concepto}/{cantidad}/{idTarjeta}", method = RequestMethod.POST, headers = {
        "Accept=text/html" })

@ResponseBody/*ww w. j  a  v a  2s.  c o  m*/
String guardarGastos(@PathVariable Date fecha, @PathVariable String concepto, @PathVariable Float cantidad,
        @PathVariable Integer idTarjeta) throws Exception {
    Gastos g = new Gastos();
    g.setFecha(fecha);
    g.setConcepto(concepto);
    g.setCantidad(cantidad);
    Tarjeta t = new Tarjeta(idTarjeta);
    g.setIdTarjeta(t);
    DAOGastos dao = new DAOGastos();
    dao.guardar(g);
    return "Gastos Guardados";

}

From source file:com.example.Controller.ObradiMailController.java

@RequestMapping(value = "/test1", method = RequestMethod.POST)
public Cars get(@RequestBody Cars car) {

    //        car.setColor("bijela");
    //        car.setMiles(422);
    return car;/*from  ww  w  . j  a  v a  2s .c o m*/
}