Hi,

Hope you can help the headache this is giving me.....

Basically I am trying to write a custom PPR tag with Trinidad (1.2.9). My tag 
though displays #{topteaser.currentText} while an outputTag tag using PPR in an 
identical way is working just fine. I guess I am missing some configuration 
option as I have tracked through the code and got to a line which goes 
getValue(bean) which for my tag returns "#{topteaser.currentText}" and for the 
outputText returns "start", "hello", "goodbye" as I want. As I see it (and I 
may be wrong) it is not the actual PPR (configuration) that is wrong but the 
fact that my tag has not correctly intepreted #{topteaser.currentText} as being 
an expression rather than just a chunk of text.

I have reduced by Tag to something quite simple - which simply extends 
CoreOutputText (and CoreOutputTextTag). I have specified virtually nothing in 
the code as you can see below.

package org.cage.myfaces.tags.teaser;

import org.apache.myfaces.trinidad.component.core.output.CoreOutputText;

public class UITeaser extends CoreOutputText {

        public UITeaser() {
                super();

        }

        /**
         * Construct an instance of the CoreOutputText.
         */
        protected UITeaser(String rendererType) {
                super(rendererType);
        }

}

and

package org.cage.myfaces.tags.teaser;

import org.apache.myfaces.trinidadinternal.taglib.core.output.CoreOutputTextTag;

public class TeaserTag extends CoreOutputTextTag {

          public TeaserTag()
          {
                  
          }
          

}

In the WEB_INF/teaser.tld, I have

<?xml version="1.0" encoding="UTF-8"?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd";
        version="2.1"
>
        <tlib-version>1.0</tlib-version>
        <jsp-version>1.2</jsp-version>
        <short-name>teaser</short-name>
        <uri>http://www.promt.me.uk/development/JSF
        </uri>
        <description>...</description>
        <tag>
                <description>The outputText component supports styled text.
                </description>
                <name>teaser</name>
                <tag-class>......

The rest of the <tag>...<tag> is copied straight from the outputText 
<tag>...</tag> definition from Trinidad




In the JSP I have

...
<%@ taglib uri="http://www.promt.me.uk/development/JSF"; prefix="cage" %>
...
<tr:poll id="myPoller" interval="1000" 
pollListener="#{topteaser.doSomething}"></tr:poll>
<cage:teaser value="#{topteaser.currentText}" partialTriggers="myPoller"/>
<tr:outputText value="#{topteaser.currentText}" partialTriggers="myPoller"/>

"topteaser" is defined as.....

        <managed-bean>
                <managed-bean-name>topteaser</managed-bean-name>
                <managed-bean-class>org.cage.myfaces.teasers.beans.TopTeaser 
                </managed-bean-class>
                <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>

and contains the code....

package org.cage.myfaces.teasers.beans;

import org.apache.myfaces.trinidad.event.PollEvent;

public class TopTeaser {

        private String[] text = new String[] {"hello", "goodbye"};
            
        public String currentText = "start";
        
    /**
     * default empty constructor
     */
    public TopTeaser(){   
    }
    
    public String getCurrentText() {
        
        return currentText;
        
    }
 
    public void setCurrentText(String currentText) {
        
        this.currentText = currentText;
        
    }

    public void doSomething(PollEvent event)
    {
        currentText = 
text[Integer.parseInt(Long.toString(System.currentTimeMillis()%2))];
    }


}

How simple can you get?

Any pointers would be gratefully received.

Thanks & Regards
Christopher Biggs

Reply via email to