001/**
002 * Copyright 2005-2015 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package edu.sampleu.demo.kitchensink;
017
018import org.kuali.rice.krad.util.GlobalVariables;
019import org.kuali.rice.krad.web.controller.UifControllerBase;
020import org.kuali.rice.krad.web.form.UifFormBase;
021import org.springframework.stereotype.Controller;
022import org.springframework.validation.BindingResult;
023import org.springframework.web.bind.annotation.ModelAttribute;
024import org.springframework.web.bind.annotation.RequestMapping;
025import org.springframework.web.bind.annotation.RequestMethod;
026import org.springframework.web.servlet.ModelAndView;
027
028import javax.servlet.http.HttpServletRequest;
029import javax.servlet.http.HttpServletResponse;
030
031/**
032 * Created with IntelliJ IDEA.
033 * User: Brian
034 * Date: 10/3/12
035 * Time: 10:58 AM
036 * To change this template use File | Settings | File Templates.
037 */
038@Controller
039@RequestMapping(value = "/collegeapp")
040public class TrainingApplicationController extends UifControllerBase {
041
042    @Override
043    protected UifFormBase createInitialForm() {
044        return new TrainingApplicationForm();
045    }
046
047    @RequestMapping(method = RequestMethod.POST, params = "methodToCall=submit")
048    public ModelAndView submit(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
049            HttpServletRequest request, HttpServletResponse response) {
050        //set View to readOnly
051        uifForm.getView().setReadOnly(true);
052        //Put a message in the MessageMap to display on the page
053        GlobalVariables.getMessageMap().putInfo("Training-CollegeApplicationPage", "message.route.successful");
054
055        return getModelAndView(uifForm);
056    }
057}