List of usage examples for javax.servlet.http HttpServletRequest getParameterValues
public String[] getParameterValues(String name);
String
objects containing all of the values the given request parameter has, or null
if the parameter does not exist. From source file:com.Accenture.Controller.Learnercontroller.java
@RequestMapping("/saveQ") public ModelAndView saveQs(HttpServletRequest request, HttpServletResponse res) { Answerspojo ap = new Answerspojo(); String[] lid = request.getParameterValues("learner"); String[] qid = request.getParameterValues("questions"); String[] ans = request.getParameterValues("answers"); for (int i = 0; i < 10; i++) { ap.setlearnerid(lid[i]);//from ww w . ja v a2s . c om ap.setquestionid(qid[i]); ap.setanswer(ans[i]); vv.saveV(ap); } return new ModelAndView("saveQ"); }
From source file:controller.ClientController.java
@RequestMapping(value = "/modifycontrat", method = RequestMethod.POST) protected String UpdateVideoAction(HttpSession session, Model model, HttpServletRequest request) throws ParseException, InterruptedException { ClientConnecte cli = new ClientConnecte((Client) session.getAttribute("UserConnected")); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdnow = new SimpleDateFormat("dd/MM/yy"); java.util.Date date = new java.util.Date(); model.addAttribute("now", sdf.parse(sdf.format(date))); int idvideo = Integer.parseInt(request.getParameter("idvideo")); Set<Region> regions = new HashSet<>(); Set<Typerayon> typerayons = new HashSet<>(); String[] choixrayon = request.getParameterValues("rayon"); String[] choixregion = request.getParameterValues("region"); for (int i = 0; i < choixrayon.length; i++) { typerayons.add(TypeRayonDAO.RayonPrec(choixrayon[i]).get(0)); System.out.println(choixrayon[i]); }//from ww w . jav a 2 s . c o m for (int i = 0; i < choixregion.length; i++) { regions.add(RegionDAO.RegionPrec(choixregion[i]).get(0)); System.out.println(choixregion[i]); } String titrecontrat = request.getParameter("titre"); String freqcontrat = request.getParameter("frequence"); String durecontrat = request.getParameter("duree"); String datedebutcontrat = request.getParameter("dateDebut"); String datefincontrat = request.getParameter("dateFin"); String daterecepcontrat = request.getParameter("dateReception"); String datevalidcontrat = request.getParameter("dateValidation"); String tarifcontrat = request.getParameter("tarif"); String choixstatut = request.getParameter("statut"); //vidBDD.modifcontrat(idvideo) Video vid = vidBDD.modifcontrat(idvideo); //Video vid = new Video(); if (vid == null) { System.out.println("Not good"); } else { System.out.println("Good"); } vid.setTitre(titrecontrat); vid.setFrequence(Integer.parseInt(freqcontrat)); vid.setDuree(Integer.parseInt(durecontrat)); vid.setDateDebut(sdf.parse(datedebutcontrat)); vid.setDateFin(sdf.parse(datefincontrat)); vid.setDateReception(sdf.parse(daterecepcontrat)); vid.setDateValidation(sdf.parse(datevalidcontrat)); vid.setStatut(Integer.parseInt(choixstatut)); vid.setTarif(Double.parseDouble(tarifcontrat)); vid.setRegions(regions); vid.setTyperayons(typerayons); try { this.vidBDD.updCliVideo(vid); } catch (Exception e) { e.printStackTrace(); } if (vidBDD.updCliVideo(vid) != null) { return "redirect:/client"; } return "error"; }
From source file:com.erudika.scoold.utils.ScooldUtils.java
public <P extends ParaObject> P populate(HttpServletRequest req, P pobj, String... paramName) { if (pobj != null && paramName != null) { HashMap<String, Object> data = new HashMap<String, Object>(); for (String param : paramName) { String[] values;//from w w w .j ava2 s. c o m if (param.matches(".+?\\|.$")) { // convert comma-separated value to list of strings String cleanParam = param.substring(0, param.length() - 2); values = req.getParameterValues(cleanParam); String firstValue = (values != null && values.length > 0) ? values[0] : null; String separator = param.substring(param.length() - 1); if (!StringUtils.isBlank(firstValue)) { data.put(cleanParam, Arrays.asList(firstValue.split(separator))); } } else { values = req.getParameterValues(param); String firstValue = (values != null && values.length > 0) ? values[0] : null; if (values != null && values.length > 1) { data.put(param, Arrays.asList(values)); } else if (firstValue != null) { data.put(param, firstValue); } } } if (!data.isEmpty()) { ParaObjectUtils.setAnnotatedFields(pobj, data, null); } } return pobj; }
From source file:com.redip.servlet.NonConformityActionList.java
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String echo = request.getParameter("sEcho"); String sStart = request.getParameter("iDisplayStart"); String sAmount = request.getParameter("iDisplayLength"); String sCol = request.getParameter("iSortCol_0"); String sdir = request.getParameter("sSortDir_0"); String dir = "asc"; String[] cols = { "Idqualitynonconformitiesaction", "action", "deadline", "follower", "status", "date", "percentage", "priority" }; String[] follower = null;/* w w w.j av a 2 s.co m*/ String[] date = null; String[] statusList = null; String[] deadline = null; String[] priority = null; if (request.getParameterValues("follower") != null) { follower = request.getParameterValues("follower"); } if (request.getParameterValues("date") != null) { date = request.getParameterValues("date"); } if (request.getParameterValues("status") != null) { statusList = request.getParameterValues("status"); } if (request.getParameterValues("deadline") != null) { deadline = request.getParameterValues("deadline"); } if (request.getParameterValues("priority") != null) { priority = request.getParameterValues("priority"); } JSONObject result = new JSONObject(); JSONArray array = new JSONArray(); int amount = 10; int start = 0; int col = 0; String field1 = ""; String field2 = ""; String field3 = ""; String field4 = ""; String field5 = ""; field1 = request.getParameter("sSearch_0"); field2 = request.getParameter("sSearch_1"); field3 = request.getParameter("sSearch_2"); field4 = request.getParameter("sSearch_3"); field5 = request.getParameter("sSearch_4"); List<String> sArray = new ArrayList<String>(); if (!field1.equals("")) { String sIdqualitynonconformitiesaction = " idqualitynonconformitiesaction like '%" + field1 + "%'"; sArray.add(sIdqualitynonconformitiesaction); } if (!field2.equals("")) { String sAction = " action like '%" + field2 + "%'"; sArray.add(sAction); } // if (!problemDescription.equals("")) { // String sProblemDescription = " problemDescription like '%" + problemDescription + "%'"; // sArray.add(sProblemDescription); // } // if (!status.equals("")) { // String sStatus = " status like '%" + status + "%'"; // sArray.add(sStatus); // } // if (!severity.equals("")) { // String sSeverity = " severity like '%" + severity + "%'"; // sArray.add(sSeverity); // } if (follower != null) { String sFollower = " ("; for (int a = 0; a < follower.length - 1; a++) { sFollower += " follower like '%" + follower[a] + "%' or"; } sFollower += " follower like '%" + follower[follower.length - 1] + "%') "; sArray.add(sFollower); } if (date != null) { String sDate = " ("; for (int a = 0; a < date.length - 1; a++) { sDate += " `date` like '%" + date[a] + "%' or"; } sDate += " `date` like '%" + date[date.length - 1] + "%') "; sArray.add(sDate); } if (deadline != null) { String sDeadline = " ("; for (int a = 0; a < deadline.length - 1; a++) { sDeadline += " deadline like '%" + deadline[a] + "%' or"; } sDeadline += " deadline like '%" + deadline[deadline.length - 1] + "%') "; sArray.add(sDeadline); } // if (fromDate != null) { // String sFromDate = " fromDate > '" + fromDate + "'"; // sArray.add(sFromDate); // } // if (toDate != null) { // String sFromDate = " fromDate > '" + toDate + "'"; // sArray.add(sFromDate); // } if (priority != null) { String sPriority = " ("; for (int a = 0; a < priority.length - 1; a++) { sPriority += " priority like '%" + priority[a] + "%' or"; } sPriority += " priority like '%" + priority[priority.length - 1] + "%') "; sArray.add(sPriority); } if (statusList != null) { String sStatusList = " ("; for (int a = 0; a < statusList.length - 1; a++) { sStatusList += " status like '%" + statusList[a] + "%' or"; } sStatusList += " status like '%" + statusList[statusList.length - 1] + "%') "; sArray.add(sStatusList); } StringBuilder individualSearch = new StringBuilder(); if (sArray.size() == 1) { individualSearch.append(sArray.get(0)); } else if (sArray.size() > 1) { for (int i = 0; i < sArray.size() - 1; i++) { individualSearch.append(sArray.get(i)); individualSearch.append(" and "); } individualSearch.append(sArray.get(sArray.size() - 1)); } if (sStart != null) { start = Integer.parseInt(sStart); if (start < 0) { start = 0; } } if (sAmount != null) { amount = Integer.parseInt(sAmount); if (amount < 10 || amount > 100) { amount = 10; } } if (sCol != null) { col = Integer.parseInt(sCol); if (col < 0 || col > 5) { col = 0; } } if (sdir != null) { if (!sdir.equals("asc")) { dir = "desc"; } } String colName = cols[col]; String searchTerm = ""; if (!request.getParameter("sSearch").equals("")) { searchTerm = request.getParameter("sSearch"); } String inds = String.valueOf(individualSearch); JSONArray data = new JSONArray(); //data that will be shown in the table ApplicationContext appContext = WebApplicationContextUtils .getWebApplicationContext(this.getServletContext()); IQualityNonconformitiesActionService qualityNonconformitiesActionService = appContext .getBean(IQualityNonconformitiesActionService.class); List<QualityNonconformitiesAction> nonconformitiesActionlist = qualityNonconformitiesActionService .getAllNonconformitiesAction(start, amount, colName, dir, searchTerm, inds); try { JSONObject jsonResponse = new JSONObject(); for (QualityNonconformitiesAction listofnonconformitiesAction : nonconformitiesActionlist) { JSONArray row = new JSONArray(); //"<a href=\'javascript:popup(\"qualitynonconformitydetails.jsp?ncid="+listofnonconformities.getIdqualitynonconformities()+"\")\'>"+listofnonconformities.getIdqualitynonconformities()+"</a>" row.put(listofnonconformitiesAction.getIdQualityNonconformitiesActions()) .put(listofnonconformitiesAction.getAction()).put(listofnonconformitiesAction.getFollower()) // .put(listofnonconformities.getRootCauseCategory()) // .put(listofnonconformities.getRootCauseDescription()) // .put(listofnonconformities.getResponsabilities()) .put(listofnonconformitiesAction.getStatus()) // .put(listofnonconformities.getComments()) .put(listofnonconformitiesAction.getDeadline()) .put("<a href=\"qualitynonconformitydetails.jsp?ncid=" + listofnonconformitiesAction.getIdQualityNonconformities() + "\">edit</a>"); data.put(row); } jsonResponse.put("aaData", data); jsonResponse.put("sEcho", echo); jsonResponse.put("iTotalRecords", nonconformitiesActionlist.size()); jsonResponse.put("iDisplayLength", data.length()); jsonResponse.put("iTotalDisplayRecords", nonconformitiesActionlist.size()); response.setContentType("application/json"); response.getWriter().print(jsonResponse.toString()); } catch (JSONException e) { Logger.log(NonConformityActionList.class.getName(), Level.FATAL, "" + e); response.setContentType("text/html"); response.getWriter().print(e.getMessage()); } }
From source file:org.oscarehr.web.OcanReportingAction.java
public ActionForward generateNeedRatingOverTimeReport(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String clientId = request.getParameter("client"); String[] assessments = request.getParameterValues("assessment"); String[] domains = request.getParameterValues("domains"); logger.debug("Generate Individual Needs Rating over Time Report"); logger.debug("clientId=" + clientId); for (int x = 0; x < assessments.length; x++) logger.debug("assessment=" + assessments[x]); for (int x = 0; x < domains.length; x++) logger.debug("domain=" + domains[x]); NeedRatingOverTimeReportGenerator reportGen = new NeedRatingOverTimeReportGenerator(); reportGen.setConsumerName(// www. j a v a2s . c o m demographicDao.getClientByDemographicNo(Integer.parseInt(clientId)).getFormattedName()); reportGen.setStaffName(LoggedInInfo.loggedInInfo.get().loggedInProvider.getFormattedName()); reportGen.setReportDate(new Date()); //get need rating for each domain selected, and add them up. List<OcanNeedRatingOverTimeSummaryOfNeedsBean> summaryOfNeedsBeanList = new ArrayList<OcanNeedRatingOverTimeSummaryOfNeedsBean>(); List<OcanNeedRatingOverTimeSummaryOfNeedsBean> summaryOfNeedsNoDomainBeanList = new ArrayList<OcanNeedRatingOverTimeSummaryOfNeedsBean>(); for (int x = 0; x < assessments.length; x++) { Integer formId = Integer.valueOf(assessments[x].split(";")[0]); //get the latest form for the assessment OcanStaffForm ocanForm = ocanStaffFormDao.find(formId); //get data fields List<OcanStaffFormData> ocanFormData = ocanStaffFormDataDao.findByForm(ocanForm.getId()); //convert to map Map<String, OcanStaffFormData> ocanFormDataMap = new HashMap<String, OcanStaffFormData>(); for (OcanStaffFormData tmp : ocanFormData) { ocanFormDataMap.put(tmp.getQuestion(), tmp); } OcanNeedRatingOverTimeSummaryOfNeedsBean summaryOfNeedsBean = new OcanNeedRatingOverTimeSummaryOfNeedsBean(); summaryOfNeedsBean.setOcanName(assessments[x].split(";")[1]); if (summaryOfNeedsBean.getOcanName().indexOf("-") != -1) { summaryOfNeedsBean.setOcanName(summaryOfNeedsBean.getOcanName().split("-")[0].trim()); } summaryOfNeedsBean.setOcanDate(ocanForm.getCreated()); for (int y = 0; y < domains.length; y++) { String domainId = domains[y].split(";")[0]; //String domainName = domains[y].split(";")[1]; OcanStaffFormData staffAnswer = ocanFormDataMap.get(domainId + "_1"); if (staffAnswer != null) { if (staffAnswer.getAnswer().equals("0")) { summaryOfNeedsBean.getStaffNeedMap().put("no", summaryOfNeedsBean.getStaffNeedMap().get("no") + 1); } else if (staffAnswer.getAnswer().equals("1")) { summaryOfNeedsBean.getStaffNeedMap().put("met", summaryOfNeedsBean.getStaffNeedMap().get("met") + 1); } else if (staffAnswer.getAnswer().equals("2")) { summaryOfNeedsBean.getStaffNeedMap().put("unmet", summaryOfNeedsBean.getStaffNeedMap().get("unmet") + 1); } else if (staffAnswer.getAnswer().equals("9")) { summaryOfNeedsBean.getStaffNeedMap().put("unknown", summaryOfNeedsBean.getStaffNeedMap().get("unknown") + 1); } } OcanStaffFormData clientAnswer = ocanFormDataMap.get("client_" + domainId + "_1"); if (clientAnswer != null) { if (clientAnswer.getAnswer().equals("0")) { summaryOfNeedsBean.getConsumerNeedMap().put("no", summaryOfNeedsBean.getConsumerNeedMap().get("no") + 1); } else if (clientAnswer.getAnswer().equals("1")) { summaryOfNeedsBean.getConsumerNeedMap().put("met", summaryOfNeedsBean.getConsumerNeedMap().get("met") + 1); } else if (clientAnswer.getAnswer().equals("2")) { summaryOfNeedsBean.getConsumerNeedMap().put("unmet", summaryOfNeedsBean.getConsumerNeedMap().get("unmet") + 1); } else if (clientAnswer.getAnswer().equals("9")) { summaryOfNeedsBean.getConsumerNeedMap().put("unknown", summaryOfNeedsBean.getConsumerNeedMap().get("unknown") + 1); } } } summaryOfNeedsBeanList.add(summaryOfNeedsBean); OcanNeedRatingOverTimeSummaryOfNeedsBean summaryOfNeedsNoDomainBean = new OcanNeedRatingOverTimeSummaryOfNeedsBean(); summaryOfNeedsNoDomainBean.setOcanName(summaryOfNeedsBean.getOcanName()); summaryOfNeedsNoDomainBean.setOcanDate(ocanForm.getCreated()); for (int y = 1; y <= 24; y++) { OcanStaffFormData staffAnswer = ocanFormDataMap.get(y + "_1"); if (staffAnswer != null) { if (staffAnswer.getAnswer().equals("0")) { summaryOfNeedsNoDomainBean.getStaffNeedMap().put("no", summaryOfNeedsNoDomainBean.getStaffNeedMap().get("no") + 1); } else if (staffAnswer.getAnswer().equals("1")) { summaryOfNeedsNoDomainBean.getStaffNeedMap().put("met", summaryOfNeedsNoDomainBean.getStaffNeedMap().get("met") + 1); } else if (staffAnswer.getAnswer().equals("2")) { summaryOfNeedsNoDomainBean.getStaffNeedMap().put("unmet", summaryOfNeedsNoDomainBean.getStaffNeedMap().get("unmet") + 1); } else if (staffAnswer.getAnswer().equals("9")) { summaryOfNeedsNoDomainBean.getStaffNeedMap().put("unknown", summaryOfNeedsNoDomainBean.getStaffNeedMap().get("unknown") + 1); } } OcanStaffFormData clientAnswer = ocanFormDataMap.get("client_" + y + "_1"); if (clientAnswer != null) { if (clientAnswer.getAnswer().equals("0")) { summaryOfNeedsNoDomainBean.getConsumerNeedMap().put("no", summaryOfNeedsNoDomainBean.getConsumerNeedMap().get("no") + 1); } else if (clientAnswer.getAnswer().equals("1")) { summaryOfNeedsNoDomainBean.getConsumerNeedMap().put("met", summaryOfNeedsNoDomainBean.getConsumerNeedMap().get("met") + 1); } else if (clientAnswer.getAnswer().equals("2")) { summaryOfNeedsNoDomainBean.getConsumerNeedMap().put("unmet", summaryOfNeedsNoDomainBean.getConsumerNeedMap().get("unmet") + 1); } else if (clientAnswer.getAnswer().equals("9")) { summaryOfNeedsNoDomainBean.getConsumerNeedMap().put("unknown", summaryOfNeedsNoDomainBean.getConsumerNeedMap().get("unknown") + 1); } } } summaryOfNeedsNoDomainBeanList.add(summaryOfNeedsNoDomainBean); } //get the current OCAN String currentOcanFormId = assessments[assessments.length - 1].split(";")[0]; OcanStaffForm ocanForm = ocanStaffFormDao.find(Integer.parseInt(currentOcanFormId)); List<OcanStaffFormData> ocanFormData = ocanStaffFormDataDao.findByForm(ocanForm.getId()); Map<String, OcanStaffFormData> ocanFormDataMap = new HashMap<String, OcanStaffFormData>(); for (OcanStaffFormData tmp : ocanFormData) { ocanFormDataMap.put(tmp.getQuestion(), tmp); } //now we want to make the properly ordered list (0-no,1-met,2-unmet,9-unknown) //need a triplet - domain, consumer need value, staff need value List<OcanDomainConsumerStaffBean> test = new ArrayList<OcanDomainConsumerStaffBean>(); for (int x = 1; x <= 24; x++) { OcanStaffFormData staffNeedFormData = ocanFormDataMap.get(x + "_1"); OcanStaffFormData consumerNeedFormData = ocanFormDataMap.get("client_" + x + "_1"); String staffNeed = null; String consumerNeed = null; if (staffNeedFormData != null) { staffNeed = staffNeedFormData.getAnswer(); } if (consumerNeedFormData != null) { consumerNeed = consumerNeedFormData.getAnswer(); } OcanDomainConsumerStaffBean odcsb = new OcanDomainConsumerStaffBean(x, consumerNeed, staffNeed); test.add(odcsb); } List<OcanDomainConsumerStaffBean> orderedDomainList; orderedDomainList = test; Collections.sort(orderedDomainList, OcanDomainConsumerStaffBean.getNeedsComparator1()); Collections.reverse(orderedDomainList); //filter out domains we are not interested in List<OcanDomainConsumerStaffBean> filteredDomainList = new ArrayList<OcanDomainConsumerStaffBean>(); List<String> domainList = new ArrayList<String>(); for (int x = 0; x < domains.length; x++) { domainList.add(domains[x].split(";")[0]); } for (OcanDomainConsumerStaffBean b : orderedDomainList) { if (domainList.contains(String.valueOf(b.getDomainId()))) { filteredDomainList.add(b); } } List<String> domainNames = new ArrayList<String>(); for (OcanDomainConsumerStaffBean t : filteredDomainList) { domainNames.add(getDomainNameFromId(domains, t.getDomainId())); } //build list of beans List<OcanNeedRatingOverTimeNeedBreakdownBean> breakdownBeanList = new ArrayList<OcanNeedRatingOverTimeNeedBreakdownBean>(); for (int x = 0; x < assessments.length; x++) { int formId = Integer.parseInt(assessments[x].split(";")[0]); //get the latest form for the assessment ocanForm = ocanStaffFormDao.find(formId); //get data fields ocanFormData = ocanStaffFormDataDao.findByForm(ocanForm.getId()); //convert to map ocanFormDataMap = new HashMap<String, OcanStaffFormData>(); for (OcanStaffFormData tmp : ocanFormData) { ocanFormDataMap.put(tmp.getQuestion(), tmp); } OcanNeedRatingOverTimeNeedBreakdownBean breakdownBean = new OcanNeedRatingOverTimeNeedBreakdownBean(); String ocanName = assessments[x].split(";")[1]; ocanName = (ocanName.indexOf("-") != -1 ? ocanName.split("-")[0].trim() : ocanName); breakdownBean.setOcanName(ocanName); breakdownBean.setOcanDate(ocanForm.getCreated()); for (OcanDomainConsumerStaffBean d : filteredDomainList) { OcanStaffFormData staffValue = ocanFormDataMap.get(d.getDomainId() + "_1"); OcanStaffFormData consumerValue = ocanFormDataMap.get("client_" + d.getDomainId() + "_1"); String staffNeed = "", consumerNeed = ""; if (staffValue != null) { staffNeed = staffValue.getAnswer(); } if (consumerValue != null) { consumerNeed = consumerValue.getAnswer(); } OcanConsumerStaffNeedBean needBean = new OcanConsumerStaffNeedBean(); needBean.setConsumerNeed(convertNeedToWord(consumerNeed)); needBean.setStaffNeed(convertNeedToWord(staffNeed)); breakdownBean.getNeeds().add(needBean); } breakdownBeanList.add(breakdownBean); } Collections.reverse(summaryOfNeedsBeanList); reportGen.setSummaryOfNeedsBeanList(summaryOfNeedsBeanList); Collections.reverse(summaryOfNeedsNoDomainBeanList); reportGen.setSummaryOfNeedsNoDomainBeanList(summaryOfNeedsNoDomainBeanList); reportGen.setDomains(domainNames); Collections.reverse(breakdownBeanList); reportGen.setNeedBreakdownListByOCAN(breakdownBeanList); try { response.setContentType("application/pdf"); response.setHeader("content-disposition", "inline; filename=\"NeedRatingOverTime.pdf\""); reportGen.generateReport(response.getOutputStream()); } catch (Exception e) { logger.error("error", e); } return null; }
From source file:org.jamwiki.servlets.SearchServlet.java
/** * *//* w w w . jav a2s .c o m*/ private void search(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { String virtualWiki = pageInfo.getVirtualWikiName(); String searchField = WikiUtil.getParameterFromRequest(request, "text", false); if (StringUtils.isBlank(searchField)) { pageInfo.setPageTitle(new WikiMessage("search.title")); } else { pageInfo.setPageTitle(new WikiMessage("searchresult.title", searchField)); } next.addObject("searchConfig", WikiConfiguration.getCurrentSearchConfiguration()); // add a map of namespace id & label for display on the front end. Map<Integer, String> namespaceMap = ServletUtil.loadNamespaceDisplayMap(virtualWiki, ServletUtil.retrieveUserLocale(request)); next.addObject("namespaces", namespaceMap); List<Integer> selectedNamespaces = null; if (request.getParameter("ns") != null) { Map<Integer, Integer> selectedNamespaceMap = new TreeMap<Integer, Integer>(); selectedNamespaces = new ArrayList<Integer>(); for (String namespaceId : request.getParameterValues("ns")) { selectedNamespaces.add(NumberUtils.toInt(namespaceId)); selectedNamespaceMap.put(NumberUtils.toInt(namespaceId), NumberUtils.toInt(namespaceId)); } next.addObject("selectedNamespaces", selectedNamespaceMap); } if (!StringUtils.isBlank(searchField)) { // grab search engine instance and find results List<SearchResultEntry> results = WikiBase.getSearchEngine().findResults(virtualWiki, searchField, selectedNamespaces); next.addObject("searchField", searchField); next.addObject("results", results); } pageInfo.setContentJsp(JSP_SEARCH); pageInfo.setSpecial(true); }
From source file:org.apache.ofbiz.base.util.UtilHttp.java
/** * Create a map from a HttpServletRequest (parameters) object * @param onlyIncludeOrSkip If true only include, if false skip, the named parameters in the nameSet. If this is null and nameSet is not null, default to skip. * @return The resulting Map//from w w w . j av a 2s .c o m */ public static Map<String, Object> getParameterMap(HttpServletRequest request, Set<? extends String> nameSet, Boolean onlyIncludeOrSkip) { boolean onlyIncludeOrSkipPrim = onlyIncludeOrSkip == null ? true : onlyIncludeOrSkip.booleanValue(); Map<String, Object> paramMap = new HashMap<String, Object>(); // add all the actual HTTP request parameters Enumeration<String> e = UtilGenerics.cast(request.getParameterNames()); while (e.hasMoreElements()) { String name = e.nextElement(); if (nameSet != null && (onlyIncludeOrSkipPrim ^ nameSet.contains(name))) { continue; } Object value = null; String[] paramArr = request.getParameterValues(name); if (paramArr != null) { if (paramArr.length > 1) { value = Arrays.asList(paramArr); } else { value = paramArr[0]; // does the same thing basically, nothing better about it as far as I can see: value = request.getParameter(name); } } paramMap.put(name, value); } paramMap.putAll(getPathInfoOnlyParameterMap(request, nameSet, onlyIncludeOrSkip)); if (paramMap.size() == 0) { // nothing found in the parameters; maybe we read the stream instead Map<String, Object> multiPartMap = UtilGenerics.checkMap(request.getAttribute("multiPartMap")); if (UtilValidate.isNotEmpty(multiPartMap)) { paramMap.putAll(multiPartMap); } } if (Debug.verboseOn()) { Debug.logVerbose("Made Request Parameter Map with [" + paramMap.size() + "] Entries", module); Debug.logVerbose("Request Parameter Map Entries: " + System.getProperty("line.separator") + UtilMisc.printMap(paramMap), module); } return canonicalizeParameterMap(paramMap); }
From source file:fr.paris.lutece.plugins.directory.modules.pdfproducer.web.PDFProducerJspBean.java
/** * Display the page to create a new configuration * @param request request// w w w . j a v a 2 s . c om * @return create html page */ public String createConfigProducer(HttpServletRequest request) { String strIdDirectory = request.getParameter(PARAMETER_ID_DIRECTORY); if (!isAuthorized(strIdDirectory)) { return getErrorPage(); } Map<String, Object> model = new HashMap<String, Object>(); String strNameConfig = request.getParameter(PARAMETER_CREATECONFIG_NAME); String[] listIdEntry = request.getParameterValues(PARAMETER_CONFIG_ENTRY); String strIdEntryFileName = request.getParameter(PARAMETER_ID_ENTRY_FILE_NAME); String strTypeConfigFileName = request.getParameter(PARAMETER_TYPE_CONFIG_FILE_NAME); String strTextFileName = request.getParameter(PARAMETER_TEXT_FILE_NAME); String strExtractNotEmpty = request.getParameter(PARAMETER_EXTRACT_NOT_EMPTY); List<IEntry> listEntry = DirectoryUtils.getFormEntries(DirectoryUtils.convertStringToInt(strIdDirectory), getPlugin(), getUser()); model.put(MARK_ENTRY_LIST, listEntry); model.put(MARK_ID_ENTRY_LIST, listIdEntry); model.put(MARK_ID_DIRECTORY, strIdDirectory); if (strTextFileName != null) { model.put(MARK_TEXT_FILE_NAME, strTextFileName); } if (StringUtils.isNotBlank(strTypeConfigFileName)) { model.put(MARK_TYPE_CONFIG_FILE_NAME, strTypeConfigFileName); } if (StringUtils.isNotBlank(strIdEntryFileName)) { model.put(MARK_POSITION_ENTRY_FILENAME, strIdEntryFileName); } model.put(MARK_LIST_ENTRIES_FILENAME, getListEntriesUrl(DirectoryUtils.convertStringToInt(strIdDirectory), request)); if (StringUtils.isNotBlank(strNameConfig)) { model.put(MARK_CREATECONFIG_NAME, strNameConfig); } if (StringUtils.isNotBlank(strExtractNotEmpty)) { model.put(MARK_EXTRACT_NOT_EMPTY, strExtractNotEmpty); } HtmlTemplate templateList = AppTemplateService.getTemplate(TEMPLATE_CREATE_CONFIG, getLocale(), model); return getAdminPage(templateList.getHtml()); }
From source file:br.mdarte.exemplo.academico.accessControl.EntrarLoginValidarFormImpl.java
/** * Override to provide population of current form with request parameters when validation fails. * * @see org.apache.struts.action.ActionForm validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest) *//* ww w. j a v a2 s .c o m*/ public org.apache.struts.action.ActionErrors validate(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request) { final org.apache.struts.action.ActionErrors errors = super.validate(mapping, request); if (errors != null && !errors.isEmpty()) { Object formObj = org.andromda.presentation.bpm4struts.PageSessionObjectUtil.getPageForm(request, "${action.useCase.name}"); if (formObj != null) { try { formObj.getClass() .getMethod("resetCheckBoxes", new Class[] { org.apache.struts.action.ActionMapping.class, javax.servlet.http.HttpServletRequest.class }) .invoke(formObj, new Object[] { null, null }); } catch (Exception e2) { // ignoring } final java.util.Map parameters = new java.util.HashMap(); for (final java.util.Enumeration names = request.getParameterNames(); names.hasMoreElements();) { final String name = String.valueOf(names.nextElement()); parameters.put(name, request.getParameterValues(name)); } try { org.apache.commons.beanutils.BeanUtils.populate(formObj, parameters); } catch (java.lang.Exception populateException) { // ignore if we have an exception here (we just don't populate). } } } return errors; }