You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ronald Haring <Ha...@furore.com> on 2002/02/14 16:15:54 UTC

Question taglib TEI function

Hi all,

back again with a question. (btw thx for help so far)
In the logic iterate tag you can say how many lines you like to display. Now
I would like to have a previous/next button if there are still objects in
the list available. To enable this, I added a next and previous boolean var
in the iterate tag.
The next will be set at the doEndTag and the previous will be set at the
doStartTag. After the logic iterate tag is finished I like to look at the
hasNext and hasPrevious values to see if I can add these buttons. Therefor I
have to export these values, and thats what is not working.

So
<logic:iterate .... hasNext="next" hasPrevious="previous" indexId="i">

in the logic.tld I have defined the hasNext and hasPrevious values.
<attribute>
<name>hasNext</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>hasPrevious</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

IterateTei.java
added:
        String hasNext = data.getAttributeString("hasNext");
        VariableInfo nextInfo = null;
        if (hasNext != null) {
            nextInfo = new
VariableInfo(hasNext,"java.lang.String",true,VariableInfo.AT_END);
				count++;
        }

        String hasPrevious = data.getAttributeString("hasPrevious");
        VariableInfo prevInfo = null;
        if (hasPrevious != null) {
            prevInfo = new
VariableInfo(hasPrevious,"java.lang.String",true,VariableInfo.AT_END);
				count++;
        }

		  VariableInfo vars[] = new VariableInfo[count];
		  count = 1;
		  vars[0] = typeInfo;
		  if (indexIdInfo != null) {
			  vars[count] = indexIdInfo;
			  count++;
		  }
		  if (nextInfo != null) {
			  vars[count] = nextInfo;
			  count++;
		  }
		  if (prevInfo != null) {
			  vars[count] = prevInfo;
			  count++;
		  }
		  return vars;

However when I print the next value after the iterate tag it is always null.
</logic:iterate>
<%=next%> <-- this will print null

Gr
Ronald 


Furore B.V.
Rijswijkstraat 175-8
Postbus 9204
1006 AE Amsterdam
tel. (020) 346 71 71
fax. (020) 346 71 77

----------------------------------------------------------------------------
---------------
The information transmitted is intended only for the person
or entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in
reliance upon, this information by persons or entities other
than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material
from any computer
----------------------------------------------------------------------------
---------------