1 16 17 package org.springframework.web.servlet.view.velocity; 18 19 import org.springframework.web.servlet.view.AbstractUrlBasedView; 20 21 35 public class VelocityLayoutViewResolver extends VelocityViewResolver { 36 37 private String layoutUrl; 38 39 private String layoutKey; 40 41 private String screenContentKey; 42 43 44 48 protected Class requiredViewClass() { 49 return VelocityLayoutView.class; 50 } 51 52 58 public void setLayoutUrl(String layoutUrl) { 59 this.layoutUrl = layoutUrl; 60 } 61 62 73 public void setLayoutKey(String layoutKey) { 74 this.layoutKey = layoutKey; 75 } 76 77 86 public void setScreenContentKey(String screenContentKey) { 87 this.screenContentKey = screenContentKey; 88 } 89 90 91 protected AbstractUrlBasedView buildView(String viewName) throws Exception { 92 VelocityLayoutView view = (VelocityLayoutView) super.buildView(viewName); 93 if (this.layoutUrl != null) { 95 view.setLayoutUrl(this.layoutUrl); 96 } 97 if (this.layoutKey != null) { 98 view.setLayoutKey(this.layoutKey); 99 } 100 if (this.screenContentKey != null) { 101 view.setScreenContentKey(this.screenContentKey); 102 } 103 return view; 104 } 105 106 } 107 | Popular Tags |