1 10 package org.mmbase.bridge.jsp.taglib; 11 12 import java.io.IOException ; 13 14 import javax.servlet.jsp.JspTagException ; 15 import javax.servlet.jsp.tagext.BodyTag ; 16 17 import org.mmbase.bridge.jsp.taglib.util.Attribute; 18 import org.mmbase.bridge.Node; 19 20 26 public class RelatedNodeTag extends AbstractNodeProviderTag implements BodyTag { 27 28 private Attribute listRelationsId = Attribute.NULL; 29 30 public void setListrelations(String l) throws JspTagException { 31 listRelationsId = getAttribute(l); 32 } 33 34 public int doStartTag() throws JspTagException { 35 ListRelationsTag lr = (ListRelationsTag) findParentTag(ListRelationsTag.class, (String ) listRelationsId.getValue(this)); 37 38 39 Node node = lr.getRelatedNode(); 40 setNodeVar(node); 41 FormatterTag f = (FormatterTag) findParentTag(FormatterTag.class, null, false); 43 if (f!= null && f.wantXML() && node != null) { 44 f.getGenerator().add(node); 45 f.setCloud(node.getCloud()); 46 } 47 fillVars(); 48 return EVAL_BODY_BUFFERED; 49 } 50 51 public void doInitBody() throws JspTagException { 52 } 53 54 57 public int doAfterBody() throws JspTagException { 58 super.doAfterBody(); 59 if (bodyContent != null) { 60 try { 61 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 62 } catch (IOException ioe){ 63 throw new TaglibException(ioe); 64 } 65 } 66 return SKIP_BODY; 67 } 68 69 } 70 | Popular Tags |