List of usage examples for javax.servlet.http HttpServletRequest getParameter
public String getParameter(String name);
String
, or null
if the parameter does not exist. From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Admin.CRUDUsuarios.java
protected static void leerUsuariosMultiplesId(HttpServletRequest request, HttpServletResponse response) throws IOException { ArrayList<UsuarioEntity> usuarios = new ArrayList<>(); usuarios = CtrlAdmin.leerMultiplesUsuarios(Integer.parseInt(request.getParameter("1")), Integer.parseInt(request.getParameter("2"))); // id del usuario response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONArray list1 = new JSONArray(); for (UsuarioEntity usuario : usuarios) { JSONObject obj = new JSONObject(); obj.put("id", usuario.getIdUsuario()); obj.put("titulo", usuario.getNombres() + " " + usuario.getApellidos()); list1.add(obj);/*w w w . jav a 2s . co m*/ } out.print(list1); }
From source file:com.mapviewer.business.UserRequestManager.java
/** * Generates a new menu depending on the request. * * * @param {HttpServletRequest} request//from w ww. j a v a 2 s . c o m * @param {HttpSession} session * @return Treenode */ public static TreeNode createNewRootMenu(HttpServletRequest request, HttpSession session) throws XMLFilesException { String solicitudWCS = request.getParameter("isWCS");//Indicates if the request is WCS or normal WMS String[] levelsSelected = null; if (Boolean.valueOf(solicitudWCS)) { //if it is wcs then we look for the parameter valoresDropDown //This is done becuase data can't be send directly throught get //in case we had three levels then ajax.js needs to be modified. levelsSelected = StringAndNumbers.strArrayFromStringColon(request.getParameter("valoresDropDown")); } else { //if the request is not wcs then we obtain the layers that the user selected. levelsSelected = request.getParameterValues("dropDownLevels"); } //Obtain the menu of the user that is in session. TreeNode rootMenu = (TreeNode) session.getAttribute("MenuDelUsuario"); String[] selectedValues = ConvertionTools.convertObjectArrayToStringArray(levelsSelected); LayerMenuManagerSingleton menuManager = LayerMenuManagerSingleton.getInstance(); boolean update = menuManager.refreshTree(false);//Search for any update on the XML files //If is the first time the user access the webpage then we // return the default menu. if (rootMenu == null || selectedValues == null || update) { rootMenu = menuManager.getRootMenu(); } //If something goes wrong updating the menu, we return the default menu try { if (selectedValues != null) { rootMenu = HtmlTools.actualizaMenu(selectedValues, rootMenu); } } catch (Exception e) { System.out.println("ERROR!!!!! Building the menu in UserRequestmananger" + e.getMessage()); rootMenu = menuManager.getRootMenu(); } session.setAttribute("MenuDelUsuario", rootMenu); return rootMenu; }
From source file:com.mapviewer.business.UserRequestManager.java
/** * Updates the selection of vector layers * * @param request// w w w . java2 s . c o m * @param session * @return */ public static String[] manageVectorLayersOptions(HttpServletRequest request, HttpSession session) throws XMLFilesException, Exception { String solicitudWCS = request.getParameter("isWCS");//indicates if the request is wcs or not. String[] layersSelected = null; if (Boolean.valueOf(solicitudWCS)) { //if it is a wcs then we look for the parameter of the dropdown menu //this is done becuase we can not send the data directly to get. //in the case of having three levels we need to modify the ajax.js. layersSelected = StringAndNumbers.strArrayFromStringColon(request.getParameter("valoresOpcionales")); } else { //if the request is not wcs we need to obtain the user selection. layersSelected = request.getParameterValues("vectorLayersSelected"); } LayerMenuManagerSingleton menuManager = LayerMenuManagerSingleton.getInstance(); TreeNode vectorLayerOptions = menuManager.getRootVectorMenu(); String[] selectedValues = null; selectedValues = ConvertionTools.convertObjectArrayToStringArray(layersSelected); //in case nothing is selected or doesnt exist then the object vactorLayers in session just returns //the initial menu. if (selectedValues == null) { selectedValues = menuManager.getDefVectorLayers(); } vectorLayerOptions = HtmlTools.actualizaOpcionesVectoriales(selectedValues, vectorLayerOptions); session.setAttribute("vectorLayers", vectorLayerOptions); return selectedValues; }
From source file:com.orig.gls.web.category.Categoryw.java
public static void handleMaintainCategory(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(false); session.setAttribute("catadded", false); session.setAttribute("catexists", false); if ((String) session.getAttribute("uname") != null) { String function = request.getParameter("function"); String categorytype = request.getParameter("categorytype"); String categorycode = request.getParameter("categorycode"); String categoryvalue = request.getParameter("categoryvalue"); switch (function) { case "ADD": if (!Category.categoryExists(categorycode, categorytype)) { Category.addCategories(Bank.getBankId(), categorycode, categorytype, categoryvalue, new Date(), (String) session.getAttribute("uname"), new Date(), (String) session.getAttribute("uname")); session.setAttribute("catadded", true); session.setAttribute("content_page", "categories/mCategories_a.jsp"); } else { session.setAttribute("catexists", true); session.setAttribute("content_page", "categories/mCategories_b.jsp"); }/*from w w w .j a v a 2s. co m*/ break; } } else { session.setAttribute("content_page", "sessionexp.jsp"); } response.sendRedirect("index.jsp"); }
From source file:com.redhat.rhn.frontend.taglibs.list.ListTagHelper.java
/** * Gets the current page number for the named list * This is zero based//from w ww . j a v a 2s .c om * @param listName name of list * @param request active HttpServletRequest * @return page number */ public static int getPageNumber(String listName, HttpServletRequest request) { String uniqueName = TagHelper.generateUniqueName(listName); String paramName = ListTagUtil.makePageNumberName(uniqueName); String page = request.getParameter(paramName); if (page == null) { return 0; } return Integer.parseInt(page); }
From source file:com.bluepandora.therap.donatelife.adminpanel.AdminService.java
public static void getHospitalList(HttpServletRequest request, HttpServletResponse response) throws JSONException { DatabaseService dbService = new DatabaseService(DRIVER_NAME, DATABASE_URL, USERNAME, PASSWORD); dbService.databaseOpen();/*from ww w . j a v a 2 s. c o m*/ String requestName = request.getParameter("requestName"); JSONObject jsonObject = null; String query = AdminQuery.getHospitalListQuery(); Debug.debugLog("HospitalList QUERY : ", query); ResultSet result = dbService.getResultSet(query); jsonObject = JsonBuilder.getHospitalListJson(result); jsonObject = RequestNameAdderJson.setRequestNameInJson(jsonObject, requestName); SendJsonData.sendJsonData(request, response, jsonObject); dbService.databaseClose(); }
From source file:com.bluepandora.therap.donatelife.adminpanel.AdminService.java
public static void getDonatorList(HttpServletRequest request, HttpServletResponse response) throws JSONException { DatabaseService dbService = new DatabaseService(DRIVER_NAME, DATABASE_URL, USERNAME, PASSWORD); dbService.databaseOpen();// w w w .jav a 2 s. co m String requestName = request.getParameter("requestName"); JSONObject jsonObject = null; String query = AdminQuery.getDonatorListQuery(); Debug.debugLog("DonatorList QUERY : ", query); ResultSet result = dbService.getResultSet(query); jsonObject = JsonBuilder.getDonatorListJson(result); jsonObject = RequestNameAdderJson.setRequestNameInJson(jsonObject, requestName); SendJsonData.sendJsonData(request, response, jsonObject); dbService.databaseClose(); }
From source file:com.bluepandora.therap.donatelife.adminpanel.AdminService.java
public static void getFeedBackList(HttpServletRequest request, HttpServletResponse response) throws JSONException { DatabaseService dbService = new DatabaseService(DRIVER_NAME, DATABASE_URL, USERNAME, PASSWORD); dbService.databaseOpen();/*from w ww . j ava 2s .co m*/ String requestName = request.getParameter("requestName"); JSONObject jsonObject = null; String query = AdminQuery.getFeedBackQuery(); Debug.debugLog("FeedBack QUERY : ", query); ResultSet result = dbService.getResultSet(query); jsonObject = JsonBuilder.getFeedBackJson(result); jsonObject = RequestNameAdderJson.setRequestNameInJson(jsonObject, requestName); SendJsonData.sendJsonData(request, response, jsonObject); dbService.databaseClose(); }
From source file:com.bluepandora.therap.donatelife.adminpanel.AdminService.java
public static void addHospital(HttpServletRequest request, HttpServletResponse response) throws JSONException { DatabaseService dbService = new DatabaseService(DRIVER_NAME, DATABASE_URL, USERNAME, PASSWORD); dbService.databaseOpen();/* ww w. j a v a 2 s.c o m*/ String requestName = request.getParameter("requestName"); JSONObject jsonObject = null; if (request.getParameter("distId") != null && request.getParameter("hospitalName") != null && request.getParameter("hospitalBName") != null) { String distId = request.getParameter("distId"); String hospitalName = request.getParameter("hospitalName"); String hospitalBName = request.getParameter("hospitalBName"); String query = AdminQuery.addHospitalQuery(distId, hospitalName, hospitalBName); boolean done = dbService.queryExcute(query); if (done) { jsonObject = LogMessageJson.getLogMessageJson(Enum.CORRECT, Enum.MESSAGE_HOSPITAL_ADDED, requestName); } else { jsonObject = LogMessageJson.getLogMessageJson(Enum.ERROR, Enum.MESSAGE_ERROR, requestName); } } else { jsonObject = LogMessageJson.getLogMessageJson(Enum.ERROR, Enum.MESSAGE_LESS_PARAMETER, requestName); } SendJsonData.sendJsonData(request, response, jsonObject); dbService.databaseClose(); }
From source file:com.bluepandora.therap.donatelife.service.UserRegistrationService.java
public static void registerUser(HttpServletRequest request, HttpServletResponse response) throws JSONException { DatabaseService dbService = new DatabaseService(DRIVER_NAME, DATABASE_URL, USERNAME, PASSWORD); dbService.databaseOpen();/*from w w w.ja v a 2 s.c o m*/ String requestName = request.getParameter("requestName"); JSONObject jsonObject = null; if (request.getParameter("firstName") != null && request.getParameter("lastName") != null && request.getParameter("distId") != null && request.getParameter("groupId") != null && request.getParameter("keyWord") != null && request.getParameter("mobileNumber") != null) { String firstName = request.getParameter("firstName").toUpperCase(); String lastName = request.getParameter("lastName").toUpperCase(); String distId = request.getParameter("distId"); String groupId = request.getParameter("groupId"); String keyWord = request.getParameter("keyWord"); String mobileNumber = request.getParameter("mobileNumber"); if (DataValidation.isValidMobileNumber(mobileNumber) && DataValidation.isValidKeyWord(keyWord) && DataValidation.isValidLength(firstName, 45) && DataValidation.isValidLength(lastName, 45)) { String hashKey = DataValidation.encryptTheKeyWord(keyWord); boolean mobileNumberTaken = CheckService.isMobileNumberTaken(mobileNumber, dbService); if (mobileNumberTaken == false) { AddPersonName.addPersonName(firstName, lastName, dbService); String query = GetQuery.addPersonInfo(mobileNumber, groupId, distId, hashKey, firstName, lastName); boolean done = dbService.queryExcute(query); if (done) { jsonObject = LogMessageJson.getLogMessageJson(Enum.CORRECT, Enum.MESSAGE_REG_SUCCESS); Debug.debugLog("MOBILE NUMBER: ", mobileNumber, " REG SUCCESS"); } else { jsonObject = LogMessageJson.getLogMessageJson(Enum.ERROR, Enum.MESSAGE_ERROR); } } else { jsonObject = LogMessageJson.getLogMessageJson(Enum.ERROR, Enum.MESSAGE_MOBILE_NUMBER_TAKEN); } } else { jsonObject = LogMessageJson.getLogMessageJson(Enum.ERROR, Enum.MESSAGE_INVALID_VALUE); } } else { jsonObject = LogMessageJson.getLogMessageJson(Enum.ERROR, Enum.MESSAGE_LESS_PARAMETER); } jsonObject = RequestNameAdderJson.setRequestNameInJson(jsonObject, requestName); SendJsonData.sendJsonData(request, response, jsonObject); dbService.databaseClose(); }