1 24 package org.riotfamily.common.web.controller; 25 26 import javax.servlet.http.HttpServletRequest ; 27 import javax.servlet.http.HttpServletResponse ; 28 29 import org.springframework.util.Assert; 30 import org.springframework.web.servlet.ModelAndView; 31 import org.springframework.web.servlet.mvc.Controller; 32 33 38 public class AttributeRendererController implements Controller { 39 40 private String attributeName; 41 42 public void setAttributeName(String attributeName) { 43 this.attributeName = attributeName; 44 } 45 46 public ModelAndView handleRequest(HttpServletRequest request, 47 HttpServletResponse response) throws Exception { 48 49 Assert.notNull(attributeName, "Attribute Name must be specified"); 50 response.getWriter().print(request.getAttribute(attributeName)); 51 return null; 52 } 53 } 54 | Popular Tags |