You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Konrad <kh...@yahoo.com> on 2004/01/15 22:17:19 UTC

[General TagLib question] Custom TagLib storing value in PageContext/session and reference by Standard JSTL?

Hello.

In my custom taglib's doStartTag() method, I stored a
value in the session, as follows:

CustomTag
=========
public void doStartTag() {
   
  
this.pageContext.getSession().setAttribute("endIdx",new
Integer(9));
}


I am trying to reference that value in JSTL's
<c:forEach> tag, as in the following .jsp snippet:


test.jsp
========

<my:custom/>  <!-- just calls/executes the CustomTag
-->

<c:forEach var="card" items="${cards}" begin="0"
end="${endIdx}">
   <c:out value="${card.name}"/>
</c:forEach>


Basically, above, I am trying to dynamically set the
ending index of the forEach tag, based on the value
calculated in CustomTag.

However, forEach's "end" attribute is resolving to 0
instead of 9, which was set in the CustomTag's
doStartTag() method.

Is there a way to ensure that CustomTag executes "in
advance" such that forEach's "end" tag can correctly
reference the value set in the session?

Thank you.

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org