"Konrad" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thank you Martin! :) > > Also, do you happen to know if this is possible: > > > <c:forEach var="card" items="${cards}" begin="0" > end="<pg:endidx/>">
This is not legal JSP (or XML) syntax. You cannot use a tag in the value of an attribute of another tag. You could, however, do something like this instead: <c:set var="endIdx"><pg:endidx/></c:set> <c:forEach var="card" items="${cards}" begin="0" end="${endIdx}"> -- Martin Cooper > > <c:out value="${card.name}"/> > > </c:forEach> > > > When I use <pg:endidx/> outside of the <c:forEach> > tag, it correctly displays the value. However, when I > try using <pg:endidx/> in the "end" attribute of > <c:forEach>, it keeps saying: > > "An exception occurred when trying to convert String > '<pg:endidx/>' into 'java.lang.Integer'." (null) > > <pg:endidx/> is trying to output an Integer value > using the JspWriter, but it appears that it is always > converted into text/String. > > Is there any way to accomplish the syntax/logic listed > in the JSP code above? > > Thank you, and have a nice weekend! :) > > > > --- Martin Cooper <[EMAIL PROTECTED]> wrote: > > > > "Konrad" <[EMAIL PROTECTED]> wrote in message > > > news:[EMAIL PROTECTED] > > > 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)); > > > > Try this instead: > > > > pageContext.setAttribute("endIdx", new > > Integer(9), > > PageContext.SESSION_SCOPE); > > > > -- > > Martin Cooper > > > > > > > } > > > > > > > > > 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. > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > __________________________________ > Do you Yahoo!? > New Yahoo! Photos - easier uploading and sharing. > http://photos.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]