Rick,

Are you still pursuing this? If so, I use the following comment hack:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %><%--
--%><%@ attribute name="items" required="true"
type="java.util.Collection"%><%--
--%>...

I've also seen this in use:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core";
%><%@ attribute name="items" required="true" type="java.util.Collection"
%>...

Quoting Rick Reumann <[EMAIL PROTECTED]>:

> I created a simple forEach type of delimeter tag that works well for me 
> (code at end). The problem, though, is I need to use this tag within a 
> javascript method to produce a string that'll be used in a dhtml popup. 
> The problem is that, even if I make this tag file all on one line, I 
> still end up with at least one line break- that when used within the 
> javascript causes problems.
> 
> For example I need to call something like..
> 
> onmouseover="return doSomethingWithString('<tags:MyTag .../>');"
> 
> Is there a way to avoid the line breaks that mess up the above 
> javascript? or I guess another option is to return a String from a 
> function vs using this as a tag file? (I've looked briefly at the 
> function stuff Kris, but I'm short on time on this app and the Tag file 
> was easier to start with).
> 
> As a side note if you see a better way to write this tag file I'll take 
> any suggestions (sorry the if part is hard to read but I needed no extra 
> spaces in the html output):
> 
> DelimItems
> ----------
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
> <%@ attribute name="items" required="true" type="java.util.Collection"%>
> <%@ attribute name="preDelim" %>
> <%@ attribute name="postDelim" %>
> <%@ attribute name="property" required="true" %>
> <%@ attribute name="includeFirst" type="java.lang.Boolean"%>
> <%@ attribute name="includeLast" type="java.lang.Boolean"%>
> <c:if test='${preDelim == null && postDelim == null}'>
>      <c:set var='postDelim' value=', '/>
> </c:if>
> <c:forEach items='${items}' var='item' varStatus='status'>
>      <c:if test='${preDelim != null && ( includeFirst || !status.first 
> )}'>${preDelim}</c:if>${item[property]}<c:if test='${postDelim != null 
> && ( includeLast || !status.last )}'>${postDelim}</c:if>
> </c:forEach>
> 
> 
> If you don't provide a pre or postDelim, it just uses comma separated 
> output, which is what I most commonly need.
> 
> -- 
> Rick

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to