public void doCreateScaffold(StaplerRequest request, StaplerResponse response) throws IOException, ServletException {
        String name = request.getParameter("name");
        String[] jobNames = request.getParameterValues("jobNames");
        String[] variableNames = request.getParameterValues("variables");
        if (name != null && jobNames != null) {
            if (variableNames == null) {
                variableNames = new String[]{};
            }
            Scaffold scaffold = new Scaffold(name, Arrays.asList(jobNames), Arrays.asList(variableNames));

            scaffoldCache.put(scaffold);
            scaffold.save();
        }
        String rootUrl = Jenkins.getInstance().getRootUrl() == null ? "/" : Jenkins.getInstance().getRootUrl();
        response.sendRedirect(rootUrl + getUrlName());
    }