IMHO the best thing to do would be to declare the field as static text in
the studio, and have your class MyHref extend CSpStaticText.

This is what Grace and I are doing in a current project for several hrefs
that depart from the ND pointy-clicky mode.

The key concept is to override the init method, and to add a listener for
the onBeforeHtmlOutputEvent.  This uses java's anonymous inner class feature.

-- Curt Springer, Team ND

   //*****************************************************************
   /**
    * initialize the state of the object.
    *
    * @returns    int    - Return code that indicates what should
    *                      be done next
    * @see  spider.CSpFileBased#PROCEED
    * @see  spider.CSpFileBased#SKIP
    * @see  spider.CSpFileBased#STOP
    * @see
    */
   //*****************************************************************
   public int init()
   {
      // initialize the object
      super.init();

      // allow object to listen for onBeforeHtmlOutputEvent events
      addHtmlOutputListener(
         new ISpHtmlOutputListener() {


//*****************************************************************
            /**
             * Event handler for event that occurs right before HTML is output
             * to the HTTP buffer.
             *
             * @param      event    Event source
             * @return     int      Return code that defines the next
operation
             * @see  spider.visual.CSpVisual
             * @see  spider.CSpFileBased#PROCEED
             * @see  spider.CSpFileBased#SKIP
             * @see  spider.CSpFileBased#STOP
             * @see
spider.event.ISpHtmlOutputListener#onBeforeHtmlOutputEvent
             * @see  spider.visual.CSpVisual#addHtmlOutputListener
             * @see  spider.event.CSpHtmlOutputEvent
             */

//*****************************************************************
            public int onBeforeHtmlOutputEvent(CSpHtmlOutputEvent event)
            {
               try
               {
                        //you need to construct the complete html for your href, from 
<a....../a>
                        //you can call any method or use any member variable
                        String htmltext = <insert code here>
                        setHtmlText(htmltext);

                  return (PROCEED);
               }  // try
               catch( Exception ex )
               {
               CSpLog.send(this, CSpLog.ERROR, "onBeforeHtmlOutputEvent:
unexpected exception: " + ex);
                  return (STOP);
               } // catch ( Exception ex)
            }//public int onBeforeHtmlOutputEvent(CSpHtmlOutputEvent event)

         }//new ISpHtmlOutputListener(){
      );//addHtmlOutputListener(

      return (PROCEED);

   } //public int init()


At 04:34 PM 5/25/99 -0800, [EMAIL PROTECTED] wrote:
>Here's my problem:
>
>I need all my hrefs to have a mechanism in which it checks certain
parameters and
>       then it decides whether or not to append the SPIDERSESSION NVP in the url
when generating
>       itself in the HTML.  I assume that I would have to create a new class
called for
>       instance "MyHref" and have MyHref extend CSpHref.  Then when I'm creating
my hrefs
>       in the Studio, I just change the SuperClass property in the Properties
tab of the
>       href to point to MyHref.  But how do I implement MyHref such that it will
not automatically
>       append the SPIDERSESSION NVP??
>
>If anyone has done this before, I would really appreciate any good advice.
 Thanks.
>
>James Hang
>SpringStreet, Inc.
>_________________________________________________________________________
>
>For help in using, subscribing, and unsubscribing to the discussion
>forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>
>For dire need help, email: [EMAIL PROTECTED]
> 
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to