[cf8]custom tag outputs generatedContent twice

my custom tag is outputting the generatedContent twice. but
not anything in the tag, just what was between the calling tags.
It runs the tag once, but before it outputs the stuff in the
end portion, it outputs just what was between the calling tags.
Im working in cf8 developer on my local
If I do this:
<cfelseif thistag.executionmode is "end">
<cfset thisTag.content = thisTag.generatedContent>
<cfset thisTag.generatedContent = "">
it seems to work, but is that a good work around? This never
happened in mx7

That is documented behavior of a custom tag. The code is run
once at
the opening of the tag "<cf_marketingcolumn>" and once
at the closing of
the tag "</cf_marketingcolumn>".
That is the purpose of the thistag.executionmode property. It
allows
you to designate when a given piece of the custom tag should
be run.
The code you have outside your if block is going to be run
both times
the custom tag is called.
This is throughly explained with examples in the
documentation. If you
do not have one the internet does.
[Stolen from I forget who without permission]

Similar Messages

  • Assign custom tag output to variable. Is it possible?

    I form the code of page like this:
    <body onLoad="... #myArray[XXX]# ...">
    <cfoutput>#printTable(...)#</cfoutput>
    </body>
    function printTable is something like iterate process of
    creating tree-menu structure:
    <cffunction name="printTable" ...>
    <cfloop....>
    ArrayAppend(myArray, ....)
    <cfoutput><CF_treeItem....></cfoutput>
    printTable(....)
    </cfloop>
    </cffunction>
    SO - the problem is that I need myArray elements, but they're
    created inside printTable function.
    I could save everything into the variable and output later,
    like <cfset printTableVar = printTable(....)>, but I use
    custom tags
    What should I do not to change the things too much?
    It would be good if I could assign custom tag result to
    variable:
    <cfset blablabla = "<....>" &
    <CF_treeitem...> ....
    Ok, i will do it via external variable
    (Caller.blablabla)

    Obviously the correct solution is to re-write it properly,
    but for your question of putting the CT results into a variable,
    you just need to use
    cfsavecontent.

  • How to get custom tag output rewritten for netui tags?

    I have a custom tag that outputs <netui:button> elements but these need to be reprocessed
    into valid html prior to display. For example, in the JSP a netui:button becomes:
    <input type="submit" name="portlet_3_3actionOverride:ChangeMonth" value="Current"/>
    but from the taglib it remains the following in the html:
    <netui:button type="submit" value="Current" action="ChangeMonth"/>
    Is there a simple way to get the preprocessor to reevaluate the taglib output?

    No, there's no practical way to do that. For now, you might consider building a
    small ".jspf" (JSP fragment) that gets included at run time, to encapsulate what
    you're trying to do.
    When JSP 2.0 comes along (in the unseeable future, for WLS), you'd probably be
    able to write a "tag file" that encapsulated the logic you're trying to write.
    "Mike" <[email protected]> wrote:
    >
    I have a custom tag that outputs <netui:button> elements but these need
    to be reprocessed
    into valid html prior to display. For example, in the JSP a netui:button
    becomes:
    <input type="submit" name="portlet_3_3actionOverride:ChangeMonth" value="Current"/>
    but from the taglib it remains the following in the html:
    <netui:button type="submit" value="Current" action="ChangeMonth"/>
    Is there a simple way to get the preprocessor to reevaluate the taglib
    output?

  • How can I evaluate custom tag in custom tag output.

    Hi,
              I have a custom tag which returns the following String
              <html>
              Hello there <util:getName/>
              </html>
              Currently the <util:getName/> just prints to the html page. What I
              want is for that tag to be evaluated. Can this be done?
              So in my first jsp, I have the following:
              <cache:getHtml/>
              This cache:getHtml is the tag above that returns the chunk of html.
              The reason that I want this done is that the html is created by an
              xslt transformation but I cache the result of this transformation but
              I need the result to contain some dynamic data so if I could get the
              custom tag to work that would be ideal.
              Thanks in advance,
              IH
              

              >outputs another custom tag, which I store in a page-scope bean
              Send us your JSP code to [email protected] otherwise it not so easy to understand
              "Hrishi Dixit" <[email protected]> wrote:
              >
              >
              >For the record, the eval tag does NOT do this... not even close. I need
              >to do
              >exactly this - I have a custom tag that outputs another custom tag, which
              >I store
              >in a page-scope bean, and then try to get the eval tag to evaluate it,
              >but it
              >simply renders it as it. I think all the eval tag can do is evaluate
              >SCRIPTLET
              >code, it cannot actually process custom tags.
              >
              >..Hrishi
              >
              >"Dmitry Namiot" <[email protected]> wrote:
              >>
              >>See eval tag in Coldtags suite:
              >>http://www.servletsuite.com/jsp.htm
              >>
              >>
              >>[email protected] (IH) wrote:
              >>>Hi,
              >>>
              >>>
              >>>I have a custom tag which returns the following String
              >>>
              >>><html>
              >>>Hello there <util:getName/>
              >>></html>
              >>>
              >>>Currently the <util:getName/> just prints to the html page. What I
              >>>want is for that tag to be evaluated. Can this be done?
              >>>
              >>>So in my first jsp, I have the following:
              >>>
              >>><cache:getHtml/>
              >>>
              >>>This cache:getHtml is the tag above that returns the chunk of html.
              >>
              >>>
              >>>The reason that I want this done is that the html is created by an
              >>>xslt transformation but I cache the result of this transformation but
              >>>I need the result to contain some dynamic data so if I could get the
              >>>custom tag to work that would be ideal.
              >>>
              >>>
              >>>Thanks in advance,
              >>>
              >>>IH
              >>
              >
              

  • Custom Tag output not being rendered in JSF

    Hello,
    I have the following for loop in a custom tag that I developed;
    out.println("<ul>");
    for (int i = 0; i < noOfDays; i++)
    //out.println("<li><h:commandLink value=\"" +DateHelper.addDays(dtToday, i)+ "\" action=\"#{BookingBean.showAvailability}\"/></li>");
    out.println("<li><a href=\"" +DateHelper.addDays(dtToday, i)+ "\">" DateHelper.addDays(dtToday, i) "</a></li>");
    out.println("</ul>");
    The issue I have is that the second line prints out fine whereas the first one (when uncommented) prints out the bullet points associated with a list but does not render the h:commandLink.
    Any thoughts would be great.
    Cheers,
    Rich

    Hi,
    You can not embade a JSF tag in your code as you did, try adding component as children to your custum tag
    see this code as exemple : [HTMLDataTable.java|http://www.docjar.com/html/api/org/apache/myfaces/component/html/ext/HtmlDataTable.java.html]

  • Calling jsp custom tag from jsp expression

    hi there,
    I have a problem calling oracle(or any other) custom tag from inside a jsp expression.(i.e.)embeding <jbo:tagname...> into <%......%>.
    For example:
    I need to get the value of a jsp parameter, but the parameter name is dynamic (retrieved from a DataBase)
    So I though it would be something link that:
    <%=request.getParameter(<jbo:ShowValue datasource="ds" dataitem="ParamName" ></jbo:ShowValue>) %>
    where <jbo:ShowValue is an Oracle custom tab that retrieves the value of a certain dataItem(certain field).
    But it does not work.........
    if any body can tell me how to overcome, or work around it, I'll be so pleased.
    Regards,
    Remoun Anwar

    Hi,
    You get the custom tag output into a hidden variable (say 'key') and use the request.getParameter("key")
    Hope u got the answer...
    Regards
    ravi

  • How can a custom tag write multiple fragments in the response ?

    I have a custom tag that needs to write at least 2 html/xhtml fragments into the response in order to be html compliant. The custom tag outputs a script that must be located in the head section and other elements that refers to the script.
    Events handlers of html input elements follow this pattern. The handler may need to refer to script functions defined in the head section of the document.
    Is it possible with the custom tag architecture to handle this scenario ?

    I don't think so, unless the tag wraps the entire page, but that's harder to do. Maybe a tag could wrap the whole page and you could have another inner tag that acts as a marker of where to put things (kinda like Jakarta Commons Tiles tags).
    Otherwise, you could use 2 tags and share data put in the request scope by the header tag in the subsequent body tags.
    Or since you are writing Javascripts with the one tag, you don't strictly need to put the JS in the head. Although I'm not sure about that restriction in XHTML.

  • Custom tag lib with output parameter

    Hi,
    I need a tag libray that gives me a specific element of a Vector.
    Here there is the line I have in my jsp.
    <ct:partizione tronco="${contenitoreCentralineTronco}" indice="index" partizione="tmpPartizione"/>
    ...-contenitoreCentralineTronco is an Object that contains a Vector of other specif objects.
    -indice is the vector index of the specif instance I need.
    -partizione should be the output instance.
    This is part of my tld file:
        <tag>
             <name>partizione</name>
            <tagclass>ss.aspi.classi.centraline.grafica.tagSupport.Partizione</tagclass>
            <bodycontent>empty</bodycontent>
            <info>Estrae una partizione da un vettore di partizioni dato l'indice</info>
            <attribute>
                <name>tronco</name>
                <required>true</required>
                <rtexprvalue>true</rtexprvalue>
            </attribute>
            <attribute>
                <name>indice</name>
                <required>true</required>
            </attribute>
            <attribute>
                <name>partizione</name>
                <required>false</required>
            </attribute>
         </tag>
    ...this is part of the class called by the tag:
         private ContenitoreTroncoBean tronco;
         private Integer indice;
         private ContenitorePartizioneBean partizione;
         public int doStartTag() throws JspException {
              try {
                   Vector<ContenitorePartizioneBean> partizioni = tronco.getPartizioniBean();
                   partizione = partizioni.get(indice);
              }catch (Exception e) {
                   log.error("Errore nell'estrazione della Partizione "+indice);
                   e.printStackTrace();
              return TagSupport.SKIP_BODY;
         //All getter and setter functionsWhen I run the application I get this exception:
    jsp.error.beans.property.conversion
    looking deeper in the class code jenerated from the jsp, I noted that the problem refers to the third attribute of the tag <ct:partizione>.
    It seems It trys to set the attribute "partizione" with the value "tmpPartizione", but partizioni should be an output attribut non input. The varible tmpPartizione doesn't exist... the tag should create it.
    I realized I didn't get how I should create a tag with output parameters.
    Anyone can explane me it?
    Thanks.

    One suggestion: Take a closer look at the EL (expression language)
    It has an excellent syntax for accessing collections/maps
    ${contenitoreCentralineTronco[index]} would exactly what you want, without having to write a custom tag for it.
    If you REALLY want to do this as a custom tag, then you need to treat the input attribute as a String (the name of the variable you are going to create?) Right now your tag declares the attribute partizione as being of type ContenitorePartizioneBean which is probably the cause of the problem - you are passing it a String.
    Cheers,
    evnafets

  • Output proper special characters in JSTL custom tag

    I've written a custom JSTL Tag and want to output proper encoded special characters, like the c:out tag does (example: > to >). Do I have to parse that manually or is there a method within the jsp-api?

    Custom JSTL tag ?????Oops. Custom tag, of course.
    In custom tags, you have to manually parse it AFAIK.Somehow I can't imagine that such a frequently needed feature has do be done manually. Almost every tag that has to output data, has to convert special characters, otherwise cross-side-scripting would be possible.

  • Controlling the output of custom tags

    Hi everybody
    I'm developing some special custom tags and I have a main tag and several nested ones. I want the nested ones to put their output String into JspWriter buffer when the main tag doEndTag() happens or use the JspWriter and print a sign when each nested tag are processed and then on doEndTag() of the main tag modify the buffer and replace the signs with their actual values. But so far I havn't got anywhere.
    Because JspWriter doesn't allow manual modification of buffer and doesn't even let you to access the content of the biffer either all one can do is to print more String into the buffer!
    Any suggestion would be a great help to me.
    Thanks a lot

    Here's an example that saves up the bodies of the nested tags and prints them out when the main tag is finished.
    index.jsp
    <%@ taglib prefix="mytags" uri="/WEB-INF/mytags.tld" %>
    <html>
    <body>
    <h1>index.jsp</h1>
    <mytags:main>
      <mytags:nested>value 1</mytags:nested>
      <mytags:nested>second value</mytags:nested>
      <mytags:nested>3RD VALUE</mytags:nested>
    </mytags:main>
    </body>
    </html>mytags.tld
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
            "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>1.0</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name>mytags</short-name>
      <tag>
        <name>main</name>
        <tag-class>mytags.MainTag</tag-class>
        <body-content>JSP</body-content>
      </tag>
      <tag>
        <name>nested</name>
        <tag-class>mytags.NestedTag</tag-class>
        <body-content>JSP</body-content>
      </tag>
    </taglib>/mytags/MainTag.java
    package mytags;
    import java.io.IOException;
    import java.util.Iterator;
    import java.util.LinkedList;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class MainTag extends TagSupport
        public int doStartTag() throws JspException
         LinkedList nesteds = new LinkedList();
         pageContext.setAttribute("MainTagNesteds", nesteds);
         return EVAL_BODY_INCLUDE;
        public int doEndTag() throws JspException
         JspWriter out = pageContext.getOut();
         try {
             LinkedList nesteds = (LinkedList)pageContext.getAttribute("MainTagNesteds");     
             Iterator iterator = nesteds.iterator();
             while( iterator.hasNext() ) {
              out.println( iterator.next() + "<br>" );
         catch(IOException exc) {
             exc.printStackTrace();
         return EVAL_PAGE;
    }/mytags/NestedTag.java
    package mytags;
    import java.util.LinkedList;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class NestedTag extends BodyTagSupport
        public int doAfterBody() throws JspException
         BodyContent bc = getBodyContent();
         String bodyAsString = bc.getString();
         LinkedList nesteds = (LinkedList)pageContext.getAttribute("MainTagNesteds");
         nesteds.add( bodyAsString );
         return SKIP_BODY;
       

  • Custom Tag Paths in CF8

    Hi
    In CF8 it's not possible to use unc path for "Custom Tag
    Paths"? In CF7 this
    work! New feature? bug? possible workarounds?
    Thanks,
    Allan

    Mark Mongeau wrote:
    > I have serveral CF servers running. Is it possible to
    map to custom tags on one
    > server from another server without a share between the
    servers?
    > Or even with shared drives?
    > What are the security issues if you create a share?
    > Thanks
    > Mark
    >
    It would be possible but both servers would have to be able
    to read a
    common network/file location. Either a shared drive on one CF
    server or
    the other or a common directory on a file server that both cf
    servers
    can read. For any of this to work one or both of the cf
    servers will
    have to be configured to run under a user (localsystem by
    default on a
    windows box) that has the required permissions to read the
    desired
    remote resource.
    Once the required permissions are granted, one just needs to
    put the
    UNC/Mapped drive path to the shared custom tag directory in
    the
    appropriate server setting.
    The risk is the same with granting any user permission to a
    common file
    location. They have the granted permissions to do what they
    are allowed
    to do at that location. With intelligent consideration of
    what
    permissions to give the user designated to run CF under this
    can be
    easily mitigated to a low risk issue. Don't use an
    administrator/super
    user account that can do anything anywhere. Create a CF user
    and only
    give it the required permissions to do what you need CF to
    do.

  • How to output a jbo tag from a Custom tag

    Someone else asked a similar question recently but I didn't see the answer.
    I have a custom tag and would like to output a jbo:UrlEvent tag. But the UrlEvent tag is not evaluated - it is treated as straight text.
    Is their a reasonable solution to this problem?
    Thanks,
    Steve

    Get an IntelMac and a Blu-ray burner, install Adobe Encore or Toast 10 Pro.
    -DH
    Message was edited by: David Harbsmeier

  • Custom Tag -- Custom Component problems with iframes

    I have a "project" component that originally iterated over a list of models and created/renderered the corresponding (and fairly complex) interactive UI components for those models. On the client-side, the output from these were then organized neatly into "tabs" via CSS ... all on one page. Since these UI Components are so hefty, when any iteraction was done on one of them, the whole page had to re-render and things got just plain slow. To get around this limitation, I decided to have my "project" component no longer create the UI components himself, but instead generate an IFRAME that points to a page that will generate a single component. This way, any iteraction will just cause that single IFRAME to refresh.
    Due to the fact that an IFRAME can only be populated by using the src attribute, I have created a page that contains a JSF View (<faces:view>) and inside is a single custom tag of mine (<mine:displayView>). Let's call this page singleDisplayView.jsf. I create iframes that point to singleDisplayView.jsf with different request params for each (singleDisplayView.jsf?modelName=Foo, singleDisplayView.jsf?modelName=Bar, etc.)
    The displayView tag has one attribute called requestQueryString and I use the tag like so:
    <t:displayView requestQueryString="<%=request.getQueryString()%>" />The displayView tag's class is DisplayViewTag. In DisplayViewTag::setProperties(UIComponent uiComponent) method, I get the model name out of the request map and set this property on the UIComponent.
    The problem is that I'm noticing that as the main page (that contains these frames) loads, setProperties() is only being called twice. After that, the components created by subsequent iframes just seem to be using the modelName from the second frame.
    Is there a syncronization issue I don't understand?
    Any ideas?
    Any help would be much appreciated.
    Thanks in advance,
    Mark

    On a possibly related note, I read this in an article of the JSF application lifecycle:
    In the first phase of the JSF lifecycle -- restore view -- a request comes
    through the FacesServlet controller. The controller examines the request and
    extracts the view ID, which is determined by the name of the JSP page.Could it be that the lifecycle is trying to reuse components from a single view, since all these iframes are pointing to the same page?

  • Re: Using ScopeCache custom tag

    Hi, I am quite new to ColdFusion and I have a calendar that
    is quite slow due to the cfloops it uses to build the calendar. As
    the page does not change very often I wanted to use Raymond
    Camden's ScopeCache custom tag. However, for some reason the custom
    tag was not getting picked up from the custom tag folder on the
    server. I have successfully used components so have tried to
    convert the custom tag to a component but get the following error
    message:
    Routines cannot be declared more than once.
    The routine scope_Cache has been declared twice in the same
    file.
    This is the component:
    <!---
    Name : scopeCache
    Author : Raymond Camden ([email protected])
    Created : December 12, 2002
    Last Updated : November 6, 2003
    History : Allow for clearAll (rkc 11/6/03)
    : Added dependancies, timeout, other misc changes (rkc
    1/8/04)
    Purpose : Allows you to cache content in various scopes.
    Documentation:
    This tag allows you to cache content and data in various RAM
    based scopes.
    The tag takes the following attributes:
    name/cachename: The name of the data. (required)
    scope: The scope where cached data will reside. Must be
    either session,
    application, or server. (required)
    timeout: When the cache will timeout. By default, the year
    3999 (i.e., never).
    Value must be either a date/time stamp or a number
    representing the
    number of seconds until the timeout is reached. (optional)
    dependancies: This allows you to mark other cache items as
    dependant on this item.
    When this item is cleared or timesout, any child will also
    be cleared.
    Also, any children of those children will also be cleared.
    (optional)
    clear: If passed and if true, will clear out the cached
    item. Note that
    this option will NOT recreate the cache. In other words, the
    rest of
    the tag isn't run (well, mostly, but don't worry).
    clearAll: Removes all data from this scope. Exits the tag
    immidiately.
    disabled: Allows for a quick exit out of the tag. How would
    this be used? You can
    imagine using disabled="#request.disabled#" to allow for a
    quick way to
    turn on/off caching for the entire site. Of course, all
    calls to the tag
    would have to use the same value.
    License : Use this as you will. If you enjoy it and it helps
    your application,
    consider sending me something from my Amazon wish list:
    http://www.amazon.com/o/registry/2TCL1D08EZEYE
    --->
    <cfcomponent>
    <cffunction name="scope_Cache" access="public"
    returntype="string">
    <cfargument name="cachename" type="string"
    required="yes">
    <cfargument name="scope" type="string" required="yes">
    <cfargument name="timeout" type="string"
    required="yes">
    <cfprocessingdirective pageencoding="utf-8">
    <!--- allow for quick exit
    <cfif isDefined("arguments.disabled") and
    arguments.disabled>
    <cfexit method="exitTemplate">
    </cfif>
    <!--- Allow for cachename in case we use cfmodule --->
    <cfif isDefined("arguments.cachename")>
    <cfset arguments.name = arguments.cachename>
    </cfif>--->
    <!--- Attribute validation --->
    <cfif (not isDefined("arguments.name") or not
    isSimpleValue(arguments.name)) and not
    isDefined("arguments.clearall")>
    <cfthrow message="scopeCache: The name attribute must be
    passed as a string.">
    </cfif>
    <cfif not isDefined("arguments.scope") or not
    isSimpleValue(arguments.scope) or not
    listFindNoCase("application,session,server",arguments.scope)>
    <cfthrow message="scopeCache: The scope attribute must be
    passed as one of: application, session, or server.">
    </cfif>
    <!--- The default timeout is no timeout, so we use the
    year 3999. --->
    <cfparam name="arguments.timeout"
    default="#createDate(3999,1,1)#">
    <!--- Default dependancy list --->
    <cfparam name="arguments.dependancies" default=""
    type="string">
    <cfif not isDate(arguments.timeout) and (not
    isNumeric(arguments.timeout) or arguments.timeout lte 0)>
    <cfthrow message="scopeCache: The timeout attribute must
    be either a date/time or a number greather zero.">
    <cfelseif isNumeric(arguments.timeout)>
    <!--- convert seconds to a time --->
    <cfset arguments.timeout =
    dateAdd("s",arguments.timeout,now())>
    </cfif>
    <!--- create pointer to scope --->
    <cfset ptr = structGet(arguments.scope)>
    <!--- init cache root --->
    <cfif not structKeyExists(ptr,"scopeCache")>
    <cfset ptr["scopeCache"] = structNew()>
    </cfif>
    <cfif isDefined("arguments.clearAll")>
    <cfset structClear(ptr["scopeCache"])>
    <cfexit method="exitTag">
    </cfif>
    <!--- This variable will store all the guys we need to
    update --->
    <cfset cleanup = "">
    <!--- This variable determines if we run the caching.
    This is used when we clear a cache --->
    <cfset dontRun = false>
    <cfif isDefined("arguments.clear") and arguments.clear
    and structKeyExists(ptr.scopeCache,arguments.name) and
    thisTag.executionMode is "start">
    <cfif
    structKeyExists(ptr.scopeCache[arguments.name],"dependancies")>
    <cfset cleanup =
    ptr.scopeCache[arguments.name].dependancies>
    </cfif>
    <cfset structDelete(ptr.scopeCache,arguments.name)>
    <cfset dontRun = true>
    </cfif>
    <cfif not dontRun>
    <cfif thisTag.executionMode is "start">
    <!--- determine if we have the info in cache already
    --->
    <cfif structKeyExists(ptr.scopeCache,arguments.name)>
    <cfif
    dateCompare(now(),ptr.scopeCache[arguments.name].timeout) is -1>
    <cfif not isDefined("arguments.r_Data")>
    <cfoutput>#ptr.scopeCache[arguments.name].value#</cfoutput>
    <cfelse>
    <cfset caller[arguments.r_Data] =
    ptr.scopeCache[arguments.name].value>
    </cfif>
    <cfexit>
    </cfif>
    </cfif>
    <cfelse>
    <!--- It is possible I'm here because I'm refreshing. If
    so, check my dependancies --->
    <cfif structKeyExists(ptr.scopeCache,arguments.name) and
    structKeyExists(ptr.scopeCache[arguments.name],"dependancies")>
    <cfif
    structKeyExists(ptr.scopeCache[arguments.name],"dependancies")>
    <cfset cleanup = listAppend(cleanup,
    ptr.scopeCache[arguments.name].dependancies)>
    </cfif>
    </cfif>
    <cfset ptr.scopeCache[arguments.name] = structNew()>
    <cfif not isDefined("arguments.data")>
    <cfset ptr.scopeCache[arguments.name].value =
    thistag.generatedcontent>
    <cfelse>
    <cfset ptr.scopeCache[arguments.name].value =
    arguments.data>
    </cfif>
    <cfset ptr.scopeCache[arguments.name].timeout =
    arguments.timeout>
    <cfset ptr.scopeCache[arguments.name].dependancies =
    arguments.dependancies>
    <cfif isDefined("arguments.r_Data")>
    <cfset caller[arguments.r_Data] =
    ptr.scopeCache[arguments.name].value>
    </cfif>
    </cfif>
    </cfif>
    <!--- Do I need to clean up? --->
    <cfset z = 1>
    <cfloop condition="listLen(cleanup)">
    <cfset z = z+1><cfif z gt 100><cfthrow
    message="ack"></cfif>
    <cfset toKill = listFirst(cleanup)>
    <cfset cleanUp = listRest(cleanup)>
    <cfif structKeyExists(ptr.scopeCache, toKill)>
    <cfloop index="item"
    list="#ptr.scopeCache[toKill].dependancies#">
    <cfif not listFindNoCase(cleanup, item)>
    <cfset cleanup = listAppend(cleanup, item)>
    </cfif>
    </cfloop>
    <cfset structDelete(ptr.scopeCache,toKill)>
    </cfif>
    </cfloop>
    <cfreturn scope_Cache>
    </cffunction>
    </cfcomponent>

    Hi, thanks to both of you for your help. I reverted back the
    custom tag and it was picked up this time - I don't know what
    happened before. The functionality works as expected but I have hit
    another problem and I am hoping I can tap your combined ColdFusion
    wisdom to solve!!
    The calendar returns leave records for staff and filters the
    records using a querystring variable appended when the user clicks
    on a particular month. However, what members of staff the user sees
    depends on the data held in the users' session variables based on
    their authority. The reason I wanted to use caching is because the
    page takes a good ten seconds to run because of the use of cfloops
    for the members of staff and the days of the week to dynamically
    build the page. Using the custom tag would have worked if all
    members of staff saw the same calendar data and could only see one
    month. Can you see anyway I can speed up the page and do you think
    caching is the way forward here?

  • Confusing execution sequence in Custom tag

    I have a custom tag file with the name make_red.cfm that
    makes a text passed to it to the color red.
    The calling code looks like this:
    Main page<br>
    <cf_make_red result="myVar">
    Dont mess with the Zohan!!!
    </cf_make_red>
    back to the main page<br>
    The code in make_red.cfm looks something like this:
    <cfoutput>
    <hr>
    ThisTag.ExecutionMode is #ThisTag.ExecutionMode#<br>
    ThisTag.GeneratedContent is
    #ThisTag.GeneratedContent#<br>
    <hr>
    <cfif ThisTag.ExecutionMode IS "Start">
    Tag start<br>
    <cfif structkeyexists(attributes,"result")>
    <cfset evaluate("caller.#attributes.result# =
    ""CUSTOM_TAG_COMPLETED""")>
    </cfif>
    Tag processing<br>
    <cfelseif ThisTag.ExecutionMode IS "End">
    Tag processed<br>
    <cfset ThisTag.GeneratedContent = "<font
    color=""red"">"&ThisTag.GeneratedContent&"</font><br>">
    The tag ends here<br>
    </cfif>
    </cfoutput>
    The output looks like this:
    Main page
    ThisTag.ExecutionMode is start
    ThisTag.GeneratedContent is
    Tag start
    Tag processing
    Dont mess with the Zohan!!!
    ThisTag.ExecutionMode is end
    ThisTag.GeneratedContent is Dont mess with the Zohan!!!
    Tag processed
    The tag ends here
    back to main page
    My question is this:
    As per the sequence of the statements in the custom tag code,
    the text that appears in the beginning of tag file will be printed
    after which the processing for the end tag happens in the
    <cfif>. The text passed between the <cf_make_red> and
    </cf_make_red> i.e. "Dont mess with the Zohan!!!" appears to
    be printing before the end tag executes.
    Shouldnt the text passed between the <cf_make_red> and
    </cf_make_red> come after the end tag is processed? Because
    thats where i am making the text red.
    Could someone please explain this?

    Doing a little more experimentation, I discovered that pageContext is null in the constructor, but not null in the otherDoStartTagOperations() method (called by the doStartTag() method of the tag's class... it's something Forte forces you to do).
    Is this normal? I was under the impression that pageContext is supposed to be defined EVERYWHERE in any class that extends BodyTagSupport... including the class' own constructor.
    On a related topic, is there documentation somewhere as to what, exactly, Forte is doing behind the scenes when it's managing a taglib (how it keeps track of them, where it puts config files, how the entries it makes in them are different or extended from the normal layout, etc.)? At the moment, I suspect that half of the grief I'm having with writing taglibs is caused by Forte itself forcing me to do things in a roundabout way that bears little resemblance to the ways shown in different books on the topic (and in fact all but ensures that nearly every published example will fail and require major rewriting because of the way it forces tag classes to be structured), but I don't see any easy way to let Forte handle compiling the classes and testing them with its embedded Tomcat, but do the config file housekeeping myself I can be in control of it.

Maybe you are looking for