Created
February 26, 2009 18:37
-
-
Save akahn786/71014 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filterItems(field, url) { | |
$.get(url, | |
{ 'filter': $(field).val(), | |
'_eventName': 'findByName' | |
}, | |
function(data) { | |
$('#item_table').html(data); | |
} | |
); | |
} | |
function ajaxLink(link, update) { | |
$.get(link, function(data) { | |
$(update).html(data); | |
$(update).show(); | |
}); | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ include file="/WEB-INF/jsp/common/taglibs.jsp" %> | |
<s:layout-render name="/WEB-INF/jsp/common/layout.jsp" title="Found Items" currectSection="ItemList"> | |
<s:layout-component name="head"> | |
<script type="text/javascript" src="${contextPath}/script/jquery-1.3.2.min.js" ></script> | |
<script type="text/javascript" src="${contextPath}/script/item_list.js" ></script> | |
</s:layout-component> | |
<s:layout-component name="body"> | |
<div id="item_table"> | |
<div>Found Items</div> | |
<s:url var="url" beanclass="org.stripesbook.quickstart.action.ItemListActionBean"/> | |
Item Filter: <input type="text" onkeyup="filterItems(this, '${url}');"/><br/> | |
<d:table name="${actionBean.items}" id="item" requestURI="" defaultsort="1" | |
pagesize="30" sort="list" defaultorder="descending"> | |
<d:column title="Date Found" sortProperty="dateFound" sortable="true" > | |
<fmt:formatDate type="date" dateStyle="full" value="${item.dateFound}" /> | |
</d:column> | |
<d:column title="Name" sortable="true"> | |
<s:link beanclass="org.stripesbook.quickstart.action.ItemDetailActionBean"> | |
<s:param name="item" value="${item.id}"/> | |
${item.name} | |
</s:link> | |
</d:column> | |
<d:column title="City" property="cityId" sortable="true" /> | |
<d:column title="State" property="stateId" sortable="true" /> | |
<d:column title="Picture" sortable="true"> | |
<c:if test="${item.imageExists}"> | |
x | |
</c:if> | |
</d:column> | |
</d:table> | |
</div> | |
</s:layout-component> | |
</s:layout-render> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Resolution findByName() { | |
logger.debug("*** in findByName()"); | |
Session sess = org.stripesbook.quickstart.util.DAO.getSession(); | |
if (filter != null && filter.length() > 0) { | |
items = sess.createCriteria(Item.class) | |
.add(Restrictions.ilike("name", filter+"%")) | |
.list(); | |
} | |
logger.debug("*** after filter"); | |
return new ForwardResolution(LIST); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment