Example usage for javax.servlet.http HttpServletRequest getParameter

List of usage examples for javax.servlet.http HttpServletRequest getParameter

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getParameter.

Prototype

public String getParameter(String name);

Source Link

Document

Returns the value of a request parameter as a String, or null if the parameter does not exist.

Usage

From source file:ch.ralscha.extdirectspring_itest.UserService.java

@ExtDirectMethod(value = ExtDirectMethodType.FORM_POST, group = "itest_user_service", synchronizeOnSession = true)
public ExtDirectFormPostResult updateUser(HttpServletRequest request, @Valid User user, BindingResult result) {

    if (request.getParameter("addemailerror") != null) {
        result.rejectValue("email", "", "another email error");
        result.rejectValue("name", "", "a name error");
    }/*  ww w.  j a v  a  2 s .c  om*/

    ExtDirectFormPostResult resp = new ExtDirectFormPostResult(result);

    resp.addResultProperty("name", user.getName());
    resp.addResultProperty("age", user.getAge());

    return resp;
}

From source file:com.havoc.hotel.controller.CustomerLoginController.java

@RequestMapping(method = RequestMethod.POST, value = "checking")
public String filter(HttpServletRequest req, HttpServletResponse res) {
    String username = req.getParameter("username");
    String password = req.getParameter("password");
    Customer customer = customerDAO.authenticate(username, password);
    if (customer == null) {
        return "?check=failed";
    } else {/*ww w  . j a v  a  2 s .c  o  m*/

        HttpSession session = req.getSession();
        session.setAttribute("username", username);
        return "dashboard/dashboard";

    }

}

From source file:org.ucll.ip.spring_ip_project.controller.TankController.java

@RequestMapping(method = { RequestMethod.POST }, value = "/overview")
public ModelAndView getTanks(HttpServletRequest req) {
    String name = req.getParameter("player");
    req.setAttribute("player", name);
    ModelAndView view = new ModelAndView("tanks", "tanks", system.getTanksOfPlayer(name));
    view.addObject("games", system.getTotalGamesPlayed(name));
    return view;// ww w. j a v a  2  s .  c om
}

From source file:za.ac.cput.project.hospitalmanagement.api.MedicineApi.java

@RequestMapping(value = "/addMedicine", method = RequestMethod.GET)
public String SaveMedicine(HttpServletRequest request) {
    String medicineName = request.getParameter("medicineName");
    String medicineType = request.getParameter("medicineType");
    String quantity = request.getParameter("quantity");
    float quantityValue = Float.parseFloat(quantity);
    String treatmentIDParam = request.getParameter("treatmentID");
    Long treatmentID = Long.parseLong(treatmentIDParam);

    return service.saveMedicine(medicineName, medicineType, quantityValue, treatmentID);
}

From source file:com.collective.celos.servlet.RegisterServlet.java

private BucketID getRequestBucketID(HttpServletRequest req) {
    return new BucketID(req.getParameter(CelosClient.BUCKET_PARAM));
}

From source file:com.adeptj.runtime.servlet.CryptoServlet.java

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
    String text = req.getParameter("text");
    if (StringUtils.isEmpty(text)) {
        resp.setContentType("text/plain");
        ResponseUtil.write(resp, "request parameter [text] can't be null!!");
    } else {/* ww  w . j av  a 2s  .c o  m*/
        resp.setContentType("application/json");
        String salt = CryptoSupport.saltBase64();
        ResponseUtil.write(resp, String.format(RESP_JSON_FORMAT, salt, CryptoSupport.hashBase64(text, salt)));
    }
}

From source file:game.com.HandleCreateFolderServlet.java

private String getPath(HttpServletRequest request) {
    if (request.getParameter("path") == null) {
        return null;
    }//from  w  w  w .  java  2 s.c om
    return request.getParameter("path").trim();

}

From source file:core.controller.DepartemenController.java

@RequestMapping(value = "/delete", method = RequestMethod.GET)
public String delete(HttpServletRequest request) {
    long id = Long.valueOf(request.getParameter("id"));
    departemenDAO.delete(id);//  w  w w  . j  a  v a2  s . c  o m
    return "redirect:/departemen";
}

From source file:core.controller.DepartemenController.java

@RequestMapping(method = RequestMethod.GET, value = "/detail/json")
@ResponseBody/*w  ww.j a v  a2s  .c  o  m*/
public Departemen getByIdJson(HttpServletRequest request) {
    long id = Long.valueOf(request.getParameter("id"));
    return departemenDAO.getById(id);
}

From source file:WebControllers.ControladorFuncionesComunes.java

public String getParametroString(String parametro, HttpServletRequest request) {
    String param = "";
    if (request.getParameter(parametro) != null && !request.getParameter(parametro).isEmpty()) {
        param = request.getParameter(parametro);
    }/* ww w  .  ja  v a  2  s.com*/
    return param;
}