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.

Similar Messages

  • How to use custom tags for integrating FCK Editor?

    Hi All,
    I am looking for the integrating the FCK Editor in my jsp page. any one can please provide the procedure of How to create fckeditor in jsp?
    I have the jar file of fck editor but i am confusing while creating the custom tag for that editor.
    I want like this:
    <FCKeditor:fck ?> like this
    Regards,
    Sateesh

    google answers it all..
    [http://www.jroller.com/coreteam/entry/using_fckeditor_in_jsp_web]
    [http://java.fckeditor.net/properties.html]
    [http://java.fckeditor.net/java-core/tagreference.html]

  • 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 in race condition with OC4J v9.0.2.0.0...

    Hello all,
    (I tried deploying my application with OC4J 9.0.3 but none of my existing
    tags worked)
    I developed a OC4J web application implementing my own tag library extension
    and found out that there was occurring a race condition to the fact that two
    users (different sessions) where accessing the same
    tag at the same time. In the offending tag implementation I only have
    instance members and not static which could also cause a
    concurrent access problem.
    I found that OC4J was reusing concurrently the same
    Tag instance when it should not do that!!!
    public class pagesIteratorTag extends BodyTagSupport {
    // only instance class members...
    public void doInitBody() throws JspException {
    System.out.println("pageSetIteratorTag::doInitBody - Tag instance value: " + this.toString() + " for user: " + this.pageContext.getSession().getAttribute("j_username"));
    public int doAfterBody() throws JspException {           
    System.out.println("pageSetIteratorTag::doAfterBody - Tag instance value: " + this.toString() + " for user: " + this.pageContext.getSession().getAttribute("j_username"));
    Note the pagesIteratorTag@2e same instance is used when it should not
    1 because the tag instance should be protected from multiple concurrent
    access even though it can be pooled and reused if it is free.
    pageSetIteratorTag::doInitBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Frank
    pageSetIteratorTag::doAfterBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Frank
    pageSetIteratorTag::doInitBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Giovanni
    pageSetIteratorTag::doAfterBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Giovanni
    pageSetIteratorTag::doInitBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Giovanni
    pageSetIteratorTag::doAfterBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Giovanni
    Session for user Frank throws a null pointer exception because Giovanni's session
    started accessing the variable.
    Can anyone advise please?
    Best Regards,
    Giovanni

    First of all, you said none of your tags worked in 9.0.3. What happened? Did you do any debugging of the problem?
    Comparing the "toString()" output of your tag does not guarantee they are the same instance. That is just the output of "hashcode()", not the "pointer" to the object. The hashcode is generated from the contents of the object, not its "identity".
    I suggest you track the NPE in the debugger and get more information before you assume the container is at fault (which is still an outside possibility). SDK API Javadoc
    Object class:
    The general contract of hashCode is:
    1-. Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
    So, the toString() is properly returning the suffix of the object instance
    number unique for that instance and is then being reused by OC4J even though
    it is being accessed from another session thread, that must not happen and it
    is not compliant with the JSP spec.
    The other history is that when I implemented my custom tags OC4J was JSP 1.1 compliant
    and not 1.2, so after moving to 1.2 the scripting variables can be defined in XML and
    by subclassing TagInfo class, the last option doesn't work with OC4J 9.0.3, not good...
    Thanks for your help,
    I will keep trying to figure out what the problem migth be,
    Best Regards,
    Giovanni

  • Event handling in zranges custom tag

    Hi,
        I am using the tutorials  by Thomas Jung on the ranges. I am faces a very strange problem.   I have created that extension. My application framework is like bsp_model application.  I have one main controller and two sub controller. when ever I chose  any option,
    An event is generated and do_Handle_event of main controller is called but ideally the do_handle_event of right controller  should be called .Any Explanation about this behavior.
    regards
    Ashish

    Hi Dezso,
    > <i>the event handler of the main controller is always called</i>
    As far as I know the Do_Handle_Event is called only for the controller in which event has been triggered it may be any sub-controllor or main controllor.
    You are right that we dispatch the event through calling method Dispatch_input( ) in the Do_Request( ) method of main controller.  Dispatch_Input do the followings...
    1. First it calls Do_Handle_Data of sub-controllor's in the same order as they are instansiated in the main controllor and then finally Do_Handle_Data of main controllor is called.
    2. Now Do_Handle_Event is called only for the controllor where event is triggered.
    3 Now Do_Finish_Input is called in same sequence as  Do_Handle_Data .
    Correct me if I am wrong somewhare till now.
    Now let me explaine my problem in detail...
    I am using custom tag zranges in a view which is registered to a sub-controllor, I want to trap the event triggered when any option is selected but I am unable to do that. Please suggest me some solution to this prblem.
    Thanks and Regards,
    Ashish

  • Question: TLD and custom Tag Usage.

    Hi, I am new to the custom tags and I am confused with one of the examples.
              The TLD has
              <tag>
              <name>item</name>
              <tagclass>com.taglib.wdjsp.mut.OutlineItemTag</tagclass>
              <bodycontent>JSP</bodycontent>
              <info>
              Delineates an item, possibly including subitems,
              within a nested outline.
              </info>
              <attribute>
              <name>text</name>
              <required>true</required>
              <rtexprvalue>true</rtexprvalue>
              </attribute>
              </tag>
              This TLD specifies that the tag has body content that is JSP and not empty.
              The author uses the tag in the JSP page in the following way..
              <mut:item text="What is JSP"/>
              <mut:item text="Evolution of dynamic content technologies">
              <mut:item text="Common Gateway Interface"/>
              </mut:item>
              I wonder why the usage "<mut:item text="What is JSP"/>" - where the
              bodycontent is empty - does not violate the TLD.
              Is the bodycontent optional even if it is specified in TLD. What if it is
              tagdependent?
              thanks - Sri
              

    then in your code
    public void setEnabled(String enabled) {
    this.enabled = true;
    in your endtag reset the boolean to false;
    IMO, a cleaner approach would be
    private boolean enabled = false;
    public void setEnabled(boolean enabled) {
         this.enabled = enabled;
    }The advanatge is that
    <foo other_attributes enabled= "false"/> and
    <foo other_attributes/> will both evaluate to false;
    <foo other_attributes enabled= "true"/> will evaluate to true
    <foo other_attributes enabled= "will_this_work"/> will give an exception
    as the container cannot resolve it to a boolean value so that users will
    be forced to use true or false (or skip the attribute) which is how it
    should be.
    Also note the container cannot convert runtime expressions to boolean
    values. So if there's a String variable,say prompt in scope that has the
    value true, then<%
    String prompt = "true";
    pageContext.setAttribute("prompt", prompt);
    %>
    <foo other_attributes enabled= "<%=prompt>"/>
    will throw an error. (to do this you would have to specify rtexpr value of
    this attribute to true)
    For the above to work, your tag should be coded as shown below
    private boolean enabled = false;
    //note rtexpr value will always be Strings
    //container does not provide auto conversions
    public void setEnabled(String enabled) {
         this.enabled = new Boolean(enabled).booleanValue();
    }cheers,
    ram.

  • Execution sequence of connect by and group by

    Hi All,
    I know 'connect by' precedes 'where clause'. And I can use a test case to test this.
    But I can't figure out which comes first, connect by and group by.
    Can someone give me some tips on this, pleaes?
    And another confusion of mine is execution sequence of select and order by.
    In my opinion, since order by can read the alias of selected column, I think the sequence is that oracle select rows first and then sort them.
    Please correct or confirm my statement.
    Best regards,
    Leon

    Hi, Leon,
    user12064076 wrote:
    Hi All,
    I know 'connect by' precedes 'where clause'. And I can use a test case to test this.
    But I can't figure out which comes first, connect by and group by. Can you figure out if WHERE precedes GROUP BY?
    SELECT    job
    ,         COUNT (*)   AS cnt
    FROM      scott.emp
    WHERE     sal     < 2500
    GROUP BY  job
    ;Aggregate functions, like COUNT, are evaluated as the GROUP BY clause is being performed. After the GROUP BY clause, only the ABC's (<b>A</b>ggregates, Group <b>B</b>Y expressions, <b>C</b>onstants, and <b>D</b>eterministic combinations of these) can be referenced.
    Can someone give me some tips on this, pleaes? Consider this query:
    SELECT     LEVEL
    ,     COUNT (*)     AS cnt
    FROM     scott.emp
    START WITH     mgr     IS NULL
    CONNECT BY     mgr     = PRIOR empno
    GROUP BY     LEVEL
    ;Output:
    `    LEVEL        CNT
             1          1
             2          3
             4          2
             3          8
    And another confusion of mine is execution sequence of select and order by.
    In my opinion, since order by can read the alias of selected column, I think the sequence is that oracle select rows first and then sort them.
    Please correct or confirm my statement. Yes, the ORDER BY clause is evaluated after the SELECT clause. The ability to reference column aliases in the ORDER BY clause hints at this. Also, you can say
    ORDER BY  1

  • JWSDP Custom Tags (finding tag handler class)

    Hi,
    ive been using the Java Web Services Development Pack
    ive tried several examples of creating custom tags all seem to have different directory structures and none seem to work. Heres my setup...
    rootdir -> index.jsp
    rootdir -> WEB-INF -> web.xml
    rootdir -> WEB-INF -> tlds -> demo.tld (the tag library descriptor)
    rootdir -> WEB-INF -> classes -> demo -> tags -> Greeter.java (the tag handler class)
    there are some other folders created by deploytool but they are empty.
    heres demo.tld...
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>2.0</jsp-version>
    <short-name>demo</short-name>
    <uri>DemoTags</uri>
    <tag>
    <name>greeter</name>
    <tag-class>demo.tags.Greeter</tag-class>
    <body-content>empty</body-content>
    </tag>
    </taglib>
    here is the tag handler class Greeter.java...
    package demo.tags;
    import javax.servlet.jsp.tagext.*;
    import javax.servlet.jsp.*;
    public class Greeter extends SimpleTagSupport {
    public void doTag() throws JspException {
    PageContext pageContext = (PageContext) getJspContext();
    JspWriter out = pageContext.getOut();
    try {
    out.println("Hello World");
    } catch (Exception e) {
    // Ignore.
    and heres the code in index.jsp...
    <%@taglib prefix="t" uri="DemoTags" %>
    <t:greeter />
    Id love to know if these directory structures are fixed and where they are specified - its confusing the way so many examples show differences.
    this is the exception i get when trying to run index.jsp through the admin page (localhost:4848)
    org.apache.jasper.JasperException: /index.jsp(11,0) Unable to load tag handler class "demo.tags.Greeter" for tag "t:greeter"
    ----

    Sincere Apologies - It might be a good idea to compile my java files so i actually have classes in my classes directory !!
    i think a build.xml file is needed for ant to compile everything that is needed now.
    and the beat goes on !

  • Help! pageContext is NULL in custom tag constructor!

    I'm having a problem with a custom tag class, and I'm not sure whether it's because I'm doing something wrong, or because I'm running into a bug with Tomcat, JDK1.4b2, or something else. Basically, I'm finding that the pageContext object is null in the constructor of a custom tag class... something that I'm pretty sure is NOT supposed to happen.
    I'm running JDK1.4b2 with Forte CE 3.1 (the bug predates the jumbo fix that brought it up to 3.0) and using Forte's embedded Tomcat.
    I'm not sure whether it matters, but here's the sequence of events:
    A servlet gets launched,
    instantiates an object of type Error_list,
    binds Error_list to the request object, and
    forwards to a JSP that uses the custom tag defined by ListErrorsTag.
    Unfortunately, pageContext is null in ErrorListTag's constructor, so the attempt to get the request object from the pageContext object generates a NullPointerException.
    The SERVLET: *****************************************
    // relevant lines from the servlet instantiating the object, binding it, and forwarding...
         Error_list errors = new Error_list("BAD_THINGS", "crash and burn");
         request.setAttribute("errors",errors);
         ServletContext sc = this.getServletContext();
         RequestDispatcher rd = sc.getRequestDispatcher("admin_category_create.jsp");
         rd.forward(request,response);
    The JSP: ************************************************
    In the JSP "admin_category_create.jsp" itself, I specify the taglib:
         <%@ taglib uri='/WEB-INF/AdminTags.tld' prefix = 'admin' %>
    and reference it:
         <admin:listErrors>The errors will be listed here</admin:listErrors>
    The Explosion of the Taglib: ************************
    // beginning of Taglib class:
    public class ListErrorsTag extends BodyTagSupport {
        private Error_list errors;
        public ListErrorsTag() {
        super()
        try {
             if (pageContext == null)
                 System.out.println("uh oh! pageContext is null");
             ServletRequest request = pageContext.getRequest();
             errors = (Error_list)request.getAttribute("errors");
        catch (NullPointerException e) {
             System.out.println("boom!");
    The Result: **************************************
    Tomcat's error log:
    uh oh! pageContext is null
    boom!
    if I eliminate the try/catch and allow the NullPointerException to take place, I get:
    Error: 500
    Location: /admin_category_create.jsp
    Internal Servlet Error:
    javax.servlet.ServletException
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
         at _0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0._jspService(_0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0.java:338)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
         at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:194)
         at admin.processRequest(admin.java:126)
         at admin.doPost(admin.java:144)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
         at java.lang.Thread.run(Thread.java:539)
    Root cause:
    java.lang.NullPointerException
         at AdminTags.ListErrorsTag.(ListErrorsTag.java:32)
         at _0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0._jspService(_0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0.java:272)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
         at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:194)
         at admin.processRequest(admin.java:126)
         at admin.doPost(admin.java:144)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
         at org.apache.tomcat.core.Handler.service(Handler.java:286)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
         at java.lang.Thread.run(Thread.java:539)

    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.

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

  • Exception jsp custom tag in IBM AIX

              Hello, this is the scenario.
              WebLogic Server 5.1 sp6 on IB AIX
              The WLS is standalone; there is a servlet that make a forward to a frameset with
              three frame; each frame has a jsp which take data by an http session object.
              The log of weblogic give the following message for each servlet class generated
              by jsp:
              Root cause of ServletException
              javax.servlet.ServletException: runtime failure in custom tag 'getProperty' at......
              The same application in NT works fine.
              there is the execution of a different thread for each jsp in the frameset?
              Could you help me?
              Thanks and regards
              Fabio
              

              Please post the remainder of the stack trace.
              Mike
              "Fabio Rossi" <[email protected]> wrote:
              >
              >Hello, this is the scenario.
              >WebLogic Server 5.1 sp6 on IB AIX
              >The WLS is standalone; there is a servlet that make a forward to a frameset
              >with
              >three frame; each frame has a jsp which take data by an http session
              >object.
              >The log of weblogic give the following message for each servlet class
              >generated
              >by jsp:
              >
              >Root cause of ServletException
              >javax.servlet.ServletException: runtime failure in custom tag 'getProperty'
              >at......
              >
              >The same application in NT works fine.
              >there is the execution of a different thread for each jsp in the frameset?
              >
              >Could you help me?
              >
              >Thanks and regards
              >Fabio
              

  • Custom Tag Implementation seems inefficient

    I've been playing around a bit (alright, so maybe not all that much)
              with custom tags, and it seems like the actual implementation of custom
              tags (tag handler object(s) per tag) is much more resource-intensive
              than would be justified. With Weblogic 5.1 SP6, has anyone had the
              opportunity to compare performance of a typical JSP page w/ and w/out
              custom tags?
              My first impression of custom tags was that you could define tags
              and behaviors that the JSP compiler would then compile into your JSP
              class; there would be no performance hit during page execution. The Java
              code used to write these tags would either be included inline in the JSP
              page code, or else act essentially as static (threadsafe) classes into
              which threads executing JSP pages would call into. This approach means
              less resources consumed and less setup/teardown time in exchange for
              fatter JSPC'd code.
              Instead (and correct me if I am wrong), it appears that each
              distinct custom tag has a pool of instantiated handler objects lying
              around in memory, and each time a custom tag is used, there is a
              little performance hit in the setup & teardown of each handler object's
              pageContext, etc...
              Now admittedly, as another poster (I believe Mr. Purdy) pointed out,
              a "little" ain't all that much... unless there are thousands of those
              "little" hits.
              Moreover, I don't see much benefit in having instantiated objects do
              the heavy lifting. I'd rather have my auto-compiled JSP classes be a
              little more bloated than suffer any performance hit. (I do, however,
              like the fact that custom tags allows for cleaner JSP code, not to
              mention makes for a cleaner break between the creative and coding work.)
              For those of you who've had more extensive experience with custom
              tags, am I missing the target? Is the performance hit negligible for
              heavily-used or complex pages? And/or is the performance hit outweighed
              by code and development cleanliness?
              Thanks for any input.
              Jack
              

    Hi Sri
              Looks like you've found an inefficiency in WebLogic's JSP compiler - it
              should be reusing tag instances within the same page. BEA should fix this
              hopefully.
              > So even if a page has 4 tags and 100 users, we have 400 objects just
              > because we use tags.
              Sure, assuming you have 100 concurrent users (and 100 threads in the servlet
              engine). Though creating 400 objects is not a big deal in Java; most non
              trivial Java applications / services create millions of objects.
              Its also worth noting that having a seperate object instance per tag per
              calling thread means that you don't have to do any synchronisation in the
              custom tag (since you're guarenteed to be called by one thread only) so you
              get maximum thread throughput at the expense of some object allocation.
              If you really don't like the idea of creating a few java objects per request
              you could use XSLT to post process JSP files to replace tag occurencies with
              Java scriptlets - though I'm not sure the extra complexity and restrictions
              that this mechanism imposes is worth it at all. Custom tags rock! ;-)
              J.
              James Strachan
              =============
              email: [email protected]
              web: http://www.metastuff.com
              "Sri" <[email protected]> wrote in message
              news:[email protected]...
              > This post had some interesting aspects about custom tags that contradict
              > what I see in the generated java code by the JSP container. I am using
              > weblogic 5.1 sp6 and I have a jsp file that uses a custom tag "xyz:for" a
              > couple of times. the tags are not nested.
              > The java code indicates that two separate instances for the "xyz:for" tag
              > were created.
              >
              > try
              >
              > calicothunder_presentation_tags_ForTag_0 = new
              > calico.thunder.presentation.tags.ForTag();
              >
              > ..............
              >
              > } finally
              >
              > if (_calico_thunder_presentation_tags_ForTag_0 != null)
              > calicothunder_presentation_tags_ForTag_0.release();
              > }
              >
              > Further down
              >
              > try {
              > calicothunder_presentation_tags_ForTag_1 = new
              > calico.thunder.presentation.tags.ForTag();
              > ...............
              >
              > } finally
              >
              > if (_calico_thunder_presentation_tags_ForTag_1 != null)
              > calicothunder_presentation_tags_ForTag_1.release();
              > }
              >
              > The code is creating two different objects for every request. It is not
              > reusing the same object.
              > The release is just cleaning up the current instance, which may be garbage
              > collected at some later stage.
              > So even if a page has 4 tags and 100 users, we have 400 objects just
              > because we use tags.
              >
              > Just trying to understand this better..
              > thanks - Sri
              >
              >
              >
              > "James Strachan" <[email protected]> wrote in message
              > news:[email protected]...
              > > Hi Jack
              > >
              > > I think you're right to be concerned and it is a valid concern.
              > >
              > > In the scheme of things in my experience the cost of using custom tags
              is
              > > quite minimal. Tag instances are reused on the same page so if I have
              > > several non-nested <foo:bar> tags on a page the single FooBarTag
              instance
              > > will be reused for each tag occurance.
              > >
              > > Consider other Java code, say, string concatenation. Consider the
              > following
              > > expression.
              > >
              > > String c = a + b;
              > >
              > > Fairly minimal code you might think. However this line actually involves
              > the
              > > creation of a StringBuffer instance, the call of 2 methods and the
              > creation
              > > of a second String object instance (never mind the internal char[]
              object
              > > instance that is created inside the new Strings constructor).
              > >
              > > A typical use of a custom tag involves one object construction, N
              > > setProperty() method calls (one for each attribute of the tag) and the
              > > startTag / endTag method calls.
              > >
              > > So on balance I'd say the custom tags mechanism is quite small and
              > > efficient.
              > >
              > > Though note that if you use large numbers (say hundreds) of different
              > kinds
              > > of tags then you'll have a much greater object allocation overhead.
              > >
              > > --
              > > J.
              > >
              > > James Strachan
              > > =============
              > > email: [email protected]
              > > web: http://www.metastuff.com
              > > "Jack Lin" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > I've been playing around a bit (alright, so maybe not all that much)
              > > > with custom tags, and it seems like the actual implementation of
              custom
              > > > tags (tag handler object(s) per tag) is much more resource-intensive
              > > > than would be justified. With Weblogic 5.1 SP6, has anyone had the
              > > > opportunity to compare performance of a typical JSP page w/ and w/out
              > > > custom tags?
              > > >
              > > > My first impression of custom tags was that you could define tags
              > > > and behaviors that the JSP compiler would then compile into your JSP
              > > > class; there would be no performance hit during page execution. The
              Java
              > > > code used to write these tags would either be included inline in the
              JSP
              > > > page code, or else act essentially as static (threadsafe) classes into
              > > > which threads executing JSP pages would call into. This approach means
              > > > less resources consumed and less setup/teardown time in exchange for
              > > > fatter JSPC'd code.
              > > > Instead (and correct me if I am wrong), it appears that each
              > > > distinct custom tag has a pool of instantiated handler objects lying
              > > > around in memory, and each time a custom tag is used, there is a
              > > > little performance hit in the setup & teardown of each handler
              object's
              > > > pageContext, etc...
              > > > Now admittedly, as another poster (I believe Mr. Purdy) pointed
              out,
              > > > a "little" ain't all that much... unless there are thousands of those
              > > > "little" hits.
              > > > Moreover, I don't see much benefit in having instantiated objects
              do
              > > > the heavy lifting. I'd rather have my auto-compiled JSP classes be a
              > > > little more bloated than suffer any performance hit. (I do, however,
              > > > like the fact that custom tags allows for cleaner JSP code, not to
              > > > mention makes for a cleaner break between the creative and coding
              work.)
              > > >
              > > > For those of you who've had more extensive experience with custom
              > > > tags, am I missing the target? Is the performance hit negligible for
              > > > heavily-used or complex pages? And/or is the performance hit
              outweighed
              > > > by code and development cleanliness?
              > > >
              > > > Thanks for any input.
              > > > Jack
              > > >
              > > >
              > >
              > >
              >
              >
              

  • Custom Tag iteration

    I'm a little new to this so hopefully my question isn't overly confusing.
    I have a custom tag that iterates through a list of items and makes specific variables available to the jsp page which looks something like this.
                <xcontent:getItems>
                            <tr bgcolor="<%=bgcolor%>">
                              <td>Name: <%=item_name%></td>
                            </tr>
                </xcontent:getItems>I have a doStartTag, doInitBody and doAfterBody and normally my code all works fine. My issue is that sometimes I want to skip one of the items and not produce any output. If I want to skip Item #2 I just return EVAL_BODY_CONTENT without setting any variables (by calling pageContext.setAttribute). I properly get no output for Item #2 but I get Item #1 repeated. It appears that the tag tries to provide output everytime it reaches the return EVAL_BODY_CONTENT.
    How can I get my code to skip an item entirely and basically only iterate the tag once even though there are 2 items and 2 return EVAL_BODY_CONTENT?
    - Todd

    You should either return SKIP_BODY_CONTENT or (if you want to see the empty items too), clear the value of the scripting variables. This is why item #1 is repeated.

  • Problems with custom tags (Tomcat 4.1)

    I have been trying to set up an existing web application to use a custom tag library. I have these tag-related files:
    /photodb/WEB-INF/photodb.tld
    /photodb/WEB-INF/classes/PhotoListTag.class
    /photodb/photolist.jsp
    This is how i have the photoList tag configured in photodb.tld
    <tag>
    <name>photoList</name>
    <tag-class>PhotoListTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
    <name>startIndex</name>
    </attribute>
    </tag>
    When i try to view photolist.jsp, i get this error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\photodb\photolist_jsp.java:73: cannot resolve symbol
    symbol : class PhotoListTag
    location: class org.apache.jsp.photolist_jsp
    PhotoListTag jspxth_photodb_photoList_0 = (PhotoListTag) jspxtagPool_photodb_photoList.get(PhotoListTag.class);
    ^
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\photodb\photolist_jsp.java:73: cannot resolve symbol
    symbol : class PhotoListTag
    location: class org.apache.jsp.photolist_jsp
    PhotoListTag jspxth_photodb_photoList_0 = (PhotoListTag) jspxtagPool_photodb_photoList.get(PhotoListTag.class);
    ^
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\photodb\photolist_jsp.java:73: cannot resolve symbol
    symbol : class PhotoListTag
    location: class org.apache.jsp.photolist_jsp
    PhotoListTag jspxth_photodb_photoList_0 = (PhotoListTag) jspxtagPool_photodb_photoList.get(PhotoListTag.class);
    ^
    3 errors
    I have tried many ideas, such as packaging the tag handler class, and putting the class file in other loctions, but nothing has helped.
    I know that Tomcat is recognizing PhotoListTag at some point (when it parses the TLD file, but not when compiling the JSP, I think), because if i change the <tag-class> to an invalid class, i get an "Unable to load class photoList" (which is a confusing error message btw, as photoList is not a class, but a tag name).
    Does anyone know how to fix this problem? I've been going in circles for hours, and i'm thinking this problem has a simple solution.

    Thank you for your quick replies. Unfortunately, they do not solve my problem. If I put PhotoListTag in the com.yourdomain package (and move it to classes/com/yourdomain), the error changes to reflect the different package (e.g. package com.yourdomain does not exist). Also, deleting the class files and restarting Tomcat did not cause any changes.
    Although my knowledge of how Tomcat works is limited, it seems to me that something like this is happening:
    When a request for /photodb/photolist.jsp is recieved, tomcat processes that file, processes the tld file, and checks for that any classes called using a tag--in this case <photodb:photoList>--exist. If the class is invalid, the error message "Unable to load class photoList" is given.
    Otherwise, it translates the jsp into java, and attempts to compile it. This is where the problem occurs. It seems that the jasper compiler does not know where to look for the PhotoListTag class. Is there a way that this can be changed, or is could the problem be caused by something else?

  • Code assist for custom tags

    Hi everybody,
    I'm working with Facelets and have just defined some custon tags (using
    com.sun.facelets.tag.AbstractTagLibrary) which works just fine.
    But how do I get content assist for those???
    Do I have to create some tld-file?
    Thanks in advance :-)
    Tory

    ok, now I'm confused.... I don't have a TLD file at all. I use the
    com.sun.facelets.tag.AbstractTagLibrary
    to define the new tags. (and that works fine). I thought I'll need a TLD file to get content assist...
    So, any idea how I can get it for my custom tags (or is it impossible)
    Or does anyone know how content assist works on standard tags?
    Thanks in advance,
    Tory
    Edited by: tory77 on Aug 19, 2008 6:48 AM

Maybe you are looking for

  • IPOD NOT APPEARING IN "MY COMPUTER" OR ITUNES

    Hey guys, just wondering if you can help me, all of a sudden when i connect my touch to my windows laptop, the sound when u plug ur ipod appears however it doesnt appear on "my computer" or in itunes. If you guys have any ideas why this is happening

  • Dynamic variable value based on a value from xml

    I have a invoice template and it is for 4 different companies in my organization. Based on the organization I need to have a different value for a variable that adds blank lines to the end of the invoice. Is there anyway to assign a value to variable

  • Session is Closed error in BOXI 3.1 SP2

    We have a user who is attempting to run a report in Infoview. When they try to run the report an error message appears. Session is Closed  Error: INF . Checked the user access, they have view on demand access. Appear to have proper access to refresh,

  • Multiple amplitude readings on the same waveform

    I have a waveform with two distinct amplitudes on it.I can read the waveform and make a single amplitude measurement based on the amplitude measurement off of the scope but  I need to be able to measure both amplitudes, the sub VIs i was planning on

  • FOLIO PANEL NOT SHOWING UP UNDER WINDOW MENU:

    I have installed the D-Pub update and per Adobe's India support team [:-( ] I uninstalled the whole program and reinstalled it as they suggested - that did not help at all and was a complete waste of time. so does anyone know how to get the Folio pan