Dans ce code, j'obtiens authorId pour le nom de chaque auteur de bookListArray
et le montre pour chaque livre, en utilisant l'élément itératif aBook
. Comment puis-je refactoriser mon code sans scriplets? Comment puis-je itérer mon bookListArray
en code .java?itération de JSP en utilisant jstl
<liferay-ui:search-container>
<liferay-ui:search-container-results results="${bookListArray}" />
<liferay-ui:search-container-row className="builder.model.Book" keyProperty="bookId" modelVar="aBook">
<liferay-ui:search-container-column-text property="bookName" name="book-Name" />
<liferay-ui:search-container-column-text property="bookDescription" name="description" />
<%
Author bookAuthor = AuthorLocalServiceUtil.getAuthor(aBook.getAuthorId());
%>
<liferay-ui:search-container-column-text value="<%=bookAuthor.getAuthorName() %>" name="Author" />
<liferay-ui:search-container-column-jsp path="/html/actionBook.jsp" align="right" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
Ce sont mes listes d'auteur et le livre:
List<Book> bookList = BookLocalServiceUtil.getBooks(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
List<Author> authorList = AuthorLocalServiceUtil.getAuthors(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
request.setAttribute("bookListArray", bookList);
request.setAttribute("authorListArray", authorList);
si vous voulez regarder mon projet, vous pouvez le faire ici: https://github.com/AlBoldyrev/Library/blob/master/bundles/tomcat-7.0.62/webapps/LibraryBook-portlet/WEB-INF/src/com/softwerke/BookAndAuthor.java
@Parkash J'ai besoin de votre aide! : P – German
Où est bookListArray, peut inclure ce code aussi –
@ B'bekShakya J'ai mis à jour ma question – German