title: Grails taglib resetting the properties
body: <p>I have the following problem. I've created a TagLibrary which lists the given collection if data as follows</p>
  
  <pre><code>    class LisTagLib {
  
          static final CONTEXT = this.class.name
          /**
           * Current data from collection
           */
          def currentData;
          String columnHeaders = "";
          List writtenHeaders = [];
  
          // draw main table
          Closure listTable = { attrs, body -&gt;
  
              def writer = getOut()
  
              writer &lt;&lt; "&lt;table&gt;";
              writer &lt;&lt; "&lt;thead&gt;"
              writer &lt;&lt; "&lt;tr&gt;"
              writer &lt;&lt; columnHeaders
              writer &lt;&lt; "&lt;/tr&gt;"
              writer &lt;&lt; "&lt;/thead&gt;"
              writer &lt;&lt; "&lt;tbody&gt;"
  
              if(attrs.source){
                  attrs.source.each() { value -&gt;
                      writer &lt;&lt; "&lt;tr&gt;";
                      writer &lt;&lt; body()
                      writer &lt;&lt; "&lt;/tr&gt;";
                  }
              }
  
              // output the body
              writer &lt;&lt; "&lt;/tbody&gt;";
              writer &lt;&lt; "&lt;/table&gt;";
          } 
  .
  .
  .
  }
  </code></pre>
  
  <p>My problem is "columnHeaders" property is not created each time I call this taglib. If I call this as  in page X and then in page Y, page Y also has the headers as "headers shown in page X + headers shown in Page Y". I tried constructor but this class is constructed only once at compile time. What is the solution for this. How can I reset these values each time I call this taglib? 
  By the way calling something like </p>
  
  <pre><code>columnHeaders = "";
  </code></pre>
  
  <p>in the begining or at the end of the listTable closure Removes the all columnHeaders and no header is printed.</p>