Hibtags

JSP 1.2 tag library for Hibernate 2.1

Example 6

Filters the kittens of a cat, looking for only female kittens.

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://hibtags.lokitech.com/taglib" prefix="hib" %>

<%-- Open a new session for this page --%>
<hib:session>

<%-- Load a particular cat --%>
<hib:load var="cat" class="eg.Cat" value="${param.id}" />

<%-- Filters for only the female kittens of the cat --%>
<hib:filter var="femaleKittens" items="${cat.kittens}">
  from this
 where this.sex = 'F'
</hib:filter>

<%-- Loops over our female kittens and print them out --%>
<c:forEach items="${femaleKittens}" var="kitten">
  <c:out value="${kitten.name}" />
</c:forEach>

<%-- Close the current session that we needed for the kittens association --%>
</hib:session>

Uses

<hib:filter>

<hib:session>

Home
Examples
Documentation
Mailing list
Download
About Us
License
CVS
SF page





SourceForge.net Is Down