tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elisa Green <elisa.gr...@sheridanc.on.ca>
Subject xtags questions
Date Fri, 22 Jun 2001 18:02:20 GMT
I am trying to build a search results page using xtags in JSP and
would like to count the number of items from my parsed data which
match the input search string (criteriaIn).

My thinking has brought me to the following problem.  I would
like to use criteriaIn to match each item's title, but it does
not behave as I expected.  Is there a way to work around this? 
Or more to the point, is there a feature of taglibs that I have
completely overlooked?

Relevant code:
------------------
<%!
    String criteriaIn;
    int totalcount;
%>
<%
    totalcount = 0;
    criteriaIn = request.getParameter("Criteria");
%>

<%@ taglib uri="/WEB-INF/taglibs/xtags.tld" prefix="xtags" %>

<xtags:parse id="data" uri="xml/mydata.xml"/>
<xtags:forEach select="//item">
    <xtags:if test="./title='<%= criteriaIn %>'"><% totalcount++;
%></xtags:if>
</xtags:forEach>
-------------------
If a fixed string is used, as the following sample demonstrates,
it works as expected.

---------------
<xtags:parse id="data" uri="xml/mydata.xml"/>
<xtags:forEach select="//item">
    <xtags:if test="./title='Nootka'"><% totalcount++;
%></xtags:if>
</xtags:forEach>
----------------

Any help will be appreciated.  Is there any good references for
JSP & Taglibs combined, online?

Thanks in advance.

Elisa

Mime
View raw message