Skip to content

@akahn786 /ItemListActionBean.java
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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;
}
<%@ 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>
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
Something went wrong with that request. Please try again.