1 5 6 package org.infohazard.maverick.view; 7 8 import java.io.IOException ; 9 import java.util.Iterator ; 10 import java.util.Map ; 11 12 import javax.servlet.ServletException ; 13 14 import org.apache.commons.logging.Log; 15 import org.apache.commons.logging.LogFactory; 16 import org.infohazard.maverick.flow.View; 17 import org.infohazard.maverick.flow.ViewContext; 18 19 43 public abstract class DocumentView implements View 44 { 45 private static Log log = LogFactory.getLog(DocumentView.class); 46 47 52 protected String beanName; 53 54 61 public DocumentView(String beanName) 62 { 63 this.beanName = beanName; 64 } 65 66 77 public void go(ViewContext vctx) throws IOException , ServletException 78 { 79 if (vctx.getModel() != null) 81 this.setAttribute(vctx); 82 83 if (vctx.getViewParams() != null) 85 { 86 if (log.isDebugEnabled()) 87 log.debug("Setting " + vctx.getViewParams().size() + " params"); 88 89 Iterator entryIt = vctx.getViewParams().entrySet().iterator(); 90 while (entryIt.hasNext()) 91 { 92 Map.Entry entry = (Map.Entry )entryIt.next(); 93 vctx.getRequest().setAttribute((String )entry.getKey(), entry.getValue()); 94 } 95 } 96 vctx.getNextStep().go(""); 97 } 98 99 112 protected abstract void setAttribute(ViewContext vctx); 113 } | Popular Tags |