1 16 17 package org.springframework.web.servlet.mvc; 18 19 import javax.servlet.http.HttpServletRequest ; 20 import javax.servlet.http.HttpServletResponse ; 21 22 import org.springframework.web.servlet.ModelAndView; 23 24 68 public class ParameterizableViewController extends AbstractController { 69 70 private String viewName; 71 72 73 76 public void setViewName(String viewName) { 77 this.viewName = viewName; 78 } 79 80 83 public String getViewName() { 84 return this.viewName; 85 } 86 87 protected void initApplicationContext() { 88 if (this.viewName == null) { 89 throw new IllegalArgumentException ("Property 'viewName' is required"); 90 } 91 } 92 93 94 98 protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) 99 throws Exception { 100 101 return new ModelAndView(getViewName()); 102 } 103 104 } 105 | Popular Tags |