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:it.eng.spago.dispatching.httpchannel.AdapterHTTP.java
/** * Handle simple form./*from w w w . ja va2s . c om*/ * * @param request the request * @param requestContext the request context * * @throws SourceBeanException the source bean exception */ private void handleSimpleForm(HttpServletRequest request, RequestContextIFace requestContext) throws SourceBeanException { SourceBean serviceRequest = requestContext.getServiceRequest(); Enumeration names = request.getParameterNames(); while (names.hasMoreElements()) { String parameterName = (String) names.nextElement(); if (parameterName.startsWith("QUERY_STRING")) { handleQueryStringField(request, serviceRequest, parameterName); } else { String[] parameterValues = request.getParameterValues(parameterName); if (parameterValues != null) for (int i = 0; i < parameterValues.length; i++) serviceRequest.setAttribute(parameterName, parameterValues[i]); } } // while (names.hasMoreElements()) }
From source file:com.krawler.spring.profileHandler.profileHandlerController.java
public ModelAndView deleteUser(HttpServletRequest request, HttpServletResponse response) throws ServletException { JSONObject jobj = new JSONObject(); //Create transaction DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setName("JE_Tx"); def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED); TransactionStatus status = txnManager.getTransaction(def); try {/* www. jav a2 s .c o m*/ String[] ids = request.getParameterValues("userids"); for (int i = 0; i < ids.length; i++) { profileHandlerDAOObj.deleteUser(ids[i]); } jobj.put("msg", messageSource.getMessage("crm.userprofile.deleteusersuccessmsg", null, RequestContextUtils.getLocale(request)));//"User deleted successfully"); txnManager.commit(status); } catch (Exception e) { logger.warn("General exception in deleteUser()", e); txnManager.rollback(status); } return new ModelAndView("jsonView", "model", jobj.toString()); }
From source file:fr.paris.lutece.plugins.mylutece.modules.database.authentication.web.GroupJspBean.java
/** * Assign users to a group/*from w w w . ja va2s . com*/ * @param request HttpServletRequest * @return JSP return */ public String doAssignUsersGroup(HttpServletRequest request) { String strReturn; String strActionCancel = request.getParameter(PARAMETER_CANCEL); if (strActionCancel != null) { strReturn = JSP_MANAGE_GROUPS; } else { Group selectedGroup = getGroupFromRequest(request); if (selectedGroup == null) { return getCreateGroup(request); } //retrieve the selected portlets ids String[] arrayUsersIds = request.getParameterValues(PARAMETER_AVAILABLE_USERS); if ((arrayUsersIds != null)) { for (int i = 0; i < arrayUsersIds.length; i++) { int nUserId = Integer.parseInt(arrayUsersIds[i]); DatabaseUser user = DatabaseUserHome.findByPrimaryKey(nUserId, getPlugin()); DatabaseHome.addGroupForUser(user.getUserId(), selectedGroup.getGroupKey(), getPlugin()); } } strReturn = JSP_MANAGE_USERS_GROUP + QUESTION_MARK + PARAMETER_GROUP_KEY + EQUAL + selectedGroup.getGroupKey(); } return strReturn; }
From source file:net.sf.infrared.web.action.PerfDataSummaryAction.java
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ConfigureFormBean configBean = (ConfigureFormBean) form; HttpSession session = request.getSession(); Set selectedApplications = new HashSet(); boolean ascending = true; boolean ascendingAbs = true; PerfDataSummaryBean perfBean = new PerfDataSummaryBean(); Map hierarchicalLayerTimes;//from www. j a v a 2s. c o m Map absoluteLayerTimes; LayerTime[] hierarchicalLayerTimeArr = null; LayerTime[] absoluteLayerTimeArr = null; if (configBean.isLiveData()) { session.setAttribute("isInActiveMode", "true"); Set applicationNames = DataFetchUtil.getApplicationNames(); PerformanceDataSnapshot currentPerfData = (PerformanceDataSnapshot) session.getAttribute("perfData"); if (request.getParameterValues("applicationName") != null) { String[] parameterValues = request.getParameterValues("applicationName"); for (int i = 0; i < parameterValues.length; i++) { selectedApplications.add(parameterValues[i]); } } else if (currentPerfData != null) { selectedApplications = currentPerfData.getApplicationNames(); } else if (applicationNames.size() > 0) { selectedApplications.add(applicationNames.iterator().next()); } Set instances = DataFetchUtil.getInstanceNames(selectedApplications); Set selectedInstances = new HashSet(); if (request.getParameter("instanceName") != null) { String[] parameterValues = request.getParameterValues("instanceName"); for (int i = 0; i < parameterValues.length; i++) { selectedInstances.add(parameterValues[i]); } } else if (currentPerfData != null) { selectedInstances = currentPerfData.getInstanceNames(); } else if (instances.size() > 0) { selectedInstances.add(instances.iterator().next()); } if ("true".equals(request.getParameter("reset"))) { selectedApplications.clear(); selectedInstances.clear(); applicationNames.clear(); instances.clear(); session.setAttribute("perfData", DataFetchUtil.reset()); } // -- creating a application-name to instance-name map --// String map[][] = new String[applicationNames.size()][]; getAppNameToInstNameMapping(applicationNames, map); request.setAttribute("map", map); PerformanceDataSnapshot perfData = DataFetchUtil.getPerfData(selectedApplications, selectedInstances); perfBean.setApplicationName(applicationNames); perfBean.setInstanceName(instances); perfBean.setSelectedApplications(selectedApplications); perfBean.setSelectedInstances(selectedInstances); session.setAttribute("perfData", perfData); hierarchicalLayerTimes = getHierarchicalLayerTimesMap(perfData); absoluteLayerTimes = getAbsoluteLayerTimesMap(perfData); String sortBy = getSortBy(request.getParameter("sortBy")); ascending = getSortDir(request.getParameter("sortDir")); String sortByAbs = getSortBy(request.getParameter("sortByAbs")); ascendingAbs = getSortDir(request.getParameter("sortDirAbs")); hierarchicalLayerTimeArr = new LayerTime[hierarchicalLayerTimes.size()]; absoluteLayerTimeArr = new LayerTime[absoluteLayerTimes.size()]; int count = 0; for (Iterator itr = hierarchicalLayerTimes.values().iterator(); itr.hasNext();) { hierarchicalLayerTimeArr[count] = (LayerTime) itr.next(); count++; } count = 0; for (Iterator itr = absoluteLayerTimes.values().iterator(); itr.hasNext();) { absoluteLayerTimeArr[count] = (LayerTime) itr.next(); count++; } ViewUtil.sort(hierarchicalLayerTimeArr, sortBy, ascending); ViewUtil.sort(absoluteLayerTimeArr, sortByAbs, ascendingAbs); } else { String start = configBean.getStartDate(); String end = configBean.getEndDate() + " 23:59:59"; session.setAttribute("isInActiveMode", "false"); PerformanceDataSnapshot perfData = (PerformanceDataSnapshot) session.getAttribute("perfData"); if (perfData == null) { perfData = new PerformanceDataSnapshot(); } SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat endFormatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date startDate = formatter.parse(start); Date endDate = endFormatter.parse(end); Set applicationNames = perfData.getApplicationNames(); Set instanceNames = perfData.getInstanceNames(); perfData = DataFetchUtil.getDataFromDB(applicationNames, instanceNames, startDate, endDate); session.setAttribute("perfData", perfData); perfBean.setApplicationName(applicationNames); perfBean.setInstanceName(instanceNames); perfBean.setSelectedApplications(applicationNames); perfBean.setSelectedInstances(instanceNames); hierarchicalLayerTimes = getHierarchicalLayerTimesMap(perfData); absoluteLayerTimes = getAbsoluteLayerTimesMap(perfData); String sortBy = getSortBy(request.getParameter("sortBy")); ascending = getSortDir(request.getParameter("sortDir")); String sortByAbs = getSortBy(request.getParameter("sortByAbs")); ascendingAbs = getSortDir(request.getParameter("sortDirAbs")); hierarchicalLayerTimeArr = new LayerTime[hierarchicalLayerTimes.size()]; absoluteLayerTimeArr = new LayerTime[absoluteLayerTimes.size()]; int count = 0; for (Iterator itr = hierarchicalLayerTimes.values().iterator(); itr.hasNext();) { hierarchicalLayerTimeArr[count] = (LayerTime) itr.next(); count++; } count = 0; for (Iterator itr = absoluteLayerTimes.values().iterator(); itr.hasNext();) { absoluteLayerTimeArr[count] = (LayerTime) itr.next(); count++; } ViewUtil.sort(hierarchicalLayerTimeArr, sortBy, ascending); ViewUtil.sort(absoluteLayerTimeArr, sortByAbs, ascendingAbs); } ArrayList hierarchicalLayerTimeBean = new ArrayList(); for (int i = 0; i < hierarchicalLayerTimeArr.length; i++) { LayerTimeBean layerBean = new LayerTimeBean(); BeanUtils.copyProperties(layerBean, hierarchicalLayerTimeArr[i]); hierarchicalLayerTimeBean.add(layerBean); } ArrayList absoluteLayerTimeBean = new ArrayList(); for (int i = 0; i < absoluteLayerTimeArr.length; i++) { LayerTimeBean layerBean = new LayerTimeBean(); BeanUtils.copyProperties(layerBean, absoluteLayerTimeArr[i]); absoluteLayerTimeBean.add(layerBean); } perfBean.setLayerTimes(hierarchicalLayerTimeBean); perfBean.setAbsoluteLayerTimes(absoluteLayerTimeBean); request.setAttribute("perfBean", perfBean); return (mapping.findForward("continue")); }
From source file:net.naijatek.myalumni.framework.struts.MyAlumniValidator.java
public boolean requiresDeleteId(Object bean, ValidatorAction va, Field field, ActionMessages messages, HttpServletRequest request) { String[] mailArray = new String[0]; PrivateMessageForm pmForm = (PrivateMessageForm) bean; //mailArray = request.getParameterValues(appProp.getValue("var.privMsgsId")); messageId // TODO: find a way not to hard code this variable, add string[] to form mailArray = request.getParameterValues("messageId"); if (mailArray == null) { messages.add(field.getKey(), Resources.getActionMessage(request, va, field)); }// w w w .j av a 2 s . c om return messages.isEmpty(); }
From source file:org.openmrs.module.privilegehelper.web.controller.PrivilegeAssignerController.java
@RequestMapping(value = "/assignRoles", method = RequestMethod.POST) public void assignRolesPOST(@ModelAttribute(PRIVILEGES) final SortedSet<PrivilegeLogEntry> privileges, @ModelAttribute(MISSING_PRIVILEGES) final SortedSet<PrivilegeLogEntry> missingPrivileges, final User user, final HttpServletRequest request, final Role role, final Errors errors, @RequestParam(required = false) final String assignRole, final ModelMap model) { if (assignRole != null) { final RoleValidator validator = new RoleValidator(); validator.validate(role, errors); if (errors.hasErrors()) { assignRoles(privileges, missingPrivileges, user, model); return; }/*from w ww .ja va 2s.co m*/ Role existingRole = Context.getUserService().getRole(role.getRole()); if (existingRole != null) { errors.rejectValue("role", "role.exists.error", "Role with the given name already exists!"); assignRoles(privileges, missingPrivileges, user, model); return; } Context.getUserService().saveRole(role); user.addRole(role); } else { for (PrivilegeLogEntry privilege : privileges) { String[] roles = request.getParameterValues(privilege.getPrivilege()); if (roles == null) { continue; } for (String existingRole : roles) { Privilege privilegeObject = Context.getUserService().getPrivilege(privilege.getPrivilege()); Role roleObject = Context.getUserService().getRole(existingRole); roleObject.addPrivilege(privilegeObject); Context.getUserService().saveRole(roleObject); } } } assignRoles(privileges, missingPrivileges, user, model); }
From source file:com.globalsight.everest.webapp.pagehandler.administration.users.UserMainHandler.java
private void exportUsers(HttpServletRequest request, HttpServletResponse response, SessionManager sessionMgr) { FileOutputStream outStream = null; File exportedXmlFile = null;/* ww w . j a v a 2 s . c o m*/ try { Element root = new Element("UserInfo"); Document Doc = new Document(root); String[] userIds = request.getParameterValues("radioBtn"); for (String userId : userIds) { User user = ServerProxy.getUserManager().getUser(userId); Element userNode = new Element("User"); // ==========================basic info======================= Element basicInfoNode = new Element("BasicInfo"); basicInfoNode.addContent(new Element("UserID").setText(user.getUserId())); basicInfoNode.addContent(new Element("UserName").setText(user.getUserName())); basicInfoNode.addContent(new Element("FirstName").setText(user.getFirstName())); basicInfoNode.addContent(new Element("LastName").setText(user.getLastName())); basicInfoNode.addContent(new Element("Password").setText(user.getPassword())); basicInfoNode .addContent(new Element("Title").setText(user.getTitle() == null ? "" : user.getTitle())); basicInfoNode.addContent(new Element("CompanyName").setText(user.getCompanyName())); userNode.addContent(basicInfoNode); // ======================== contact info ===================== Element contactInfoNode = new Element("ContactInfo"); contactInfoNode.addContent( new Element("Address").setText(user.getAddress() == null ? "" : user.getAddress())); contactInfoNode.addContent(new Element("HomePhone") .setText(user.getHomePhoneNumber() == null ? "" : user.getHomePhoneNumber())); contactInfoNode.addContent(new Element("WorkPhone") .setText(user.getOfficePhoneNumber() == null ? "" : user.getOfficePhoneNumber())); contactInfoNode.addContent(new Element("CellPhone") .setText(user.getCellPhoneNumber() == null ? "" : user.getCellPhoneNumber())); contactInfoNode.addContent(new Element("Fax") .setText(user.getFaxPhoneNumber() == null ? "" : user.getFaxPhoneNumber())); contactInfoNode.addContent( new Element("EmailAddress").setText(user.getEmail() == null ? "" : user.getEmail())); contactInfoNode.addContent( new Element("CCEmailAddress").setText(user.getCCEmail() == null ? "" : user.getCCEmail())); contactInfoNode.addContent(new Element("BCCEmailAddress") .setText(user.getBCCEmail() == null ? "" : user.getBCCEmail())); contactInfoNode.addContent(new Element("EmailLanguage").setText(user.getDefaultUILocale())); userNode.addContent(contactInfoNode); // ======================= default roles // ========================== List<UserDefaultRole> defaultRoles = SetDefaultRoleUtil.getDefaultRolesByUser(userId); if (defaultRoles != null && defaultRoles.size() > 0) { HashMap<Long, String> allLocalesMap = getAllLocales(); Element defaultRolesNode = new Element("DefaultRoles"); for (UserDefaultRole userDefaultRole : defaultRoles) { Element defaultRoleNode = new Element("DefaultRole"); defaultRoleNode.addContent(new Element("SourceLocale") .setText(allLocalesMap.get(userDefaultRole.getSourceLocaleId()))); defaultRoleNode.addContent(new Element("TargetLocale") .setText(allLocalesMap.get(userDefaultRole.getTargetLocaleId()))); Set activitys = userDefaultRole.getActivities(); for (Iterator iterator = activitys.iterator(); iterator.hasNext();) { UserDefaultActivity defaultActivity = (UserDefaultActivity) iterator.next(); defaultRoleNode.addContent( new Element("ActivityName").setText(defaultActivity.getActivityName())); } defaultRolesNode.addContent(defaultRoleNode); } userNode.addContent(defaultRolesNode); } // ======================= roles ========================== Element rolesNode = new Element("Roles"); Collection userRoles = ServerProxy.getUserManager().getUserRoles(user); if (userRoles != null) { for (Iterator it = userRoles.iterator(); it.hasNext();) { UserRoleImpl userRole = (UserRoleImpl) it.next(); Element activityNode = new Element("Activity"); Activity activity = userRole.getActivity(); activityNode.addContent(new Element("CompanyName") .setText(CompanyWrapper.getCompanyNameById(activity.getCompanyId()))); activityNode.addContent(new Element("SourceLocale").setText(userRole.getSourceLocale())); activityNode.addContent(new Element("TargetLocale").setText(userRole.getTargetLocale())); String activityName = activity.getActivityName(); activityNode.addContent(new Element("ActivityName") .setText(activityName.substring(0, activityName.lastIndexOf("_")))); activityNode.addContent(new Element("Rate").setText(userRole.getRate())); rolesNode.addContent(activityNode); } userNode.addContent(rolesNode); } // ========================== projects // ============================ Element projectsNode = new Element("Projects"); try { projectsNode.addContent( new Element("IsInAllProjects").setText(String.valueOf(user.isInAllProjects()))); List<?> projects = ServerProxy.getProjectHandler().getProjectsByUser(userId); for (int i = 0; i < projects.size(); i++) { Project project = (Project) projects.get(i); Element projectNode = new Element("Project"); projectNode.addContent(new Element("ProjectId").setText(String.valueOf(project.getId()))); projectNode.addContent(new Element("ProjectName").setText(project.getName())); projectNode.addContent(new Element("ProjectCompanyName") .setText(CompanyWrapper.getCompanyNameById(project.getCompanyId()))); projectsNode.addContent(projectNode); } } catch (NamingException e) { throw new EnvoyServletException(EnvoyServletException.EX_GENERAL, e); } userNode.addContent(projectsNode); // ========================= security ========================== Element securityNode = new Element("Security"); User operator = (User) sessionMgr.getAttribute(WebAppConstants.USER); FieldSecurity fs = UserHandlerHelper.getSecurity(user, operator, false); securityNode.addContent(new Element("AccessLevel").setText(fs.get(UserSecureFields.ACCESS_GROUPS))); securityNode.addContent(new Element("Address").setText(fs.get(UserSecureFields.ADDRESS))); securityNode.addContent(new Element("Security").setText(fs.get(UserSecureFields.SECURITY))); securityNode.addContent(new Element("Calendar").setText(fs.get(UserSecureFields.CALENDAR))); securityNode.addContent(new Element("CellPhone").setText(fs.get(UserSecureFields.CELL_PHONE))); securityNode.addContent(new Element("CompanyName").setText(fs.get(UserSecureFields.COMPANY))); securityNode.addContent(new Element("Country").setText(fs.get(UserSecureFields.COUNTRY))); securityNode .addContent(new Element("EmailAddress").setText(fs.get(UserSecureFields.EMAIL_ADDRESS))); securityNode.addContent( new Element("CCEmailAddress").setText(fs.get(UserSecureFields.CC_EMAIL_ADDRESS))); securityNode.addContent( new Element("BCCEmailAddress").setText(fs.get(UserSecureFields.BCC_EMAIL_ADDRESS))); securityNode .addContent(new Element("EmailLanguage").setText(fs.get(UserSecureFields.EMAIL_LANGUAGE))); securityNode.addContent(new Element("Fax").setText(fs.get(UserSecureFields.FAX))); securityNode.addContent(new Element("FirstName").setText(fs.get(UserSecureFields.FIRST_NAME))); securityNode.addContent(new Element("HomePhone").setText(fs.get(UserSecureFields.HOME_PHONE))); securityNode.addContent(new Element("LastName").setText(fs.get(UserSecureFields.LAST_NAME))); securityNode.addContent(new Element("Password").setText(fs.get(UserSecureFields.PASSWORD))); securityNode.addContent(new Element("Projects").setText(fs.get(UserSecureFields.PROJECTS))); securityNode.addContent(new Element("Roles").setText(fs.get(UserSecureFields.ROLES))); securityNode.addContent(new Element("Status").setText(fs.get(UserSecureFields.STATUS))); securityNode.addContent(new Element("Title").setText(fs.get(UserSecureFields.TITLE))); securityNode.addContent(new Element("WorkPhone").setText(fs.get(UserSecureFields.WORK_PHONE))); userNode.addContent(securityNode); // ======================= permission ========================= Element permissionGroupsNode = new Element("PermissionGroups"); Collection permList = PermissionHelper.getAllPermissionGroupsForUser(userId); for (Iterator iterator = permList.iterator(); iterator.hasNext();) { Element permissionGroupNode = new Element("PermissionGroup"); PermissionGroup pg = (PermissionGroup) iterator.next(); permissionGroupNode.addContent(new Element("CompanyName") .setText(CompanyWrapper.getCompanyNameById(pg.getCompanyId()))); permissionGroupNode .addContent(new Element("PermissionGroupId").setText(String.valueOf(pg.getId()))); permissionGroupNode.addContent(new Element("PermissionGroupName").setText(pg.getName())); permissionGroupsNode.addContent(permissionGroupNode); } userNode.addContent(permissionGroupsNode); // ======================= user parameter // ========================= Element userParametersNode = new Element("UserParameters"); Collection userConfig = ServerProxy.getUserParameterManager().getUserParameters(userId); for (Iterator it = userConfig.iterator(); it.hasNext();) { UserParameterImpl up = (UserParameterImpl) it.next(); Element userParameterNode = new Element("UserParameter"); userParameterNode.addContent(new Element("Name").setText(up.getName())); userParameterNode.addContent(new Element("Value").setText(up.getValue())); userParametersNode.addContent(userParameterNode); } userNode.addContent(userParametersNode); // add to root root.addContent(userNode); } SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); String fileName = "User_information_" + sdf.format(new Date()) + ".xml"; XMLOutputter XMLOut = new XMLOutputter(); String filePath = AmbFileStoragePathUtils.getFileStorageDirPath() + File.separator + "tmp"; exportedXmlFile = new File(filePath, fileName); exportedXmlFile.getParentFile().mkdirs(); outStream = new FileOutputStream(exportedXmlFile); XMLOut.output(Doc, outStream); ExportUtil.writeToResponse(response, exportedXmlFile, fileName); } catch (Exception e) { throw new EnvoyServletException(EnvoyServletException.EX_GENERAL, e); } finally { try { if (outStream != null) outStream.close(); } catch (IOException e) { } FileUtil.deleteFile(exportedXmlFile); } }
From source file:fr.paris.lutece.portal.web.rbac.RoleManagementJspBean.java
/** * Perform the check on the resource id list selected on the specific id * selection page perform the suitable redirection. * <ul>//from ww w . ja v a2 s. com * <li>If selection method is specific (id selection - parameter "choose"), * <ul> * <li>if at least one id as been selected, the user is redirected to the * permission selection page.</li> * <li>if no id as been selected, the user is redirected to an error page.</li> * </ul> * <li>If selection method is global (wilcard selection - parameter "all"), * the user is redirected to the permission selection page (This check could * be avoided as is should not happen).</li> * <li>If no selection method is found, or if it's neither parameter "all" * nor "choose", the user is redirected to a error page.</li> * </ul> * @param request the http request * @return the url of the page to be redirected to */ public String doSelectResourcesFromIdsList(HttpServletRequest request) { String strRoleKey = request.getParameter(PARAMETER_ROLE_KEY); String strSelectionMethod = request.getParameter(PARAMETER_SELECT_RESOURCES_METHOD); String strResourceType = request.getParameter(PARAMETER_RESOURCE_TYPE); String[] strArrayResourceIds = request.getParameterValues(PARAMETER_RESOURCE_ID); String strUrl; // check that the selection method is "all" or "choose" // if method is "choose", check that we have at least one id checked if (strSelectionMethod == null) { strUrl = AdminMessageService.getMessageUrl(request, PROPERTY_MESSAGE_NO_ID_SELECTION_METHOD, AdminMessage.TYPE_STOP); } else if (strSelectionMethod.equals(PARAMETER_METHOD_SELECTION_CHOOSE)) { if ((strArrayResourceIds == null) || (strArrayResourceIds.length == 0)) { strUrl = AdminMessageService.getMessageUrl(request, PROPERTY_MESSAGE_ID_LIST_EMPTY, AdminMessage.TYPE_STOP); } else { StringBuilder sbUrl = new StringBuilder(JSP_URL_SELECT_PERMISSIONS); sbUrl.append("?"); sbUrl.append(PARAMETER_RESOURCE_TYPE); sbUrl.append("="); sbUrl.append(strResourceType); sbUrl.append("&"); sbUrl.append(PARAMETER_ROLE_KEY); sbUrl.append("="); sbUrl.append(strRoleKey); sbUrl.append("&"); sbUrl.append(PARAMETER_SELECT_RESOURCES_METHOD); sbUrl.append("="); sbUrl.append(strSelectionMethod); for (int i = 0; i < strArrayResourceIds.length; i++) { sbUrl.append("&"); sbUrl.append(PARAMETER_RESOURCE_ID); sbUrl.append("="); sbUrl.append(strArrayResourceIds[i]); } strUrl = sbUrl.toString(); } } else if (strSelectionMethod.equals(PARAMETER_METHOD_SELECTION_ALL)) { StringBuilder sbUrl = new StringBuilder(JSP_URL_SELECT_PERMISSIONS); sbUrl.append("?"); sbUrl.append(PARAMETER_RESOURCE_TYPE); sbUrl.append("="); sbUrl.append(strResourceType); sbUrl.append("&"); sbUrl.append(PARAMETER_ROLE_KEY); sbUrl.append("="); sbUrl.append(strRoleKey); sbUrl.append("&"); sbUrl.append(PARAMETER_SELECT_RESOURCES_METHOD); sbUrl.append("="); sbUrl.append(strSelectionMethod); strUrl = sbUrl.toString(); } else { strUrl = AdminMessageService.getMessageUrl(request, PROPERTY_MESSAGE_NO_ID_SELECTION_METHOD, AdminMessage.TYPE_STOP); } return strUrl; }
From source file:br.mdarte.exemplo.academico.web.geral.detalharCurso.DetalhandoCursoEditaCursoFormImpl.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) *//* www . j a va2 s . co 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, "DetalhaCursoUC.DetalhandoCurso"); 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; }
From source file:br.mdarte.exemplo.academico.web.geral.consultarCurso.ResultadoConsultaDetalhaCursoFormImpl.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) *///www. java 2s . 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, "ConsultaCursoUC.ResultadoConsulta"); 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; }