Problem Calling Query in Custom Tag

I am using this code to call a custom tag called
broadcast.cfm
<cf_broadcast query="fe" orgID = "4">
The query fe is an included file on my site and is available
to the page I'm calling the custom tag from.
In the custom tag I am referencing the query like:
<cfloop query="#attributes.query#">
but I keep getting this error:
"The value of the attribute query, which is currently "fe",
is invalid. "
I must be missing something really simple here but can't
figure out what.

quote:
Originally posted by:
-==cfSearching==-
rdk8487 wrote:
> In the custom tag I am referencing the query like:
> <cfloop query="#attributes.query#">
> but I keep getting this error:
> "The value of the attribute query, which is currently
"fe", is invalid. "
It is a scoping problem. The query is defined in the calling
page. To access it by name, within the custom tag, use the "caller"
scope.
<cfloop query="caller.#attributes.nameOfTheQuery#">
If the query object is passed to the custom tag via an
attribute you shouldn't need the caller scope. See attached sample.

Similar Messages

  • Setter method not getitng called in the custom tag

    Hi,
    I have written a custom tag and I have declared an attribute in the tld file and have specified the setter method for the same in the java tag file but that setter method is not getting called...for rest of the attributes, the methods are getting called and not just for one!! any idea what could be the problem....
    Regards
    Deepak Saini

    Do you have a getter method to match that property?
    Post some example code - what does your tld define for this property, and what get/set methods have you defined for it?

  • IOException when flush is called from a custom tag

    Thanks is advance for the help. I've encountered an oddity in OC4J 10.1.3 Standalone using java 1.5 the 2.4 servlet spec and struts 1.1 and I'm wondering how to resolve it. In our current application we use custom tags to define certain fields. Every tag in our web front end does the same thing.
    <pre>
    JspWriter writer = pageContext.getOut();
    writer.print(sb.toString());
    writer.flush();
    </pre>
    I would understand if the tag was calling a commit then flush and then trying to write to the buffer again. That should raise this exception. We have tags that do the same thing without issue, But some others fail. This is the stack trace we see in the logs.
    <pre>
    WARN - SpecialReviewTag.doStartTag() IOException:
    java.io.IOException: InValid to flush BodyContent: no backing stream behind it
    at com.evermind.server.http.EvermindBodyContent.flush(EvermindBodyContent.java:213)
    at xxx.xxxx.xxxxx.xxxxxx.receiving.struts.tag.SpecialReviewTag.doStartTag(SpecialReviewTag.java:198)
    at receiving.item__receipt__items._jspService(_item__receipt__items.java:897)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
    at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:724)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:414)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    </pre>
    Here is where the oddity comes into play. The page still renders all the needed information for the user. The problem lies with this exception being flooded into our production logs.
    This is the web.xml file being used to define our .jsp configuration
    <pre>
    <jsp-property-group>
    <display-name>Ignore EL</display-name>
    <url-pattern>*.jsp</url-pattern>
    <el-ignored>true</el-ignored>
    <scripting-invalid>false</scripting-invalid>
    <is-xml>false</is-xml>
    </jsp-property-group>
    </pre>
    One other not these tags worked fine in the OC4J 10.1.2 Container this happened after the conversion to OC4J 10.1.3
    Thanks alot for the help,
    Charles
    Edited by: CharMow on Feb 11, 2009 5:14 AM

    Hi,
    I am also getting the same error, when we move to OC4J 10.1.3.
    If you find any solution for this please let me know, Thanks in advance.
    Following the stack trace..
    Can't insert page '/main.jsp' : InValid to flush BodyContent: no backing stream behind it java.io.IOException: InValid to flush BodyContent: no backing stream behind it at com.evermind.server.http.EvermindBodyContent.flush(EvermindBodyContent.java:213) at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:878) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473) at layouts.leftLayout._jspService(_leftLayout.java:126) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259) at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51) at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193) at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283) at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:320) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259) at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51) at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193) at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283) at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274) at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:254) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:309) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453) at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Unknown Source)
    Thanks,
    Jam

  • Problem in creating a custom tag

    Hi All,
    I'm new to jstl. I want to create a custom tag. I created a sample java class and sample tld file and I used this file at my page it give me an error. The java and tag file code is as follow
    package mytag;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    * This is a simple tag example to show how content is added to the
    * output stream when a tag is encountered in a JSP page.
    public class Hello extends TagSupport {
         private String name=null;
          * Getter/Setter for the attribute name as defined in the tld file
          * for this tag
    public void setName(String value){
        name = value;
         public String getName(){
              return(name);
    * doStartTag is called by the JSP container when the tag is encountered
        public int doStartTag() {
           try {
            JspWriter out = pageContext.getOut();
            out.println("<table border=\"1\">");
              if (name != null)
               out.println("<tr><td> Hello " + name + " </td></tr>");
            else
               out.println("<tr><td> Hello World </td></tr>");
           } catch (Exception ex) {
             throw new Error("All is not well in the world.");
           // Must return SKIP_BODY because we are not supporting a body for this
           // tag.
           return SKIP_BODY;
    * doEndTag is called by the JSP container when the tag is closed
         public int doEndTag(){
            return EVAL_PAGE;
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
    "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
    <taglib>
         <tlibversion>1.0</tlibversion>
         <jspversion>1.1</jspversion>
         <shortname>sample</shortname>
         <info>My sample tag</info>
      <tag>
        <name>hello</name>
        <tagclass>tag.Hello</tagclass>
        <bodycontent>empty</bodycontent>
        <info>
         This is a simple hello tag.
        </info>
      <attribute>
          <name>name</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
      </attribute>
    </tag>
    </taglib>And I use this tld file in my jsp code I got below error
    * org.apache.jasper.JasperException: /mytag.jsp(9,15) Unable to load tag handler class "tag.Hello" for tag "sample:hello"
    Help me about this problem.
    Edited by: Get2win4world on Dec 15, 2009 1:12 AM

    Your class (according to what is posted) is in the package mytag.
    So in your tld: <tagclass>tag.Hello</tagclass>should be<tagclass>mytag.Hello</tagclass>cheers,
    evnafets

  • Problem deploying and using custom Tags in jar files

    I am trying to create a custom tag library of Java classes, package them in a JAR file, and use them in another web application. Here is the JAR file structure, named mytags.jar:
    META-INF
    META-INF/manifest.mf
    META-INF/taglib.tld
    mytags/FooBar.class
    mytags/Another.class
    ...Here is the taglib.tld file:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <taglib xmlns="http://java.sun.com/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
    version="2.0">
       <tlib-version>1.0</tlib-version>
       <short-name>foo</short-name>
       <uri>fooTags</uri>
       <info>My tags</info>
       <tag>
         <name>fooBar</name>
         <tag-class>mytags.FooBar</tag-class>
         <body-content>empty</body-content>
         <attribute>
           <name>name</name>
           <required>false</required>
           <rtexprvalue>true</rtexprvalue>
         </attribute>
      </tag>
    </taglib>The FooBar class has getName(String) and setName() methods.
    In the web application, I have copied mytags.jar into the WEB-INF/lib directory. I've verified that it lands in the corresponding directory for my appserver (I'm using Tomcat 6.0.10).
    Here's the header for my JSP:
    <%@ page language="java" contentType="text/html;charset=UTF-8" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib uri="fooTags" prefix="foo" %>
    <foo:fooBar name="dummy" />
    ...When I access my page, the browser sits there and spins, not able to do anything. I know that some of the content is executed, but it is not able to get to the fooTags. I have tried replacing fooTags with WEB-INF/lib/mytags.jar, to no effect.
    According to the docs, I should not need to include anything in web.xml to reference the fooTags. The tag library classes are valid, since I used them as local tags prior to moving them into a Jar library.
    Any help would be appreciated

    Take the code of the jsp file :
    <%@ page language="java" %>
    <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
    <html>
       <head>
         <title> First Struts Application </title>
       </head>
         <body>
            <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td> </td>
            </tr>
            <tr bgcolor="#36566E">
              <td height="68" width="48%">
                <div align="left">
                  <img src="images/hht.gif" width="220" height="74">
                </div>
              </td>
            </tr>
            <tr>
             <td> </td>
            </tr>     
           </table>
           <html:form action="Lookup"
                      name="lookupForm"
                      type="wiley.LookupForm" >
           <table width="45%" border="0">
            <tr>
              <td>Symbol:</td>
              <td><html:text property="symbol" /> </td>
            </tr>
             <tr>       
              <td colspan="2" align="center"><html:submit/> </td>
             </tr>       
            </table>              
          </html:form>
         </body>
    </html>

  • Custom tag library called multiple times

    Hi ppl ,
    I have a custom tag library which i use to populate some menu components. When i do call my custom tag library though , it is called multiple times, use case is as follows.
    I have menu tabs and menu bars which thanks to Mr.Brenden is working splendidly as so:-
    <af:menuTabs>
    <af:forEach var="menuTab" items="#{bindings.menu.vwUserMenuTabRenderer.rangeSet}">
    <af:commandMenuItem text="#{menuTab.MenuLabel}"
    shortDesc="#{menuTab.MenuHint}"
    rendered="true"
    immediate="true"
    selected="#{sessionScope.selectedMenuId == menuTab.MenuId }"
    onclick="fnSetSelectedValue('#{menuTab.MenuId}')" >
    </af:commandMenuItem>
    </af:forEach>
    </af:menuTabs>
    <af:menuBar>
    <af:forEach var="menuBar" items="#{bindings.menu.vwUserMenuBarRenderer.rangeSet}">
    <af:commandMenuItem onclick="return clickreturnvalue()"
    onmouseover="dropdownmenu(this, event,#{menuBar.MenuId}, '150px')"
    onmouseout="delayhidemenu()"
    text="#{menuBar.MenuLabel}"
    action="#{menuBar.MenuUri}"
    rendered="#{menuBar.ParentId == sessionScope.selectedMenuId}"
    immediate="true" />
    </af:forEach>
    </af:menuBar>
    </afc:cache>
    now all of this code is within a subview , and just directly below the subview tag , i have the call to my custom tag library:-
    <myCustomTagLib:menuCascade />
    only issue now is that assuming i have in all 7 menu bar components, the doStartTag is called 7 times. the relevant code within my custom tag class is as follows :-
    public int doStartTag() throws JspException {
    return (EVAL_BODY_INCLUDE);
    public int doEndTag() throws JspException {
    try {
    declareVariables();
    return EVAL_PAGE;
    }catch (Exception ioe) {
    throw new JspException(ioe.getMessage());
    and within my declareVariables method i do an out of the jscript ( out.print(jscript.toString()); ) which is a simple string generated based on certain conditions...
    now it seems to be working fine on the front end , but when i view the source of the page, i notice that the declaration is called multiple times, and this happens because the doStartTag method is called multiple times, i haven't even nested the call to the custom tag within the menu components , any clue as to whats going wrong ?
    Cheers
    K

    Hi,
    if you add the following print statement
    System.out.println("rendering "+FacesContext.getCurrentInstance().getViewRoot().getViewId());
    Then the output in my case is
    07/04/24 08:14:04 rendering /BrowsePage.jsp
    07/04/24 08:14:05 rendering /otn_logo_small.gif
    The image comes from the file system, which means it is rendered by the JSF lifecycle. If you reference the image with a URL then the lifecycle doesn't render the image but only refrences it.
    To avoid your prepare render code to be executed multiple times, just check for jsp and jspx file extensions, which will guarantee that your code only executes for JSF pages, not for loaded files.
    The reason why this happens is because the JSF filter is set to /faces , which means all files that are loaded through that path
    Frank

  • Custom Tag Error with Weblogic SP9

              Hi
              I seem to be having a problem with a custom tag that I wrote. When I run the JSP
              on WLS (without a service pack), the generated java code uses the weblogic.utils.StringUtils
              class to interprete jsp expressions that are passed into the custom tag's attribute
              (on the JSP). The method called on this StringUtils class is valueOf(). This method
              in essence makes sure that the result of the expression is not null and then subsequently
              calls a toString() on the value. Note that if the value is null it simply returns
              an empty string.
              The problem is that when we go to service pack 9, this method is not called (StringUtils.valueOf()).
              Now the problem arises if first of all the result of the expression statement
              in the custom tag definintion (on the JSP) is null. Secondly, it will also error
              out when the setter method is called within the custom tag, if the object returned
              from the expression does not match the one that is expected by the tag... in our
              case a String.
              Here's a sample usage of the tag:
              <wescombop:selectTag
              selectName="buildingNumber"
              selectedItem="<%= buildingJB.getBuildingNumber()%>"
              trimSelectedItem="true"
              selectTagDataName="buildingNumberDataAttribute" />
              Note: buildingJB.getBuildingNumber() returns BigDecimal
              Here's a snipett of the line generated java:
              * Without the service pack
              comwestfieldgrp_wescom_bop_view_tag_SelectTag_1.setSelectedItem(weblogic.utils.StringUtils.valueOf(buildingJB.getBuildingNumber()));
              *With Service Pack 9
              comwestfieldgrp_wescom_bop_view_tag_SelectTag_1.setSelectedItem(buildingJB.getBuildingNumber());
              Note: The setSelectedItem() method expects a String object as a parameter, so
              the code with service pack 9 will result in a compilation error, since buildingJB.getBuildingNumber()
              returns a BigDecimal.
              Let me know if you need more explanation.
              Has anyone experience this problem before... Any help would be deeply appreciated.
              Thanks all.
              Niran
              

              Modify the <cewolf:param> tag.
              <cewolf:chart id="confchart" title="Reports" type="bar3d" yaxislabel="Time"> <cewolf:data>
              <cewolf:producer id="report"> <cewolf:param name="type" value="all" > </cewolf:param>
              </cewolf:producer> </cewolf:data> </cewolf:chart>
              "Balakrishnan" <[email protected]> wrote:
              >
              >We are using cewolf charting library in weblogic 7.0. The charting library
              >is implemented
              >as custom jsp tag library module.
              >
              >However, when the use the tag for displaying the chart, weblogic is producing
              >this compiler error.
              >
              >/reports/reportsView.jsp(108): no corresponding open tag for tag extension
              >close:
              >//[ null; Line: 108]
              >
              >Here's the corresponding source of the jsp file:
              >
              > <cewolf:chart id="confchart" title="Reports" type="bar3d" yaxislabel="Time">
              > <cewolf:data>
              > <cewolf:producer id="report">
              > <cewolf:param name="type" value="all" /> (<-- Error occurs
              >here.
              >Line no: 108)
              > </cewolf:producer>
              > </cewolf:data>
              > </cewolf:chart>
              >
              >I've also checked the corresponding tld file and it is in place.
              >
              >The same code without any modifications is working fine in tomcat. Can
              >you please
              >let me know what needs to be corrected to make this work?
              

  • Recursive custom tag: different behaviour in WinXP and Linux

    Hi all,
    I've a strange behaviour on a web application for which I developed a custom tag to render a tree structure.
    This tag take in input an object representing the tree with all its nodes, and render every node, calling hitself recursively for every child of every node.
    This tag is used inside a jsp.
    I deployed my webapp on JBoss in a WinXP Pro environment, and everything is ok. Then I deployed the same webapp on JBoss in a Linux Env, and the call to the custom tag... doesn't write anything (with the same input).
    Used jdk are 1.6.0_10 on WinXP and 1.6.0_7 on Linux (an OpenSuse professional distribution). JBoss is 4.2 (I did tests with JBoss 4.2.2 and 4.2.3).
    Here is a sample code of my tag (file outree.tag):
    <%@ tag language="java" pageEncoding="UTF-8" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>
    *<%@ taglib prefix="ousel" tagdir="/WEB-INF/tags/ouselector" %>*
    <%@ attribute name="subtree"
              required="true"
              type="my.webapp.TreeObject" %>
    <%@ attribute name="subroot_index" required="true" type="java.lang.Integer"%>
    <log:debug category="my.webapp.ousearch.taglib" message="Tag library called, starting operations..." />
    <c:if test="${not empty subtree.children}">
         <c:set var="next_subtree_index" value="${subroot_index + 1}"/>
         <ul class="subtree" id="subtree-${subroot_index}">
         <log:debug category="${logcategory}" message="We have children, calling recursively tag library on them (next subtree index: ${next_subtree_index})..." />
         <c:forEach var="currentOUChild" items="${subtree.children}">
              *<ousel:outree subtree="${currentOUChild}" subroot_index="${next_subtree_index}"/>*
              <c:set var="next_subtree_index" value="${next_subtree_index + 1}"/>
         </c:forEach>
         </ul>
    </c:if>
    </li>The TreeObject contains a list of children that can contain other children and so on. On every child, I call recursively my custom tag to render with a set of nested <ul> elements the entire tree structure.
    Here the call from the jsp:
    <%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>
    *<%@ taglib prefix="ousel" tagdir="/WEB-INF/tags/ouselector" %>*
    <log:debug category="${logcategory}" message="Building subtree ${ouSubtree} HTML structure..." />
    *<ousel:outree subtree="${ouSubtree}" subroot_index="1"/>*
    <log:debug category="${logcategory}" message="Subtree ${ouSubtree} HTML structure built" />
    ...Jakarta log taglibs is used to log the value of the parameter passed to the custom tag. In the Linux env I see that the passed object is not empty (it couldn't be null because the tag enforce it as a mandatory value).
    Any idea?

    I have found a workaround.
    Simply substitute the recursive invocation, with an import of a jsp that will call the custom tag.
    Note: You have to set your needed variable in request to make it visible to the jsp
    <%@ tag language="java" pageEncoding="UTF-8" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>
    <%@ attribute name="subtree"
              required="true"
              type="my.webapp.TreeObject" %>
    <%@ attribute name="subroot_index" required="true" type="java.lang.Integer"%>
    <log:debug category="my.webapp.ousearch.taglib" message="Tag library called, starting operations..." />
    <c:if test="${not empty subtree.children}">
         <c:set var="next_subtree_index" value="${subroot_index + 1}"/>
         <ul class="subtree" id="subtree-${subroot_index}">
         <log:debug category="${logcategory}" message="We have children, calling recursively tag library on them (next subtree index: ${next_subtree_index})..." />
         <c:forEach var="currentOUChild" items="${subtree.children}">
                    *<c:set var="_currentOUChild" value="${currentOUChild}" scope="request"/>*
                    *<c:set var="_next_subtree_index" value="${next_subtree_index}" scope="request"/>*
              *<c:import url="/WEB-INF/tags/outtree.jsp"/>*
              <c:set var="next_subtree_index" value="${next_subtree_index + 1}"/>
         </c:forEach>
         </ul>
    </c:if>
    </li>Here is the imported jsp (outtree.jsp):
    <%@ taglib prefix="ousel" tagdir="/WEB-INF/tags/ouselector" %>
    <ousel:outree subtree="${_currentOUChild}" subroot_index="${_next_subtree_index}"/>

  • JSP Custom Tag and Expressions for parameters

    This should be an easy question. I am trying to use an expression for a
              parameter to a jsp or custom jsp tag. When I hard code a value for the
              parameter, the tag works fine but when I use the expression, the expression
              gets evaluated but the tag itself does not resulting in the tag being shown
              in my output.
              For example:
              <jsp:forward page="www.slashdot.org"/> works
              <jsp:forward page="<%=request.getParameter("DESTINATION")%>"/>
              places the following into my html output
              <jsp:forward page="www.slashdot.org"/>
              Can someone please tell me what I am doing wrong or at least offer some
              debugging hints?
              Thanks in advance!
              Jacob Meushaw
              

    I have experienced almost this exact same problem, but with a custom
              tag. And I did make sure that my attribute specified
              <rtexprvalue>true</rtexprvalue>. Here is the weird part.
              If I do the following JSP code everything works fine:
              <% String foo = request.getParameter("bar"); %>
              <mytag:custom param="<%= foo %>"/>
              But if I do this:
              <mytag:custom param="<%= request.getParameter("bar") %>"/>
              I get the following in my html output:
              <mytag:custom param="whatever bar is set to in the request"/>
              It appears that the JSP container only does a one pass evaluation.
              Is this the spec of is this a bug?
              Jacob Meushaw wrote:
              >
              > This should be an easy question. I am trying to use an expression for a
              > parameter to a jsp or custom jsp tag. When I hard code a value for the
              > parameter, the tag works fine but when I use the expression, the expression
              > gets evaluated but the tag itself does not resulting in the tag being shown
              > in my output.
              >
              > For example:
              >
              > <jsp:forward page="www.slashdot.org"/> works
              >
              > <jsp:forward page="<%=request.getParameter("DESTINATION")%>"/>
              > places the following into my html output
              > <jsp:forward page="www.slashdot.org"/>
              >
              > Can someone please tell me what I am doing wrong or at least offer some
              > debugging hints?
              >
              > Thanks in advance!
              >
              > --
              > Jacob Meushaw
              Jeff Smith
              [email protected]
              BEA Systems, Inc.
              720-565-6613
              

  • Nested Custom Tags

    Hello,
    I have a custom tag that I've written that has some
    attributes. I want to nest that tag inside of itself, and access
    the attibutes of the parent tag. However, when I try to access the
    parent tag's data from the child all I get is the child tag's data!
    If there are two of the same custom tags in the context stack, is
    it possible to access one from the other? Thanks for your help.
    Tim

    > I can't use the
    > CALLER scope, as that references the page that called
    the first custom tag, no
    > matter how deeply nested I am.
    I think you should test the advice, before you make
    assertions like this.
    The CALLER scope refers to the variables scope of the
    template that called
    the currently executing custom tag. If your calling stack is
    like this:
    index.cfm
    customTagA.cfm
    customTagB.cfm
    Then the situation is this:
    1) In index.cfm: no caller scope.
    2) In customTagA.cfm: caller scope references index.cfm's
    variables scope.
    3) custoTagB.cfm: caller scope references customTagA.cfm's
    variables scope
    (NOT index.cfm's one).
    Similarly, if your calling stack is like this:
    index.cfm
    customTag.cfm (*)
    customTag.cfm
    customTag.cfm
    customTag.cfm
    Then the caller scope in each customTag.cfm instance refers
    to the
    variables scope of the file above it. The only caller scope
    that
    references index.cfm's variables scope is the customTag
    instance marked
    with (*).
    If I understand your requirement, this is what you want. This
    is why I
    suggested it.
    Adam

  • Custom Tag Capitalization Problem..

    All,
              OS: Windows 2000
              App Server: Weblogic 6.0 sp 2
              JDK: 1.3 (and tried 1.3.1)
              I have a set of custom tags that run fine when I use them on an app server (such as Enhydra) with JDK 1.2.2, but when I switch to JDK 1.3.x, which weblogic 6.x requires, they suddenly start generating errors with attributes which have capitalized letters in them. For example, in my taglib I have:
              <attribute>
              <name>closeConnection</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              </attribute>
              and in the support class I have:
              * Get the value of closeConnection.
              * @return value of closeConnection.
              public boolean getCloseConnection() {
              return closeConnection;
              * Set the value of closeConnection.
              * @param v Value to assign to closeConnection.
              public void setCloseConnection(String v) {
              if(v.toUpperCase().equals("TRUE")){
              this.closeConnection = true;
              } else {
              this.closeConnection = false;
              When I go to the page that this tag is on, I get the following output:
              Parsing of JSP File '/index.jsp' failed:
              /index.jsp(1): Error in using tag library uri='/cwerks' prefix='cwerks': There is no setter method for property 'closeconnection', for Tag class 'net.cwerks.taglib.MyTag'
              probably occurred due to an error in /index.jsp line 1:
              <%@ taglib uri="/cwerks" prefix="cwerks" %>
              Thu Aug 02 19:06:52 PDT 2001
              Note that the 'closeconnection' is all lowercase despite the fact that it is upper case in the tld and in the class itself.
              I came across a similar problem in weblogic 5.1 when I upgraded from JDK 1.2.2 to JDK 1.3. I tried changing the JDK for weblogic 6.0 sp 2 to 1.2.2, but a dll was missing. I also tried switching it to 1.3.1, but that did not help. It seems like introspection may have changed slightly between the two version. I'm shocked, and a bit suspicious, that I haven't seen this problem all over the newsgroups. Anyone else seen this?
              Thank you,
              Carson Gross
              [email protected]
              [att1.html]
              

    A solution presents itself:
              The problem was NOT with capitalization. Instead, the problem was as
              follows:
              My method was for setting a boolean, but I took a string so that people
              wouldn't have to type:
              <mytags:tag foo="<%=true%>" />
              instead, they could type:
              <mytags:tag foo="true" />
              which would call the setter method with a string "true", which would be then
              converted to a boolean within my class.
              So my setter has this signature:
              public void setFoo(String s)
              and my getter has this signature:
              public boolean getFoo() /* I know this isn't standard, but isFoo doesn't
              sound good to me*/
              I can't tell if it's because JavaBeans changed slightly between jdk 1.2.2
              and 1.3.x, or if Weblogic changed the way that they do things (I suspect the
              latter, since I had things working fine in WL 5.2 w/ jdk 1.2.2 and then
              things broke with WL 5.2 w/ jdk 1.3), but this no longer returns foo as a
              valid property to be set, and since weblogic 6.x relies on JavaBeans,
              instead of straight up introspection, it barfs. (I found this out by using
              jad/emacs, a wicked combination for those who want to poke around in jars).
              Anyway, I hope I can save someone else who has this same, albeit
              specialized, problem a lot of pain by my discovery. Your getters and
              setters better be of the same type with custom tags, or weblogic w/ jdk1.3.x
              is gonna barf when parsing the tld.
              Cheers, and thank God that's behind me,
              Carson Gross
              [email protected]
              ====================================================
              "Carson Gross" <[email protected]> wrote in message
              news:[email protected]...
              The plot grows thicker...
              The tags work fine on Tomcat 3.2.2
              I deploy the example tags that came with wl60 that have more than one
              capital letter in thier attributes, and they work fine. But my tag library
              stubbornly insists on not working so long as I keep the attributes with more
              than one capital letter in. If I remove the offending attributes, or change
              them to have only one capital letter, they work, but this is not an
              acceptable solution. (I guess.)
              I even created an simple introspection class to make sure that the acutal
              methods were there. They were.
              I am at a complete loss here... I guess it's tomcat for now.
              Cheers,
              Carson Gross
              [email protected]
              "Carson Gross" <[email protected]> wrote in message
              news:[email protected]...
              All,
              OS: Windows 2000
              App Server: Weblogic 6.0 sp 2
              JDK: 1.3 (and tried 1.3.1)
              I have a set of custom tags that run fine when I use them on an app server
              (such as Enhydra) with JDK 1.2.2, but when I switch to JDK 1.3.x, which
              weblogic 6.x requires, they suddenly start generating errors with attributes
              which have capitalized letters in them. For example, in my taglib I have:
              <attribute>
              <name>closeConnection</name>
              <required>false</required>
              <rtexprvalue>true</rtexprvalue>
              </attribute>
              and in the support class I have:
              * Get the value of closeConnection.
              * @return value of closeConnection.
              public boolean getCloseConnection() {
              return closeConnection;
              * Set the value of closeConnection.
              * @param v Value to assign to closeConnection.
              public void setCloseConnection(String v) {
              if(v.toUpperCase().equals("TRUE")){
              this.closeConnection = true;
              } else {
              this.closeConnection = false;
              When I go to the page that this tag is on, I get the following output:
              Parsing of JSP File '/index.jsp' failed:
              /index.jsp(1): Error in using tag library uri='/cwerks' prefix='cwerks':
              There is no setter method for property 'closeconnection', for Tag class
              'net.cwerks.taglib.MyTag'
              probably occurred due to an error in /index.jsp line 1:
              <%@ taglib uri="/cwerks" prefix="cwerks" %>
              Thu Aug 02 19:06:52 PDT 2001
              Note that the 'closeconnection' is all lowercase despite the fact that it is
              upper case in the tld and in the class itself.
              I came across a similar problem in weblogic 5.1 when I upgraded from JDK
              1.2.2 to JDK 1.3. I tried changing the JDK for weblogic 6.0 sp 2 to 1.2.2,
              but a dll was missing. I also tried switching it to 1.3.1, but that did not
              help. It seems like introspection may have changed slightly between the two
              version. I'm shocked, and a bit suspicious, that I haven't seen this
              problem all over the newsgroups. Anyone else seen this?
              Thank you,
              Carson Gross
              [email protected]
              

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

  • Problem with optional attribute caching on a custom tag

    Hello,
    I've created a tag by extending TagSupport. I have one attribute that is optional. I'm having a problem with this attribute since the tag is cached. If the value is not specified in the tag, it is always using the previous value from the past request.
    I understand why this is happening, but I wonder if there is anyway to reset this value besides doing it at the end of the doStartTag or in the doEndTag methods? I simply want it to be an empty string if it is not in the request.
    Thanks,
    Tim

    Thats abit overkill in my opinion.Probably yes, but its a cleaner option. In case your doEndTag handles custom exceptions, you would anyhow need to put this code in a finally block, right ?
    public int doEndTag() throws JspException {
    try {
    call some methods that throws other checked exceptions;
    }catch(Exception1 e){
    throw JspException(e);
    }catch(Exception2 e){
    //log and ignore
    }finally{
    //clean up here
    return an int;
    Having said that, different containers implement the spec a bit differently. For example, in our project, we use weblogic and for wl, we put our clean up code in the release() method which according to the spec, needs to be called only before gc. Weblogic implementation is a bit different - its called after doEnd() for every use of the tag.
    This is from jsp spec regarding tag life cycle especially with reuse
    Some setters may be called again before a tag handler is reused. For
    instance, setParent() is called if it�s reused within the same page but at a dif-ferent
    level, setPageContext() is called if it�s used in another page, and
    attribute setters are called if the values differ or are expressed as request-time
    attribute values.
    �Check the TryCatchFinally interface for additional details related to exception handling and resource management.
    cheers,
    ram.
    }

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

  • 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

Maybe you are looking for

  • Win98 and security policies

    Hello, I am at a lost here. I have ten wireless laptops that are running Win98se with Novell Client 3.4. Our environment is as follows: NW51sp7 servers, Windows2K clients, ZfD4, Novell Client 4.90sp2. Running on an IP Network, Servers do run IPX, but

  • Prefix required for namespace error

    When I try to import an XML schema into the TopLink workbench, I'm getting the following error: 0800 - Prefix required for namespace "http://www.ACORD.org/standards/PC_Surety/ACORD1.6.1/xml/". Has anyone seen this before? Any help would be appreciate

  • HT5622 What is a rescue email?

    I cannot get pas "Resue Email" on my iphone, I don't understand what it wants me to do.

  • Dreamweaver can't find htm Floaters when loading

    I get the following errors (see screenshots) and more like them when opening Dreamweaver. It does eventually open but is very unstable and crashes frequently (Mac OSX Mountain Lion)

  • Text colour the reverse of the clip behind it?

    Hello there. Is there any way I can get a text layer's colour(s) to be the reverse of the footage behind it? I'm using FCE 4.0. I'm willing to use LiveType if necessary.