1:
=======
in AddBookAction.java:
if (Validator.isNull(cmd)) {
BookLocalServiceUtil.create(bookTitle);
} else {
List
if (cmd.equals("find")) {
results = BookLocalServiceUtil.findBooks(bookTitle);
} else {
DetachedCriteria dCriteria = DetachedCriteria.forClass(Book.class);
dCriteria.add(Restrictions.like("title", "%" + bookTitle + "%"));
DynamicQuery dynamicQuery = new DynamicQueryImpl(dCriteria);
results = (List)BookLocalServiceUtil.dynamicQuery(dynamicQuery);
}
req.setAttribute("results", results);
req.setAttribute("cmd", cmd);
}
2:
=======
in view.jsp
Add for 'search' button
<input value="Search" onclick="" type="button">findBook('search');" />
Note: the findBook JS function is now accepting a parameter, do changes to this function and also to the "Find Book" button.
3:
=======
in Success.jsp update this
if (Validator.isNotNull(cmd)) {
books = (List)request.getAttribute("results");
} else {
books = BookLocalServiceUtil.getAllBooks();
}
4 :
========
ant deploy from ext-impl,
ant deploy from ext-web,
restart tomcat
No comments :
Post a Comment