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.

Similar Messages

  • 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
              >>
              >
              

  • [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]

  • 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]

  • JSP Custom Tags Fragments// OUT Variables

    How are associations established between tag file fragment attributes and [OUT] variables? Is this established in a "tld" by associating an EL variable with an attribute element? I've been reading the tutorial, though I can't seem to resolve this. Thanks.

    I'm not sure what you mean by out variables.

  • 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

  • Applescript for custom tags

    hi there,
    has anyone had any experience with applescript and custom tags? i've gotten so far as to display the name of custom tags i've added, but i want to find a way to batch erase some i've added on several thousand pictures. any hints?
    j
    here's a snippet of the code i'm trying out. there must be some way to delete the tag, but i'm not fluent in applescript. the logic of the script has been copied off another one i've found somewhere on the net. the author is Steven Banick (http://banick.com)
    repeat with countOfPhotos from 1 to the count of selectedPhotos
    -- Get the photo's properties for the operation
    set currentPhoto to item countOfPhotos of selectedPhotos
    tell currentPhoto
    -- Reset the variables in the loop
    set the photoCustomTags to ""
    -- Retrieve the Photo Metadata
    set the photoCustomTags to the name of custom tags
    -- Scan the individual custom Tags from the assigned Custom tags
    repeat with currentcustomTag from 1 to count of photoCustomTags
    set currentcustomTag to item currentcustomTag of photoCustomTags
    -- ver quais são as custom tags e tentar apagá-las
    if currentcustomTag = CustomTagName1 then
    -- display dialog currentcustomTag
    delete the item currentcustomTag

    I'm not sure if you can delete tags, but you can certainly empty them:
    tell application "Aperture"
    set selectedImages to the selection
    repeat with i from 1 to number of items in selectedImages
    set this_item to item i of selectedImages
    try
    set value of custom tag "Image ID" of this_item to ""
    end try
    end repeat
    end tell
    Just change "Image ID" to the name of your custom tag, and make sure that you only use it on the correct images...
    Ian

  • Dynamic include in a custom tag, called from a jsp

    Hello, I would like to be able to dynamically include other jsp's from within a custom tag that I create. is this possible?
    in a jsp page i would just write <%@ include file="file.jsp" %> and all would be ok... but if i do an out.println( "<%@ include file=\"file.jsp\" %>" ); inside a custom tag bean then it doesn't work. it just prints out the command to the page as plain text.
    I do understand why this is happening, but can anyone offer me a way around this problem?
    Thanks in advance,
    Randy

    That's actually the same result as you get with a normal include - The method I suggested is a dynamic include similar to the <jsp:include> tag, not the <%@ include %> tag.
    When you use a dynamic include, the included page is compiled and 'invoked' as serarately, and the result is what gets included, not the actual source. To get the behaviour you want would require an include directive (the <%@ include %> tag) which I don't think has an equivalence you can use inside a custom tag.
    What you can do is pass attributes from the tag class like this:
    pageContext.setAttribute(<name>, <object>, pageContext.REQUEST_SCOPE);
    and then remove them after the include using pageContext.removeAttribute.
    I'm not certain, but this implies that if you declare your variables with a <jsp:usebean> tag with request scope, instead of normal Java variable declarations, you should be able to use them in the page included by the custom tag.
    *** in the jsp ***
    <jsp:useBean id="myVar" scope="request" class="java.lang.String" />
    <% myVar = "Something"; %>
    // Now call the tag which uses the pageContext.include() mehtod.
    *** end ***
    *** in the include ***
    <jsp:useBean id="myVar" scope="request" class="java.lang.String" />
    <%= myVar + " something else" %>
    *** end ***
    Let me know if it works.

  • 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.

  • Query reg adding custom tags in SOAP Header - AXIS Receiver Adapter

    Hi All,
    I need to send custom tags as mentioned below to my traget webservice application. I think I can do this with Receiver AXIS adapter but not sure how it can be done. Can any of you suggest?
                                                  <WSContext>
                   <FromAppId>ABC</FromAppId>
                   <ToAppId>XYZ</ToAppId>
              </WSContext>
    Thanks,

    If you want to add custom tags in the soap header, one possible solution is use XSLT mapping or Java mapping to create header first then do message mapping for mapping the payload structure between your source and target  as usual.
    So in operation mapping you sequence mapping like this... first XSLT mapping for custom tags for the SOAP Header followed by payload mapping.
    Hope that helps.
    Search SDN for XSLT Mapping for soap header. Already we have handled these issues.

  • 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

  • Access to variable in custom tag

    I have a custom tag called sendmail and I use it like this:
    <cc:sendmail smtpServer="..." to="..." ....>
    </cc:sendmail>
    While the SendMailTag are processing the tag, it sets a boolean variable based on if the mail was sent or not. My tag extends BodyTagSupport, and everything works like it is supposed to. What I want to do now, is to allow the developer using the tag to have access to the boolean in the tag representing the status of the mail, inside the body of the tag, so he can do "this" if the mail was sent and "that" if it failed. Something like this:
    <cc:sendmail smtpServer="..." to=".." ..>
    if(status) {
    // tell the user that the message was sent
    else {
    // present an error message
    </cc:sendmail>
    Yeah, I can use the bodyContent object to output the variable value, but I want to give the jsp developer the possibility to do whatever he like, based on that boolean value.
    Anyone know how I can do this?

    Well, your sendmail tag could add the boolean value to the session scope. For example inside your sendmail tag code after you send the mail message, do this..boolean ok = sendMailRoutine();
    pageContext.setAttribute("isSent",ok,PageContext.SESSION_SCOPE);then in your jsp page after you call the send mail tag, you can get the boolean value by typing...boolean ok = (boolean)session.getAttribute("isSent");Alternativley, you can create another function in your sendmail tag library to get the isSent boolean value. Say for example you had<cc:isSent messageId="">  or whateverthen the tag code would beboolean ok = pageContext.getAttribute("isSent",PageContext.SESSION_SCOPE);This tag could then send a message back to the browser if the boolean value is false.pageContext.getOut().println("Failed to send message.");Now if your not confused... you don;t have to hard code the value "isSent". You can pass that in through your tag just like you did with the smtpServer and to IDs.
    Hope this helps.
    -S-

  • Assigning bean property to custom tag's attribute

    1. The #{beanName.property} notation can only be used inside JSF tags.
    2. The attributes of custom tags does not accept embedded tags.
    e.g. <prefix:tagName attrib1="<jsftag>">
    I need to assign a bean's property to the attrib1 attribute. how do I do this?

    Alternatively, how can I assign the value of a bean property to a variable?
    e.g.
    <%
    int var=<bean.property>
    %>
    I can use the variable on the custom tag like this:
    <prefix:tagName attrib1="<%=var%>"> OR
    But this may not be the best solution though because I have to use scriptlets...

  • Cfml-tags in string variables and outputting

    Hello,
    i'm implementing a small content-managment system in my
    web-application, based on cf-mx7.
    i have an html-editor for editing the web-content
    (FCKeditor). The content is then saved to the database.
    Now my application simpliefied loads the content from
    database and outputs it with
    <cfoutput>#mycontent#</cfoutput> where mycontent is the
    variable where the content is loaded to via cfquery-tag.
    So far so good. This works fine.
    Now i want to integrate some cfml-tags into the web-content.
    so that variabe mycontent contains html-code mixed with cfml-tags.
    but now the cfml-tags are only outputted to the browser as they are
    and are not processed by coldfusion.
    does anybody now how to implement that?
    may regards and thanks for your help
    mcdroemmel

    Hello,
    thanks for your answer.
    The reason is following:
    I show my content on a cfml web page using a
    <cfmodule>-tag, where the template-parameter identifies a
    custom-tag which gets the id of my content-object in the database.
    that tag has some additional funcitionality such a show links for
    editing the content when the actual user is the content-owner and
    show header and footers. It also loads the content, identified by
    the id of the content in the database, and outputs it using
    <cfoutput>#mycontent#</cfoutput>
    Now my intention is, that i want to use cf-tags in the
    content. with that i want to indirectly nest some
    <cfmodule>-tags. The result should be, that my content itself
    contains content-objects, but for that my first content has to
    contain that <cfmodule>tags
    i hope i could descripe to you what my intention is.
    regards
    mcdroemmel

Maybe you are looking for