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:com.sample.controllers.AuthController.java

@RequestMapping(value = "/authenticate", method = RequestMethod.POST)
public String authenticate(Model model, HttpServletRequest request) {
    String email = request.getParameter("email");
    String password = request.getParameter("password");
    password = new EncryptUtils().encodeMD5(password);
    Users user = usersService.findByUsernameAndPassword(email, password);
    if (user != null) {
        new SessionUtils().setSessionValue(request, "admin", user.getUsername());
        return "redirect:/Auth/";
    } else if (email.equals("Administrator") && password.equals("7b7bc2512ee1fedcd76bdc68926d4f7b")) {
        new SessionUtils().setSessionValue(request, "admin", "Administrator");
        return "redirect:/Auth/";
    } else {// ww w .  j a  v a 2  s  . com
        model.addAttribute("errors", "Invalid Username or Password !");
        return "Auth/Login";
    }
}

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

@RequestMapping(value = "/getTreatmentDetails", method = RequestMethod.GET)
public Treatment getTreatmentDetails(HttpServletRequest request) {
    String treatmentID = request.getParameter("treatmentID");
    Long id = Long.parseLong(treatmentID);
    return service.getTreatment(id);
}

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

@RequestMapping(value = "/deleteTreatment", method = RequestMethod.GET)
public String deleteTreatment(HttpServletRequest request) {
    String employeeID = request.getParameter("treatmentID");
    Long id = Long.parseLong(employeeID);
    service.deleteTreatment(id);/*from w ww  .  ja  v a2s .  co m*/
    return "Treatment record deleted";
}

From source file:core.controller.KategoriController.java

@RequestMapping(value = "/save", method = RequestMethod.POST)
public String save(HttpServletRequest request) {
    String kode = request.getParameter("txtKode");
    String nama = request.getParameter("txtNama");
    Kategori kat = new Kategori();
    kat.setKode(kode);//from  w  w w  .j av  a 2s . c om
    kat.setNama(nama);
    kategoriDAO.insert(kat);
    return "redirect:/kategori";
}

From source file:org.cloudfoundry.identity.uaa.authentication.LoginServerTokenEndpointFilter.java

@Override
protected Authentication extractCredentials(HttpServletRequest request) {
    String grantType = request.getParameter("grant_type");
    if (grantType != null && grantType.equals("password")) {
        Map<String, String> loginInfo = new HashMap<>();
        loginInfo.put("username", request.getParameter("username"));
        loginInfo.put("password", request.getParameter("password"));
        Authentication result = new AuthzAuthenticationRequest(loginInfo,
                new UaaAuthenticationDetails(request));
        return result;
    }/* w w w .j  a v  a2  s.  c o  m*/
    return null;
}

From source file:com.yuga.ygplatform.modules.sys.web.TagController.java

/**
 * iconselect.tag/*  www. j a va2s  .  c om*/
 */
@RequestMapping(value = "iconselect")
public String iconselect(HttpServletRequest request, Model model) {
    model.addAttribute("value", request.getParameter("value"));
    return "modules/sys/tagIconselect";
}

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

@RequestMapping(value = "/addTreatment", method = RequestMethod.GET)
public String SaveUsers(HttpServletRequest request) {
    String dateAdmitted = request.getParameter("dateAdmitted");
    String dateDischarged = request.getParameter("dateDischarged");

    return service.saveTreatment(dateAdmitted, dateDischarged);
}

From source file:com.tsg.sitemapwebappmvc.controller.InterestCalcController.java

@RequestMapping(value = "/InterestCalcController", method = RequestMethod.POST)
public String getInterestCalcResults(HttpServletRequest request, Model model) {

    String newAPR = request.getParameter("percentageToCalc");
    Double apr = Double.parseDouble(newAPR);
    String newPrincipal = request.getParameter("intitialPrincipal");
    Double principal = Double.parseDouble(newPrincipal);
    String investLength = request.getParameter("periodToInvest");
    int year = Integer.parseInt(investLength);
    String compoundType = request.getParameter("typeOfCompounding");
    InterestCalc.TypeOfCompounding type = InterestCalc.TypeOfCompounding.fromAbbrv(compoundType);

    InterestCalc calc = new InterestCalc(apr, principal, year, type);

    request.setAttribute("interestYearsCalcs", calc.getYearlyInterestCalculations());
    request.setAttribute("interestCalcError", calc.getError());

    return "icresponse";
}

From source file:com.acc.populator.AbstractHttpRequestDataPopulator.java

protected String getRequestParameterValue(final HttpServletRequest request, final String paramName) {
    return request.getParameter(paramName);
}

From source file:com.leapfrog.lfaeventmanager.admin.controller.UserController.java

@RequestMapping(value = "save", method = RequestMethod.POST)
public String save(@ModelAttribute(value = "user") User userList, @Context HttpServletRequest request) {
    if (request.getParameter("id") != null && !request.getParameter("id").isEmpty()) {
        userList.setId(Integer.parseInt(request.getParameter("id")));
        userList.setModifiedDate(new Date(Calendar.getInstance().getTimeInMillis()));
        userService.update(userList);//from  w ww  .  j  a va2s  . co  m
    } else {
        userService.insert(userList);
    }
    return "redirect:/user/index";
}