Example usage for javax.servlet.http HttpServletRequest getParameterValues

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

Introduction

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

Prototype

public String[] getParameterValues(String name);

Source Link

Document

Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.

Usage

From source file:pivotal.au.se.gemfirexdweb.controller.CreateIndexController.java

@RequestMapping(value = "/createindex", method = RequestMethod.POST)
public String createIndexAction(@ModelAttribute("indexAttribute") NewIndex indexAttribute, Model model,
        HttpServletResponse response, HttpServletRequest request, HttpSession session) throws Exception {
    if (session.getAttribute("user_key") == null) {
        logger.debug("user_key is null new Login required");
        response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login");
        return null;
    } else {/*ww w  .j a v a2s  .c o m*/
        Connection conn = AdminUtil.getConnection((String) session.getAttribute("user_key"));
        if (conn == null) {
            response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login");
            return null;
        } else {
            if (conn.isClosed()) {
                response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login");
                return null;
            }
        }

    }

    logger.debug("Received request to action an event for create index");

    String tabName = indexAttribute.getTableName();
    String schema = indexAttribute.getSchemaName();
    String unique = indexAttribute.getUnique();
    String idxName = indexAttribute.getIndexName();
    String submit = request.getParameter("pSubmit");

    String[] selectedColumns = request.getParameterValues("selected_column[]");
    String[] indexOrder = request.getParameterValues("idxOrder[]");
    String[] position = request.getParameterValues("position[]");

    logger.debug("selectedColumns = " + Arrays.toString(selectedColumns));
    logger.debug("indexOrder = " + Arrays.toString(indexOrder));
    logger.debug("position = " + Arrays.toString(position));

    IndexDAO indexDAO = GemFireXDWebDAOFactory.getIndexDAO();

    List<IndexColumn> columns = indexDAO.retrieveIndexColumns(schema, tabName,
            (String) session.getAttribute("user_key"));

    StringBuffer createIndex = new StringBuffer();

    if (unique.equalsIgnoreCase("Y")) {
        createIndex.append("create unique index " + idxName + " on " + schema + "." + tabName + " ");
    } else {
        createIndex.append("create index " + idxName + " on " + schema + "." + tabName + " ");
    }

    createIndex.append("(");

    if (selectedColumns != null) {
        int i = 0;
        Map<String, IndexDefinition> cols = new HashMap<String, IndexDefinition>();

        for (String column : selectedColumns) {
            String columnName = column.substring(0, column.indexOf("_"));
            String index = column.substring(column.indexOf("_") + 1);
            String pos = position[Integer.parseInt(index) - 1];
            if (pos.trim().length() == 0) {
                pos = "" + i;
            }

            logger.debug("Column = " + columnName + ", indexOrder = " + indexOrder[Integer.parseInt(index) - 1]
                    + ", position = " + pos);

            IndexDefinition idxDef = new IndexDefinition(columnName, indexOrder[Integer.parseInt(index) - 1]);

            cols.put("" + pos, idxDef);
            i++;
        }

        // sort map and create index now
        SortedSet<String> keys = new TreeSet<String>(cols.keySet());
        int length = keys.size();
        i = 0;
        for (String key : keys) {
            IndexDefinition idxDefTemp = cols.get(key);
            if (i == (length - 1)) {
                createIndex.append(idxDefTemp.getColumnName() + " " + idxDefTemp.getOrderType() + ")");
            } else {
                createIndex.append(idxDefTemp.getColumnName() + " " + idxDefTemp.getOrderType() + ", ");
            }

            i++;

        }
    }

    if (!checkIfParameterEmpty(request, "caseSensitive")) {
        createIndex.append(" " + request.getParameter("caseSensitive") + "\n");
    }

    if (submit.equalsIgnoreCase("create")) {
        Result result = new Result();

        logger.debug("Creating index as -> " + createIndex.toString());

        result = GemFireXDWebDAOUtil.runCommand(createIndex.toString(),
                (String) session.getAttribute("user_key"));

        model.addAttribute("result", result);
        model.addAttribute("tabName", tabName);
        model.addAttribute("tableSchemaName", schema);
        model.addAttribute("columns", columns);
        model.addAttribute("schema", schema);

        session.removeAttribute("numColumns");
    } else if (submit.equalsIgnoreCase("Show SQL")) {
        logger.debug("Index SQL as follows as -> " + createIndex.toString());
        model.addAttribute("sql", createIndex.toString());
        model.addAttribute("tabName", tabName);
        model.addAttribute("tableSchemaName", schema);
        model.addAttribute("columns", columns);
        model.addAttribute("schema", schema);
    } else if (submit.equalsIgnoreCase("Save to File")) {
        response.setContentType(SAVE_CONTENT_TYPE);
        response.setHeader("Content-Disposition", "attachment; filename=" + String.format(FILENAME, idxName));

        ServletOutputStream out = response.getOutputStream();
        out.println(createIndex.toString());
        out.close();
        return null;
    }
    // This will resolve to /WEB-INF/jsp/create-index.jsp
    return "create-index";
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.cotijob.CotiJobDetailHandler.java

private Map<String, Object> prepareDataForJob(HttpServletRequest request, String currentCompanyId, User user,
        COTIProject cproject, COTIPackage cpackage, List<COTIDocument> documents) {
    Map<String, Object> dataMap = new HashMap<String, Object>();
    dataMap.put("currentCompanyId", currentCompanyId);
    dataMap.put("user", user);
    SessionManager sessionMgr = (SessionManager) request.getSession().getAttribute(SESSION_MANAGER);
    dataMap.put(SESSION_MANAGER, sessionMgr);

    dataMap.put("cotiPackage", cpackage);
    dataMap.put("cotiProject", cproject);
    dataMap.put("cotiDocuments", documents);

    String[] referenceFilePaths = request.getParameterValues("referenceFilePath");
    dataMap.put("referenceFilePath", referenceFilePaths);

    String jobName = EditUtil.removeCRLF(request.getParameter("jobName")) + "_" + getRandomNumber();
    dataMap.put("jobName", jobName);
    String comment = request.getParameter("comment");
    dataMap.put("comment", comment);
    // full path of files
    String[] filePaths = request.getParameterValues("jobFilePath");
    dataMap.put("jobFilePath", filePaths);
    // l10n info and file profile info
    String[] l10nAndfileProfiles = request.getParameterValues("fileProfile");
    dataMap.put("fileProfile", l10nAndfileProfiles);
    // mapped target locales
    GlobalSightLocale targetLocale = (GlobalSightLocale) request.getAttribute("targetLocale");
    dataMap.put("targetLocale", targetLocale);
    // priority/*w  w  w. j av  a  2s  .c o  m*/
    String priority = request.getParameter("priority");
    dataMap.put("priority", priority);
    // attribute
    String attribute = request.getParameter("attributeString");
    dataMap.put("attributeString", attribute);

    return dataMap;
}

From source file:com.opendesign.controller.ProjectController.java

/**
 *  ?? ? ? ?/*from   w w w.j  av a 2  s .  c  o m*/
 * 
 * @param request
 * @return
 */
@RequestMapping(value = "/addGroupProject.ajax")
@Deprecated
public ModelAndView addGroupProject(HttpServletRequest request) {
    Map<String, Object> resultMap = new HashMap<String, Object>();

    UserVO loginUser = CmnUtil.getLoginUser(request);
    if (loginUser == null || !StringUtil.isNotEmpty(loginUser.getSeq())) {
        resultMap.put("result", "100");
        return new JsonModelAndView(resultMap);

    }

    String groupSeq = request.getParameter("projectGroupSeq");
    String[] projectSeqs = request.getParameterValues("projectSeq[]");
    if (!StringUtil.isNotEmpty(groupSeq) || (projectSeqs == null || projectSeqs.length <= 0)) {
        resultMap.put("result", "200");
        return new JsonModelAndView(resultMap);

    }

    service.insertGroupProject(loginUser.getSeq(), groupSeq, projectSeqs);

    return new JsonModelAndView(resultMap);
}

From source file:com.siberhus.web.ckeditor.servlet.MultipartServletRequest.java

public MultipartServletRequest(HttpServletRequest request) throws FileUploadException {
    super(request);

    //      if(!"POST".equals(request.getMethod())){
    //         return;
    //      }/*from   w w  w.ja v  a 2 s .c o m*/
    CkeditorConfig config = CkeditorConfigurationHolder.config();
    // Create a factory for disk-based file items
    DiskFileItemFactory factory = new DiskFileItemFactory();
    // Set factory constraints
    if (config.fileupload().sizeThreshold() != null) {
        factory.setSizeThreshold(config.fileupload().sizeThreshold());
    }
    if (config.fileupload().repository() != null) {
        factory.setRepository(config.fileupload().repository());
    }

    // Create a new file upload handler
    ServletFileUpload upload = new ServletFileUpload(factory);

    // Set overall request size constraint
    if (config.fileupload().sizeMax() != null) {
        upload.setSizeMax(config.fileupload().sizeMax());
    }
    if (config.fileupload().fileSizeMax() != null) {
        upload.setFileSizeMax(config.fileupload().fileSizeMax());
    }
    // Copy params from query string
    Enumeration<String> paramNames = request.getParameterNames();
    while (paramNames.hasMoreElements()) {
        String paramName = paramNames.nextElement();
        String paramValues[] = request.getParameterValues(paramName);
        if (paramValues != null) {
            this.paramMap.put(paramName, Literal.list(paramValues));
        }
    }

    @SuppressWarnings("unchecked")
    List<FileItem> itemList = upload.parseRequest(request);

    for (FileItem item : itemList) {
        String fieldName = item.getFieldName();
        if (item.isFormField()) {
            List<String> values = paramMap.get(fieldName);
            if (values == null) {
                paramMap.put(fieldName, Literal.list(item.getString()));
            } else {
                values.add(item.getString());
            }
        } else {
            fileItemMap.put(fieldName, item);
            fileItems.add(item);
        }
    }
}

From source file:net.sourceforge.fenixedu.presentationTier.backBeans.teacher.evaluation.EvaluationManagementBackingBean.java

public String submitMarks() {
    HttpServletRequest request = getRequest();
    attendsIDs = request.getParameterValues("selectedMarks");
    if (attendsIDs == null || attendsIDs.length == 0) {
        setErrorMessage("error.noStudents.selected");
        return "";
    }/*from   ww w.  j  a v a  2  s .c o m*/
    this.getViewState().setAttribute("attendIDs", attendsIDs);
    return "enterSubmitMarksList2";
}

From source file:fr.paris.lutece.plugins.profiles.web.views.ViewsJspBean.java

/**
 * Process the data capture form for assign users to a profile
 * //from  ww  w  .  j a va 2s  . co  m
 * @param request The HTTP Request
 * @return The Jsp URL of the process result
 */
public String doAssignProfilesView(HttpServletRequest request) {
    String strReturn;

    String strActionCancel = request.getParameter(ProfilesConstants.PARAMETER_CANCEL);

    if (strActionCancel != null) {
        strReturn = JSP_MANAGE_VIEWS;
    } else {
        String strViewKey = request.getParameter(ProfilesConstants.PARAMETER_VIEW_KEY);

        if (!RBACService.isAuthorized(View.RESOURCE_TYPE, strViewKey,
                ViewsResourceIdService.PERMISSION_MANAGE_PROFILES_ASSIGNMENT, getUser())) {
            return AdminMessageService.getMessageUrl(request, Messages.USER_ACCESS_DENIED,
                    AdminMessage.TYPE_STOP);
        }

        //retrieve the selected portlets ids
        String[] arrayProfileKeys = request.getParameterValues(ProfilesConstants.PARAMETER_PROFILES_LIST);

        if (arrayProfileKeys != null) {
            for (int i = 0; i < arrayProfileKeys.length; i++) {
                String strProfileKey = arrayProfileKeys[i];
                Profile profile = _profilesService.findByPrimaryKey(strProfileKey, getPlugin());

                if (!_viewsService.hasView(strProfileKey, getPlugin())) {
                    _viewsService.addProfileForView(strViewKey, strProfileKey, getPlugin());
                } else {
                    Object[] args = { profile.getKey() };

                    return AdminMessageService.getMessageUrl(request,
                            ProfilesConstants.PROPERTY_NO_MULTIPLE_VIEWS, args, AdminMessage.TYPE_STOP);
                }
            }
        }

        strReturn = JSP_ASSIGN_PROFILES_VIEW + ProfilesConstants.INTERROGATION_MARK
                + ProfilesConstants.PARAMETER_VIEW_KEY + ProfilesConstants.EQUAL + strViewKey;
    }

    return strReturn;
}

From source file:org.openmrs.contrib.metadatarepository.webapp.controller.UserFormController.java

@RequestMapping(method = RequestMethod.POST)
public String onSubmit(User user, BindingResult errors, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    if (request.getParameter("cancel") != null) {
        if (!StringUtils.equals(request.getParameter("from"), "list")) {
            return getCancelView();
        } else {// w  ww  . ja  v a2s .  c  om
            return getSuccessView();
        }
    }

    if (validator != null) { // validator is null during testing
        validator.validate(user, errors);

        if (errors.hasErrors() && request.getParameter("delete") == null) { // don't validate when deleting
            return "userform";
        }
    }

    log.debug("entering 'onSubmit' method...");

    Locale locale = request.getLocale();

    if (request.getParameter("delete") != null) {
        getUserManager().removeUser(user.getId().toString());
        saveMessage(request, getText("user.deleted", user.getFullName(), locale));

        return getSuccessView();
    } else {

        // only attempt to change roles if user is admin for other users,
        // showForm() method will handle populating
        if (request.isUserInRole(Constants.ADMIN_ROLE) || request.isUserInRole(Constants.USER_ROLE)) {
            String[] userRoles = request.getParameterValues("userRoles");

            if (userRoles != null) {
                user.getRoles().clear();
                for (String roleName : userRoles) {
                    user.addRole(roleManager.getRole(roleName));
                }
            }
        }

        Integer originalVersion = user.getVersion();

        try {
            getUserManager().saveUser(user);
        } catch (AccessDeniedException ade) {
            // thrown by UserSecurityAdvice configured in aop:advisor userManagerSecurity
            log.warn(ade.getMessage());
            response.sendError(HttpServletResponse.SC_FORBIDDEN);
            return null;
        } catch (UserExistsException e) {
            errors.rejectValue("username", "errors.existing.user",
                    new Object[] { user.getUsername(), user.getEmail() }, "duplicate user");

            // redisplay the unencrypted passwords
            user.setPassword(user.getConfirmPassword());
            // reset the version # to what was passed in
            user.setVersion(originalVersion);

            return "userform";
        }

        if (!StringUtils.equals(request.getParameter("from"), "list")) {
            saveMessage(request, getText("user.saved", user.getFullName(), locale));

            // return to main Menu
            return getCancelView();
        } else {
            if (StringUtils.isBlank(request.getParameter("version"))) {
                saveMessage(request, getText("user.added", user.getFullName(), locale));

                // Send an account information e-mail
                message.setSubject(getText("signup.email.subject", locale));

                try {
                    sendUserMessage(user, getText("newuser.email.message", user.getFullName(), locale),
                            RequestUtil.getAppURL(request));
                } catch (MailException me) {
                    saveError(request, me.getCause().getLocalizedMessage());
                }

                return getSuccessView();
            } else {
                saveMessage(request, getText("user.updated.byAdmin", user.getFullName(), locale));
            }
        }
    }

    return "userform";
}

From source file:dk.clarin.tools.rest.register.java

public String getargs(HttpServletRequest request, List<FileItem> items) {
    String arg = "";
    /*//  w  w  w.j  ava 2s. c  o m
    * Parse the request
    */

    @SuppressWarnings("unchecked")
    Enumeration<String> parmNames = (Enumeration<String>) request.getParameterNames();
    boolean is_multipart_formData = ServletFileUpload.isMultipartContent(request);

    logger.debug("is_multipart_formData:" + (is_multipart_formData ? "ja" : "nej"));

    if (is_multipart_formData) {
        try {
            Iterator<FileItem> itr = items.iterator();
            while (itr.hasNext()) {
                FileItem item = (FileItem) itr.next();
                if (item.isFormField()) {
                    arg = arg + " (" + workflow.quote(item.getFieldName()) + "."
                            + workflow.quote(item.getString("UTF-8").trim()) + ")";
                }
            }
        } catch (Exception ex) {
            logger.error("uploadHandler.parseRequest Exception");
        }
    }

    for (Enumeration<String> e = parmNames; e.hasMoreElements();) {
        String parmName = e.nextElement();
        arg = arg + " (" + workflow.quote(parmName) + ".";
        String vals[] = request.getParameterValues(parmName);
        for (int j = 0; j < vals.length; ++j) {
            arg += " " + workflow.quote(vals[j]) + "";
        }
        arg += ")";
    }
    logger.debug("arg = [" + arg + "]");
    return arg;
}

From source file:com.topsec.tsm.sim.report.util.ReportUiUtil.java

/**
 * /* w w  w .jav  a2  s . c  o  m*/
 * request?Vo Bean
 * 
 * @param request
 *            HttpServletRequest
 * 
 * @return ??VO
 * 
 */
public static BaseStruct getBaseS(HttpServletRequest request) {
    BaseStruct reValue = new BaseStruct();

    String[] nodeId = request.getParameterValues("nodeId");
    String onlyByDvctype = request.getParameter("onlyByDvctype");
    String hrefURL = request.getParameter("hrefURL");
    // 
    String dvcAddress = request.getParameter(ReportUiConfig.dvcaddress);
    if ((dvcAddress == null) || dvcAddress.trim().equals(""))
        dvcAddress = (String) request.getAttribute("dvcaddress");
    // ID
    String mstRptId = request.getParameter(ReportUiConfig.mstrptid);

    // ?
    String subRptId = request.getParameter(ReportUiConfig.subrptid);

    // 
    String sTime = request.getParameter(ReportUiConfig.sTime);
    // ?
    String eTime = request.getParameter(ReportUiConfig.eTime);

    String dvctype = request.getParameter(ReportUiConfig.dvctype);

    // show input time
    String viewshow = request.getParameter(ReportUiConfig.viewshow);
    viewshow = ChangePageEncode.IsoToUtf8(viewshow);

    // 
    String viewji = request.getParameter(ReportUiConfig.viewji);
    if (!checkNull(viewji))
        viewji = request.getParameter("viewji");

    // 
    String viewtype = request.getParameter(ReportUiConfig.viewtype);
    if (!checkNull(viewtype)) {
        viewtype = request.getParameter("viewtype");
    }

    String[] talCategoryArray = request.getParameterValues("talCategory");
    reValue.setTalCategory(talCategoryArray);

    // show time Input
    reValue.setDvcaddress(dvcAddress);
    reValue.setMstrptid(mstRptId);
    reValue.setSubrptid(subRptId);
    reValue.setSTime(sTime);
    reValue.setETime(eTime);
    reValue.setDvctype(dvctype);
    reValue.setViewshow(viewshow);
    reValue.setViewji(viewji);
    reValue.setViewtype(viewtype);
    reValue.setNodeId(nodeId);
    reValue.setOnlyByDvctype(onlyByDvctype);
    return reValue;
}

From source file:pivotal.au.se.gemfirexdweb.controller.CreateTableController.java

@RequestMapping(value = "/createtable", method = RequestMethod.POST)
public String createTableAction(@ModelAttribute("tableAttribute") NewTable tableAttribute, Model model,
        HttpServletResponse response, HttpServletRequest request, HttpSession session) throws Exception {
    if (session.getAttribute("user_key") == null) {
        logger.debug("user_key is null new Login required");
        response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login");
        return null;
    } else {/*w  w  w.  j  a  v  a2 s  . c o  m*/
        Connection conn = AdminUtil.getConnection((String) session.getAttribute("user_key"));
        if (conn == null) {
            response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login");
            return null;
        } else {
            if (conn.isClosed()) {
                response.sendRedirect(request.getContextPath() + "/GemFireXD-Web/login");
                return null;
            }
        }

    }

    logger.debug("Received request to action an event for create table");

    String tabName = tableAttribute.getTableName();

    String[] columnNames = request.getParameterValues("column_name[]");
    String[] columnTypes = request.getParameterValues("column_type[]");
    String[] columnPrecision = request.getParameterValues("column_precision[]");
    String[] columnDefaultValues = request.getParameterValues("column_default_value[]");
    String[] columnSelectedNulls = request.getParameterValues("column_selected_null[]");
    String[] columnSelectedPrimaryKeys = request.getParameterValues("column_selected_primary_key[]");
    String[] columnSelectedAutoIncrements = request.getParameterValues("column_selected_auto_increment[]");

    logger.debug("New Table Name = " + tabName);
    logger.debug("columnNames = " + Arrays.toString(columnNames));
    logger.debug("columnTypes = " + Arrays.toString(columnTypes));
    logger.debug("columnPrecision = " + Arrays.toString(columnPrecision));
    logger.debug("columnDefaultValues = " + Arrays.toString(columnDefaultValues));
    logger.debug("columnSelectedNulls = " + Arrays.toString(columnSelectedNulls));
    logger.debug("columnSelectedPrimaryKeys = " + Arrays.toString(columnSelectedPrimaryKeys));
    logger.debug("columnSelectedAutoIncrements = " + Arrays.toString(columnSelectedAutoIncrements));

    // perform some action here with what we have
    String submit = request.getParameter("pSubmit");

    DiskStoreDAO dsDAO = GemFireXDWebDAOFactory.getDiskStoreDAO();
    HdfsStoreDAO hdfsDAO = GemFireXDWebDAOFactory.getHdfsStoreDAO();

    List<DiskStore> dsks = dsDAO.retrieveDiskStoreForCreateList((String) session.getAttribute("user_key"));

    List<HdfsStore> hdfs = hdfsDAO.retrieveHdfsStoreForCreateList((String) session.getAttribute("user_key"));

    model.addAttribute("diskstores", dsks);
    model.addAttribute("hdfsstores", hdfs);

    if (submit != null) {

        if (submit.equalsIgnoreCase("Column(s)")) {
            TypeDAO typeDAO = GemFireXDWebDAOFactory.getTypeDAO();
            List<Type> types = typeDAO.retrieveTypeList((String) session.getAttribute("schema"), null,
                    (String) session.getAttribute("user_key"));

            model.addAttribute("types", types);

            int cols = Integer.parseInt(request.getParameter("numColumns"));
            int numColumns = Integer.parseInt((String) session.getAttribute("numColumns"));

            numColumns = numColumns + cols;

            session.setAttribute("numColumns", "" + numColumns);
            session.setAttribute("tabName", tableAttribute.getTableName());

            model.addAttribute("numColumns", numColumns);
            model.addAttribute("tabName", tableAttribute.getTableName());
            model.addAttribute("hdfsStore", tableAttribute.getHdfsStore());
            model.addAttribute("diskStore", tableAttribute.getDiskStore());
        } else {
            // build create table SQL 
            StringBuffer createTable = new StringBuffer();
            String schema = tableAttribute.getSchemaName();
            if (schema.length() == 0) {
                schema = (String) session.getAttribute("schema");
            }

            createTable.append("create table " + schema + "." + tabName + " \n");
            createTable.append("(");

            int i = 0;
            String val = null;

            if (columnNames != null) {
                int size = columnNames.length;
                for (String columnName : columnNames) {
                    createTable.append(columnName + " ");
                    createTable.append(columnTypes[i]);

                    // doing precision / size
                    val = checkIfEntryExists(columnPrecision, i);
                    if (val != null) {
                        createTable.append("(" + columnPrecision[i] + ")");
                    }
                    val = null;

                    // doing auto increment check here
                    val = checkIfEntryExists(columnSelectedAutoIncrements, i);
                    if (val != null) {
                        // should check for column type here
                        if (val.equalsIgnoreCase("Y")) {
                            createTable.append(" generated always as identity");
                        }
                    }
                    val = null;

                    // doing default value
                    val = checkIfEntryExists(columnDefaultValues, i);
                    if (val != null) {
                        // should check for column type here
                        createTable.append(" default " + columnDefaultValues[i]);
                    }
                    val = null;

                    // doing not null check here
                    val = checkIfEntryExists(columnSelectedNulls, i);
                    if (val != null) {
                        if (val.equalsIgnoreCase("Y")) {
                            createTable.append(" NOT NULL");
                        }
                    }
                    val = null;

                    // doing primary key check here
                    val = checkIfEntryExists(columnSelectedPrimaryKeys, i);
                    if (val != null) {
                        if (val.equalsIgnoreCase("Y")) {
                            createTable.append(" CONSTRAINT " + tabName + "_PK Primary Key");
                        }
                    }
                    val = null;

                    int j = size - 1;
                    if (i < j) {
                        createTable.append(",\n");
                    }

                    i++;
                }

            }

            createTable.append(")\n");

            if (request.getParameter("dataPolicy").equalsIgnoreCase("REPLICATE")) {
                createTable.append("REPLICATE\n");
            }

            if (!checkIfParameterEmpty(request, "serverGroups")) {
                createTable.append("SERVER GROUPS (" + tableAttribute.getServerGroups() + ")\n");
            }

            if (!checkIfParameterEmpty(request, "persistant")) {
                if (tableAttribute.getPersistant().equalsIgnoreCase("Y")) {
                    createTable.append("PERSISTENT ");
                    if (!checkIfParameterEmpty(request, "diskStore")) {
                        createTable.append("'" + tableAttribute.getDiskStore() + "' ");
                        if (!checkIfParameterEmpty(request, "persistenceType")) {
                            createTable.append(tableAttribute.getPersistenceType() + "\n");
                        } else {
                            createTable.append("\n");
                        }

                    }
                }
            }

            if (request.getParameter("dataPolicy").equalsIgnoreCase("PARTITION")) {
                if (!checkIfParameterEmpty(request, "partitionBy")) {
                    createTable.append("PARTITION BY " + tableAttribute.getPartitionBy() + "\n");
                }

                if (!checkIfParameterEmpty(request, "colocateWith")) {
                    createTable.append("COLOCATE WITH (" + tableAttribute.getColocateWith() + ")\n");
                }

                if (!checkIfParameterEmpty(request, "redundancy")) {
                    createTable.append("REDUNDANCY " + tableAttribute.getRedundancy() + "\n");
                }
            }

            if (!checkIfParameterEmpty(request, "hdfsStore")) {
                createTable.append("HDFSSTORE (" + tableAttribute.getHdfsStore() + ") ");
                if (request.getParameter("writeonly").equalsIgnoreCase("Y")) {
                    createTable.append("WRITEONLY\n");
                } else {
                    // need to ad eviction properties here
                    if (!checkIfParameterEmpty(request, "evictionbycriteria")) {
                        createTable.append(
                                "EVICTION BY CRITERIA (" + tableAttribute.getEvictionbycriteria() + ")\n");
                    }

                    if (!checkIfParameterEmpty(request, "evictionfrequency")) {
                        createTable
                                .append("EVICTION FREQUENCY " + tableAttribute.getEvictionfrequency() + "\n");
                    } else {
                        if (request.getParameter("evictincoming").equalsIgnoreCase("Y")) {
                            createTable.append("EVICT INCOMING\n");
                        }
                    }
                }

            }

            if (!checkIfParameterEmpty(request, "gatewaysender")) {
                createTable.append("GATEWAYSENDER (" + tableAttribute.getGatewaysender() + ")\n");
            }

            if (!checkIfParameterEmpty(request, "asynceventlistener")) {
                createTable.append("ASYNCEVENTLISTENER (" + tableAttribute.getAsynceventlistener() + ")\n");
            }

            if (!checkIfParameterEmpty(request, "offheap")) {
                if (request.getParameter("offheap").equalsIgnoreCase("Y")) {
                    createTable.append("OFFHEAP\n");
                }
            }

            if (!checkIfParameterEmpty(request, "other")) {
                createTable.append(tableAttribute.getOther() + "\n");
            }

            if (submit.equalsIgnoreCase("create")) {
                Result result = new Result();

                logger.debug("Creating table as -> " + createTable.toString());

                result = GemFireXDWebDAOUtil.runCommand(createTable.toString(),
                        (String) session.getAttribute("user_key"));

                model.addAttribute("result", result);
                model.addAttribute("hdfsStore", tableAttribute.getHdfsStore());
                model.addAttribute("diskStore", tableAttribute.getDiskStore());

            } else if (submit.equalsIgnoreCase("Show SQL")) {
                logger.debug("Table SQL as follows as -> " + createTable.toString());
                model.addAttribute("sql", createTable.toString());
                model.addAttribute("hdfsStore", tableAttribute.getHdfsStore());
                model.addAttribute("diskStore", tableAttribute.getDiskStore());
            } else if (submit.equalsIgnoreCase("Save to File")) {
                response.setContentType(SAVE_CONTENT_TYPE);
                response.setHeader("Content-Disposition",
                        "attachment; filename=" + String.format(FILENAME, tabName));

                ServletOutputStream out = response.getOutputStream();
                out.println(createTable.toString());
                out.close();
                return null;
            }
        }
    }

    // This will resolve to /WEB-INF/jsp/create-table.jsp
    return "create-table";
}