HibtagsJSP 1.2 tag library for Hibernate 2.1 |
|
|
Example 3
This opens a session for a while, creates a new Cat bean, sets one of the properties, and saves it.
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://hibtags.lokitech.com/taglib" prefix="hib" %>
<%-- Opens a hibernate session --%>
<hib:session>
<%-- Instantiates a new Cat bean --%>
<jsp:useBean id="cat" class="eg.Cat" />
<%-- calls cat.setName(request.getParameter("name")) --%>
<c:set target="${cat}" property="name" value="${param.name}" />
<%-- Marks this object to save or update, as you normally would in hibernate --%>
<hib:saveOrUpdate target="${cat}" />
<%-- Closes and flushes the session, saving the change --%>
</hib:session>
Uses |
Home
Examples Documentation Mailing list Download About Us License CVS SF page |