Hibtags

JSP 1.2 tag library for Hibernate 2.1

Example 4

This will find a cat using some request parameters and a bit more complex HQL.

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

<%-- Runs HQL with numbered parameters --%>
<hib:find var="cats">
  from Cat c
  join c.kittens as kitten
 where kitten.name = ?
  <hib:param value="${param.kitten_id}" />
</hib:find>

<%-- Loops over the results  --%>
<c:forEach items="${cats}" var="cat">
  <c:out value="${cat.name}" />
</c:forEach>

<%-- Do a little check to see if there were no results --%>
<c:if test="${empty cats}">
  We did not find any cats who is a parent of that kitten.
</c:if>

Uses

<hib:find>

<hib:param>

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





SourceForge.net Is Down