View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.sampleu.demo.kitchensink;
17  
18  import org.kuali.rice.krad.util.GlobalVariables;
19  import org.kuali.rice.krad.web.controller.UifControllerBase;
20  import org.kuali.rice.krad.web.form.UifFormBase;
21  import org.springframework.stereotype.Controller;
22  import org.springframework.validation.BindingResult;
23  import org.springframework.web.bind.annotation.ModelAttribute;
24  import org.springframework.web.bind.annotation.RequestMapping;
25  import org.springframework.web.bind.annotation.RequestMethod;
26  import org.springframework.web.servlet.ModelAndView;
27  
28  import javax.servlet.http.HttpServletRequest;
29  import javax.servlet.http.HttpServletResponse;
30  
31  /**
32   * Created with IntelliJ IDEA.
33   * User: Brian
34   * Date: 10/3/12
35   * Time: 10:58 AM
36   * To change this template use File | Settings | File Templates.
37   */
38  @Controller
39  @RequestMapping(value = "/collegeapp")
40  public class TrainingApplicationController extends UifControllerBase {
41  
42      @Override
43      protected UifFormBase createInitialForm(HttpServletRequest request) {
44          return new TrainingApplicationForm();
45      }
46  
47      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=submit")
48      public ModelAndView submit(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
49              HttpServletRequest request, HttpServletResponse response) {
50          //set View to readOnly
51          uifForm.getView().setReadOnly(true);
52          //Put a message in the MessageMap to display on the page
53          GlobalVariables.getMessageMap().putInfo("Training-CollegeApplicationPage", "message.route.successful");
54  
55          return getUIFModelAndView(uifForm);
56      }
57  }