1 10 package org.mmbase.bridge.jsp.taglib; 11 import org.mmbase.bridge.jsp.taglib.util.Attribute; 12 import javax.servlet.jsp.JspTagException ; 13 import javax.servlet.jsp.JspException ; 14 15 22 23 public class InfoTag extends CloudReferrerTag implements Writer { 24 25 private Attribute nodeManager = Attribute.NULL; 26 private Attribute module = Attribute.NULL; 27 private Attribute command = Attribute.NULL; 28 29 public void setNodemanager(String nm) throws JspTagException { 30 nodeManager = getAttribute(nm); 31 } 32 public void setModule(String m) throws JspTagException { 33 module = getAttribute(m); 34 } 35 public void setCommand(String c) throws JspTagException { 36 command = getAttribute(c); 37 } 38 39 public int doStartTag() throws JspTagException { 40 String result; 41 if (nodeManager != Attribute.NULL) { 42 if (module != Attribute.NULL) { 43 throw new JspTagException ("Cannot give both module and nodemanager"); 44 } 45 result = getCloudVar().getNodeManager(nodeManager.getString(this)).getInfo(command.getString(this), 46 pageContext.getRequest(), 47 pageContext.getResponse()); 48 } else if (module != Attribute.NULL) { 49 result = getCloudContext().getModule(module.getString(this)).getInfo(command.getString(this), 50 pageContext.getRequest(), 51 pageContext.getResponse()); 52 } else { 53 throw new JspTagException ("Must give module or nodemanager"); 54 } 55 56 57 helper.setValue(result); 58 if (getId() != null) { 59 getContextProvider().getContextContainer().register(getId(), helper.getValue()); 60 } 61 return EVAL_BODY_BUFFERED; 62 } 63 64 65 public int doAfterBody() throws JspException { 66 return helper.doAfterBody(); 67 } 68 69 70 73 public int doEndTag() throws JspTagException { 74 helper.doEndTag(); 75 return super.doEndTag(); 76 77 } 78 79 } 80 | Popular Tags |