KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > applications > community > taglib > SetInfoTag


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.applications.community.taglib;
11
12 import javax.servlet.jsp.JspTagException JavaDoc;
13
14 import org.mmbase.bridge.Node;
15 import org.mmbase.bridge.Module;
16
17 import org.mmbase.bridge.jsp.taglib.*;
18
19 /**
20  * SetInfo tag stores information in the multipurpose INFO field.
21  *
22  * @author Pierre van Rooden
23  * @version $Id: SetInfoTag.java,v 1.10 2005/01/30 16:46:35 nico Exp $
24  */

25  
26 public class SetInfoTag extends NodeReferrerTag {
27
28     protected Node node;
29     private String JavaDoc key=null;
30
31     public void setKey(String JavaDoc k) throws JspTagException JavaDoc {
32         key = getAttributeValue(k);
33     }
34
35     public int doStartTag() throws JspTagException JavaDoc{
36         // firstly, search the node:
37
node = getNode();
38
39         if (key == null) { // name not null
40
throw new JspTagException JavaDoc ("Should use 'key' attribute");
41         }
42         return EVAL_BODY_BUFFERED;
43     }
44
45     /**
46      * store the given value
47      * @see javax.servlet.jsp.tagext.IterationTag#doAfterBody()
48      **/

49     public int doAfterBody() throws JspTagException JavaDoc {
50         String JavaDoc value=bodyContent.getString();
51         Module community=getCloudContext().getModule("communityprc");
52         community.getInfo("MESSAGE-"+node.getNumber()+"-SETINFOFIELD-"+key+"-"+value,pageContext.getRequest(),pageContext.getResponse());
53         return SKIP_BODY;
54     }
55 }
56
Popular Tags